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
Fix handling of reference links with inline code #24
Conversation
This fixes the AST so that certain kinds of reference links are not broken when converted back to markdown. Fixes: remarkjs/remark#850
This comment has been minimized.
This comment has been minimized.
I don't know if this is the right fix for remarkjs/remark#850, but it fixes that issue without breaking any existing tests, so I'm hopeful.... |
Nice catch! It looks like definitions do get a proper There is probably a problem with character references and character escapes though. Take this example: [`f`][]
[;][]
[\;][]
[;][]
[`f`;][]
[`f`\;][]
[`f`;][]
[`f`]: alpha
[;]: bravo
[\;]: charlie
[;]: delta
[`f`;]: echo
[`f`\;]: foxtrot
[`f`;]: golf Note that one might expect that character references and -escapes and the actual value would match, but CommonMark does not: <p><a href="alpha"><code>f</code></a>
<a href="bravo">;</a>
<a href="charlie">;</a>
<a href="delta">;</a>
<a href="echo"><code>f</code>;</a>
<a href="foxtrot"><code>f</code>;</a>
<a href="golf"><code>f</code>;</a></p> Looking at the AST that remark produces, the definitions work properly: the character references and -escapes are handled properly in label/identifier. The same is true for link (and image?) references, but there the code (and probably other things such as emphasis), as you found out, don’t work. |
This comment has been minimized.
This comment has been minimized.
I was able to verify that micromark does handle this correctly: micromark/micromark@5be7549 |
Add a new utility, `micromark-util-decode-string`, which helps decode character escapes and -references as found in the string content type of markdown. This is not used in `micromark` itself but is useful for extensions and mdast utilities. Related to syntax-tree/mdast-util-from-markdown#24. Related to remarkjs/remark#850.
Closes GH-24. Closes remarkjs/remark#850.
This comment has been minimized.
This comment has been minimized.
Thanks @Trott, this helped a lot. Released! |
Initial checklist
Description of changes
This fixes the AST so that certain kinds of reference links are not
broken when converted back to markdown.
Fixes: remarkjs/remark#850