From 5154ff908db6ca5dfeb2dd0587f83846bbde2500 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 29 Feb 2024 14:15:11 -0400 Subject: replacer: never process "", restore "" into text nodes --- src/util/replacer.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/replacer.js b/src/util/replacer.js index 2c0e89f1..f692b068 100644 --- a/src/util/replacer.js +++ b/src/util/replacer.js @@ -201,7 +201,7 @@ function parseNodes(input, i, stopAt, textOnly) { string = string.trimEnd(); } - string = squashBackslashes(string); + string = cleanRawText(string); if (string.length) { nodes.push({i: iString, iEnd: i, type: 'text', data: string}); @@ -429,6 +429,19 @@ export function squashBackslashes(text) { return text.replace(/([^\\](?:\\{2})*)\\(?![\\*_-])/g, '$1'); } +export function restoreRawHTMLTags(text) { + // Replace stuff like with ; these signal that + // the tag shouldn't be processed by the replacer system, + // and should just be embedded into the content as raw HTML. + return text.replace(/])/g, '<$1'); +} + +export function cleanRawText(text) { + text = squashBackslashes(text); + text = restoreRawHTMLTags(text); + return text; +} + export function postprocessImages(inputNodes) { const outputNodes = []; -- cgit 1.3.0-6-gf8a5