From 6c1ea55f2f2e15753ab67a2f5d917cf00a92e21c Mon Sep 17 00:00:00 2001 From: Nicholaus Clark Date: Wed, 9 Aug 2023 12:21:02 -0400 Subject: [PATCH] Fix escaping issue in mock code markup --- src/components/wiki.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/wiki.ts b/src/components/wiki.ts index aaaa0c85..10046d14 100644 --- a/src/components/wiki.ts +++ b/src/components/wiki.ts @@ -209,6 +209,7 @@ class ArticleParser { let result = ""; let piece = ""; let in_inline_code = false; + let prev = ""; for (const c of line) { if (c === "`") { if (in_inline_code) { @@ -218,10 +219,11 @@ class ArticleParser { result += this.substitute_placeholders_no_code(piece); piece = c; } - in_inline_code = !in_inline_code; + in_inline_code = prev !== "\\" ? !in_inline_code : in_inline_code; } else { piece += c; } + prev = c; } return result + (in_inline_code ? piece : this.substitute_placeholders_no_code(piece)); }