diff --git a/src/rules.ts b/src/rules.ts index 7e00f7000f..e2c4875497 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -267,7 +267,9 @@ const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u; const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u; // sequences em should skip over [title](link), `code`, -const blockSkip = /\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g; +const blockSkip = edit(/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|codePattern|<(?! )[^<>]*?>/, 'g') + .replace('codePattern', /(?**You might think this should be bold, but: **

+

**You might think this should be bold, but: **

+

**You might think this should be bold, but: **

+

**You might think this should be bold, but: **

+

This should be bold and this should be code

+

start contains ** end

+

This should be bold ```

+

This should be bold ```

+

start contains ** end

\ No newline at end of file diff --git a/test/specs/new/issue_3776_backtick_precedence.md b/test/specs/new/issue_3776_backtick_precedence.md new file mode 100644 index 0000000000..2db6949a93 --- /dev/null +++ b/test/specs/new/issue_3776_backtick_precedence.md @@ -0,0 +1,17 @@ +**You might think this should be bold, but: `**` + +**You might think this should be bold, but: ``**`` + +**You might think this should be bold, but: ```**``` + +**You might think this should be bold, but: ````**```` + +**This should be bold** and `this should be code` + +**start `contains **` end** + +**This should be bold ``**` + +**This should be bold `**`` + +**start ``contains **`` end** \ No newline at end of file