Fix for unmatched triple backticks

5f3dddfe219c1916e8dbbe181818f4a3788e9754

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -4Ignore whitespace
public/scripts/showdown-underscore.js+4 -4
@@ -8,16 +8,16 @@ export const markdownUnderscoreExt = () => {
88
9 return [{9 return [{
10 type: 'lang',10 type: 'lang',
11 regex: new RegExp('(`{3})[\\s\\S]*?\\1|(`{1,2}).*?\\2|\\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\\b', 'g'),11 regex: /(`{3,})\s*\n[\s\S]*?\n\1(?:\n|$)|(`{1,2}).*?\2|(?<!\S)_(?!_)([^_\n]+?)(?<!_)_(?!\w)/g,
12 replace: function(match, tripleBackticks, singleOrDoubleBackticks, italicContent) {12 replace: function(match, tripleBackticks, singleOrDoubleBackticks, italicContent) {
13 if (tripleBackticks || singleOrDoubleBackticks) {13 if (singleOrDoubleBackticks || tripleBackticks) {
14 // If it's any kind of code block, return it unchanged14 // If it's backticks, return unchanged
15 return match;15 return match;
16 } else if (italicContent) {16 } else if (italicContent) {
17 // If it's an italic group, apply the replacement17 // If it's an italic group, apply the replacement
18 return '<em>' + italicContent + '</em>';18 return '<em>' + italicContent + '</em>';
19 }19 }
20 // If neither condition is met, return the original match20 // If none of the conditions are met, return the original match
21 return match;21 return match;
22 },22 },
23 }];23 }];