mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Replace underscores in HTML output
This commit is contained in:
@ -7,11 +7,11 @@ export const markdownUnderscoreExt = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
type: 'lang',
|
type: 'output',
|
||||||
regex: /(`{3,})\s*\n[\s\S]*?\n\1(?:\n|$)|(`{1,2}).*?\2|(\n`\n[\s\S]*?\n`\n)|(?<!\S)_(?!_)([^_\n]+?)(?<!_)_(?!\w)/g,
|
regex: new RegExp('(<code>[\\s\\S]*?<\\/code>)|(?<!\\S)_(?!_)([^_\\n]+?)(?<!_)_(?!\\w)', 'g'),
|
||||||
replace: function(match, tripleBackticks, singleOrDoubleBackticks, singleBackticksWithLineBreaks, italicContent) {
|
replace: function(match, codeContent, italicContent) {
|
||||||
if (singleOrDoubleBackticks || tripleBackticks || singleBackticksWithLineBreaks) {
|
if (codeContent) {
|
||||||
// If it's any type of backticks, return unchanged
|
// If it's inside <code> tags, return unchanged
|
||||||
return match;
|
return match;
|
||||||
} else if (italicContent) {
|
} else if (italicContent) {
|
||||||
// If it's an italic group, apply the replacement
|
// If it's an italic group, apply the replacement
|
||||||
|
Reference in New Issue
Block a user