Skip to content

Inline code incorrectly parsed as emphasis in specific cases #493

@sarayourfriend

Description

@sarayourfriend

Subject of the issue

remark incorrectly parses emphasis markers that span an inline code fence in certain cases.

https://astexplorer.net/#/gist/07d9ecadf011d35e45b47e73ff91edf8/1dc9657f969f4723440e250bcbf0c2b6e441d1ea

aa_bb `aa_ bb` parses _bb `aa_ as a single emphasis block instead of respecting the inline code marker.

aa_bb `aa _bb` is parsed correctly with no emphasis.

Relatedly, aa**bb `aa**bb` is also incorrectly parsed in a similar way. My suspicion is that these would be related bugs, but I can open a separate issue if not.

I haven't looked into where I think this is being caused but I'll take a look later today and see if I can't uncover it.

Steps to reproduce

See the astexplorer example from above: https://astexplorer.net/#/gist/07d9ecadf011d35e45b47e73ff91edf8/1dc9657f969f4723440e250bcbf0c2b6e441d1ea

Run aa_bb `aa_ bb` through the parser.

Expected behaviour

You should receive the following pseudo-AST:

text: "aa_bb"
inlineCode: "aa_ bb"

Actual behaviour

You receive the following psudo-AST:

text: "aa"
emphasis: "bb `aa"
text: "bb"

Relates to prettier/prettier#7695

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions