Fix codeblock underscores with language

This commit is contained in:
Cohee 2024-08-25 21:17:59 +03:00
parent 0fb528ac09
commit de91b395b0

View File

@ -8,7 +8,7 @@ export const markdownUnderscoreExt = () => {
return [{
type: 'output',
regex: new RegExp('(<code>[\\s\\S]*?<\\/code>)|\\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\\b', 'g'),
regex: new RegExp('(<code(?:\\s+[^>]*)?>[\\s\\S]*?<\\/code>)|\\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\\b', 'g'),
replace: function(match, codeContent, italicContent) {
if (codeContent) {
// If it's inside <code> tags, return unchanged