Skip to content

(markdown) snake_case term causes italics in rest of file #4279

@danvk

Description

@danvk

Describe the issue

If you have an unescaped term in snake_case in a Markdown file, it puts highlight.js into "italic mode" when it should not. GitHub-Flavored Markdown (GFM) and others seem to not italicize underscores in the middle of a word.

Which language seems to have the issue?

  • markdown

Are you using highlight or highlightAuto?

  • highlight

Sample Code to Reproduce

https://jsfiddle.net/mn15jwg7/

Header_under

    code listing; italic

More text, still italic.

Here's how highlight.js renders it on the playground. Note how the _ puts it into Italic mode and it never leaves, even in subsequent blocks:

Image

Here's how GitHub renders the same markdown:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions