-
Notifications
You must be signed in to change notification settings - Fork 32
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
👌 IMPROVE: MyST role syntax parsing #32
Conversation
Match characters instead of using regex. This now allows for an unlimited name length and new lines in the content.
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
==========================================
- Coverage 93.20% 93.04% -0.17%
==========================================
Files 24 24
Lines 1237 1251 +14
==========================================
+ Hits 1153 1164 +11
- Misses 84 87 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a test case with a line break in between the backticks to cover executablebooks/MyST-Parser#448?
<p>a <code class="myst role">{abc}[xyz]</code> b</p> | ||
. | ||
|
||
New lines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webknjaz that test is already here. Is there any other fixtures you can think of before I merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a more complex case with spaces in the reference between angled braces?
{ref}`some
text
<and
a
custom reference>`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the quick reply
This complexity won't particularly make a difference here though: the markdown-plugin just stores everything inside the ticks as a raw string (now replacing new lines with spaces), then the token (with name+content) is processed specifically by myst-parser. i.e. it doesn't really matter what is inside the ticks (in the example above the token's content will be some text <and a custom reference>
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. But I'd still have some regression test for this, if not in this lib, then in some other place maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I can add a test like this in myst-parser, when I downstream this change to there 👍
Does (or could) the unlimited length thing also apply to executablebooks/MyST-Parser#181? |
yep indeed 👍, thank for pointing that out |
Match characters instead of using regex.
This now allows for an unlimited name length and new lines in the content.