-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
[remark-parse] Ordered lists are not recognized if they both use leading zeroes and interrupt a block #1242
Comments
Apologies for not providing a runnable example, but I spent more time trying (and failing) to get codesandbox to do something useful than I did on the rest of the report. 😅 |
Thanks @benblank! Checking the four examples in CommonMark Dingus
It does indeed appear all four should produce a list Tracing further. |
This comment has been minimized.
This comment has been minimized.
Ah! Dang. I'd traced it this far down from Prettier and thought I'd gotten to the bottom of it. 🙂 Thanks for all the helpful links! |
I do think the spec is unclear for this:
(right above example 304). I think that the current behavior is in line with the reasoning there. Natural language phrases might include |
If you care strongly about this, could you perhaps open an issue with |
Actually, I missed that when I was reading through the spec. I'm not sure I 100% agree with the reasoning behind it, but those reasons do at least appear to be pretty clear. I may indeed open up an issue with regards to the phasing, though; I feel the section you quoted would be improved by calling out that it's only referring to ordered lists and to the markers I also have to admit to being a bit surprised to see "interrupting, not starting with On the one hand, it's a shame to "disagree" with so many other implementations, but the spec is clear as to what the Right Thing is, and it isn't what I was trying to do. I'll go ahead and close the issue. Thanks for taking the time to look into this! |
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
There’s a wide variety of parser that all do things differently. |
Initial checklist
Affected packages and versions
[email protected]
Link to runnable example
No response
Steps to reproduce
In a new folder, create a new Node module by running e.g.
pnpm init
.Run
pnpm install [email protected]
.Run
pnpm install [email protected]
.Save the code below as
repro.mjs
file and runnode repro.mjs
. (I used Node v18.17.0.)This will generate a JSON file containing the parsed AST (sans
position
properties, so that they can be easily diffed) for each of the Markdown snippets it contains.repro.mjs
Observe that the files
noLeadingZeroesFollowing.json
,leadingZeroesFollowing.json
, andnoLeadingZeroesInterrupting.json
are identical and that their root nodes contain both a paragraph node and a list node. However, the root node inleadingZeroesInterrupting.json
instead contains only a single paragraph node. Diffing it against any of the other files will produce output similar to the following.repro.diff
Expected behavior
Ordered lists should be parsed consistently, regardless of whether their list markers have leading zeroes or the list interrupts a block.
Actual behavior
Ordered lists are recognized as such if their list markers have leading zeroes or they interrupt a block. However, ordered lists are not recognized as such if their list markers have leading zeroes and they interrupt a block.
Runtime
Other (please specify in steps to reproduce)
Package manager
pnpm
OS
Linux
Build and bundle tools
Other (please specify in steps to reproduce)
The text was updated successfully, but these errors were encountered: