-
-
Notifications
You must be signed in to change notification settings - Fork 550
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
Incorrect emphasis handling #383
Comments
Reading the algorithm at the end of the spec, I think I see the issue. We have an |
The problem arose as follows. The input was ``` *****Hello*world**** ``` We have an `openers_bottom` table that limits how far back you have to look for an opener. It is indexed to the type of delimiter (`_` or `*`) and the length of the closing delimiter mod 3. So after we fail to match the opener `*****` to `*`, we set the openers_bottom for `(*, 1)` to the location of `*`, effectively removing the `*****` as a possible opener for any run of `*`s with a length mod 3 of 1, including the final `****` in this example. This procedure ignores the fact that the length mod 3 restriction only matters if one of the delimiters can be both an opener and a closer. To fix this problem, we index the `openers_bottom` table not just to the type of delimiter and the length of the closing delimiter mod 3, but to whether the closing delimiter can also be an opener.
This reverts commit 10ed0d0.
0.2.1.1 * Fix bug in prettyShow for SourceRange (#80). The bug led to an infinite loop in certain cases. 0.2.1 * Use official 0.30 spec.txt. * Update HTML block parser for recent spec changes. * Fix test case from commonmark/cmark#383. We need to index the list of stack bottoms not just by the length mod 3 of the closer but by whether it can be an opener, since this goes into the calculation of whether the delimiters can match. 0.2 * Commonmark.Inlines: export LinkInfo(..) [API change]. * Commonmark.Inlines: export pLink [API chage]. * Comonmark.ReferenceMap: Add linkPos field to LinkInfo [API change]. * Commonmark.Tokens: normalize unicode to NFC before tokenizing (#57). Normalization might affect detection of flankingness, recognition of reference links, etc. * Commonmark.Html: add data-prefix to non-HTML5 attributes, as pandoc does. * Remove unnecessary build-depends. * Use lightweight tasty-bench instead of criterion for benchmarks.
(Distilled from https://talk.commonmark.org/t/i-dont-understand-how-emphasis-is-parsed/3866)
Input:
Actual Output:
Expected Output:
More detailed rationale can be found in this comment: https://talk.commonmark.org/t/i-dont-understand-how-emphasis-is-parsed/3866/8
The text was updated successfully, but these errors were encountered: