Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add term syntax DOCSTOOLS-1268 #172

Merged
merged 22 commits into from
Sep 13, 2022
Merged

Add term syntax DOCSTOOLS-1268 #172

merged 22 commits into from
Sep 13, 2022

Conversation

martyanovandrey
Copy link
Contributor

@martyanovandrey martyanovandrey commented Aug 25, 2022

Add term syntax:

[*tex]: TeX is a popular means of typesetting complex mathematical formulae, it has been noted as one of the most sophisticated digital typographical systems.

Anything between two $ characters will be treated as [TeX](*tex) math.

image

@martyanovandrey martyanovandrey force-pushed the term branch 4 times, most recently from 69c1328 to 7b0e32a Compare August 25, 2022 13:48
@martyanovandrey martyanovandrey changed the title Add term syntax Add term syntax DOCSTOOLS-1268 Sep 6, 2022
@@ -0,0 +1,110 @@
import StateCore from 'markdown-it/lib/rules_core/state_core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any errors or warnings. Example, if user use term which not declared. Could you add it and another cases?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found duplicate, but use undeclared def looks more important

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added two more lint warning rules:

  • Term used without definition
  • Term inside definition not allowed

// cut out "heading_open", "inline" and "heading_close" tokens
contentTokens = tokens.slice(3);
contentTokens = [...tokens.slice(0, start), ...tokens.slice(start + 3)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who do you need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In term plugin I push the __yfm_lint token to define warnings. If the __yfm_lint token became the first token on the page, then function extractTitle does not work properly, because it expects the first token to be heading_open. So I skip all first lint tokens.

As the alternative, I thought that I can pass runningInLint variable in pluginOptions and based on that add or not __yfm_lint token. But this will lead to inconsistency tokens when run on lint and not.

@martyanovandrey martyanovandrey merged commit ddfb30b into master Sep 13, 2022
@martyanovandrey martyanovandrey deleted the term branch September 13, 2022 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants