Skip to content

Commit 53ebab9

Browse files
committed
fix(shortcodes): use semicolon delimiter to avoid smart typography issue (#13913)
Shortcodes followed by a trailing dash were being hex-encoded in output because Pandoc's +smart extension converts -- to en-dash, breaking the UUID pattern match during decode. Changed the delimiter from - to ; in the UUID-HEX encoding format to prevent this collision with smart typography.
1 parent 73eacac commit 53ebab9

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/resources/pandoc/datadir/lpegshortcode.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ local function string_to_hex(str)
321321
end
322322

323323
local md_shortcode_2_uuid = "b58fc729-690b-4000-b19f-365a4093b2ff"
324-
local md_shortcode_2_uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff%-"
324+
local md_shortcode_2_uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff;"
325325
local function md_escaped_shortcode_2_fun(s)
326326
return table.concat({
327327
md_shortcode_2_uuid,
328-
"-",
328+
";",
329329
string_to_hex("{{{<" .. s .. ">}}}"),
330-
"-"
330+
";"
331331
})
332332
end
333333

@@ -340,9 +340,9 @@ local function md_shortcode_2_fun(open, space, lst, close)
340340
raw = raw .. close
341341
return table.concat({
342342
md_shortcode_2_uuid,
343-
"-",
343+
";",
344344
string_to_hex(raw),
345-
"-"
345+
";"
346346
});
347347
end
348348

src/resources/pandoc/datadir/readqmd.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ local function hex_to_string(hex)
121121
end
122122

123123
local function readqmd(txt, opts)
124-
local uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff%-([A-Fa-f0-9]+)%-"
124+
local uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff;([A-Fa-f0-9]+);"
125125
local tags
126126
txt = md_fenced_div.attempt_to_fix_fenced_div(txt)
127127
txt, tags = escape_invalid_tags(txt)

0 commit comments

Comments
 (0)