diff --git a/CHANGES.md b/CHANGES.md index b1413c29a5..fbc16da121 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,7 @@ Core Grammars: - enh(json) add json5 support [Kerry Shetline][] - fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][] - fix(csharp) Support digit separators [te-ing][] +- fix(markdown) Ignore mid_word underscores, issue #4279 [Dan Vanderkam] Documentation: @@ -55,6 +56,7 @@ CONTRIBUTORS [te-ing]: https://github.com/te-ing [Anthony Martin]: https://github.com/anthony-c-martin [NriotHrreion]: https://github.com/NriotHrreion +[Dan Vanderkam]: https://github.com/danvk ## Version 11.11.1 diff --git a/src/languages/markdown.js b/src/languages/markdown.js index 3d73d062e9..5a08a3ff72 100644 --- a/src/languages/markdown.js +++ b/src/languages/markdown.js @@ -156,8 +156,8 @@ export default function(hljs) { end: /\*/ }, { - begin: /_(?![_\s])/, - end: /_/, + begin: /(?> * One (this point is italic) > * Two > * Three + +No italics mid_word underscores. +But italics for _full_word_ with underscores. diff --git a/test/markup/markdown/bold_italics.txt b/test/markup/markdown/bold_italics.txt index c85202e554..fa44e30c83 100644 --- a/test/markup/markdown/bold_italics.txt +++ b/test/markup/markdown/bold_italics.txt @@ -31,3 +31,6 @@ _ not italic_ > * One (this point is italic) > * Two > * Three + +No italics mid_word underscores. +But italics for _full_word_ with underscores.