-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Markdown underscore matches inline code block content #7695
Copy link
Copy link
Open
Labels
lang:markdownIssues affecting MarkdownIssues affecting Markdownscope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency
Description
Prettier 1.19.1
Playground link
--parser markdownInput:
aa_bb `aa_bb`
aa_bb `aa _bb`
aa_bb `aa_ bb`
aa_bb `aa_`
Renders correctly:
aa_bb aa_bb
aa_bb aa _bb
aa_bb aa_ bb
aa_bb aa_
Output:
aa_bb `aa_bb`
aa_bb `aa _bb`
aa*bb `aa* bb`
aa*bb `aa*`
Renders incorrectly:
aa_bb aa_bb
aa_bb aa _bb
aa*bb aa* bb
aa*bb aa*
Expected behavior:
Code should be unchanged, asterisks should not replace underscores in prose. Underscores should not be matched to content inside an inline code block. Original input renders correctly on the commonmark dingus
This seems to have something to do with tokens inside the inline code block ending with an underscore.
Workaround
Adding a backslash to the initial underscore prevents the content from changing.
aa\_bb `aa_ bb`
aa\_bb `aa_`Renders correctly:
aa_bb aa_ bb
aa_bb aa_
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:markdownIssues affecting MarkdownIssues affecting Markdownscope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency