highlightjs / highlightjs/highlight.js

(markdown) snake_case term causes italics in rest of file

Open
#4,279 5 comments 1 reaction 0 assignees View on GitHub
bug help welcome language
Dominant language
JavaScript
Stars
25k
Forks
3.8k
Avg merge
11h 35m
Merged PRs (30d)
3

Description

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.