From 1ba9430f656e675cb40592663a5a1c24d4001c02 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 19 Jan 2026 16:03:28 +0100 Subject: [PATCH 1/4] test(smoke): add regression test for shortcode with trailing dash (#13913) --- tests/docs/smoke-all/2026/01/19/13913.qmd | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/docs/smoke-all/2026/01/19/13913.qmd diff --git a/tests/docs/smoke-all/2026/01/19/13913.qmd b/tests/docs/smoke-all/2026/01/19/13913.qmd new file mode 100644 index 00000000000..edea9019cea --- /dev/null +++ b/tests/docs/smoke-all/2026/01/19/13913.qmd @@ -0,0 +1,14 @@ +--- +title: Shortcode with trailing dash +format: html +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['

Normal shortcode: [0-9]+\.[0-9]+\.[0-9]+

', '

Shortcode with trailing dash: [0-9]+\.[0-9]+\.[0-9]+-

'] + - [] +--- + +Normal shortcode: {{< version >}} + +Shortcode with trailing dash: {{< version >}}- From 73eacac94f90ed45c88b9d9884facd1711d8ed75 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 19 Jan 2026 16:51:36 +0100 Subject: [PATCH 2/4] Add .gitignore from running tests --- tests/docs/shortcodes/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/docs/shortcodes/.gitignore b/tests/docs/shortcodes/.gitignore index 075b2542afb..0e3521a7d0f 100644 --- a/tests/docs/shortcodes/.gitignore +++ b/tests/docs/shortcodes/.gitignore @@ -1 +1,3 @@ /.quarto/ + +**/*.quarto_ipynb From 53ebab98202d8dee38972f3ce691994477bd76cd Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 19 Jan 2026 16:52:51 +0100 Subject: [PATCH 3/4] 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. --- src/resources/pandoc/datadir/lpegshortcode.lua | 10 +++++----- src/resources/pandoc/datadir/readqmd.lua | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/resources/pandoc/datadir/lpegshortcode.lua b/src/resources/pandoc/datadir/lpegshortcode.lua index 37a706960d4..92046ab1b79 100644 --- a/src/resources/pandoc/datadir/lpegshortcode.lua +++ b/src/resources/pandoc/datadir/lpegshortcode.lua @@ -321,13 +321,13 @@ local function string_to_hex(str) end local md_shortcode_2_uuid = "b58fc729-690b-4000-b19f-365a4093b2ff" -local md_shortcode_2_uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff%-" +local md_shortcode_2_uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff;" local function md_escaped_shortcode_2_fun(s) return table.concat({ md_shortcode_2_uuid, - "-", + ";", string_to_hex("{{{<" .. s .. ">}}}"), - "-" + ";" }) end @@ -340,9 +340,9 @@ local function md_shortcode_2_fun(open, space, lst, close) raw = raw .. close return table.concat({ md_shortcode_2_uuid, - "-", + ";", string_to_hex(raw), - "-" + ";" }); end diff --git a/src/resources/pandoc/datadir/readqmd.lua b/src/resources/pandoc/datadir/readqmd.lua index 570584cd76d..2099edb4b33 100644 --- a/src/resources/pandoc/datadir/readqmd.lua +++ b/src/resources/pandoc/datadir/readqmd.lua @@ -121,7 +121,7 @@ local function hex_to_string(hex) end local function readqmd(txt, opts) - local uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff%-([A-Fa-f0-9]+)%-" + local uuid_pattern = "b58fc729%-690b%-4000%-b19f%-365a4093b2ff;([A-Fa-f0-9]+);" local tags txt = md_fenced_div.attempt_to_fix_fenced_div(txt) txt, tags = escape_invalid_tags(txt) From d541684650307853a7169091befb5494e318776e Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 19 Jan 2026 16:57:55 +0100 Subject: [PATCH 4/4] test(smoke): add semicolon edge case to shortcode test (#13913) --- tests/docs/smoke-all/2026/01/19/13913.qmd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/docs/smoke-all/2026/01/19/13913.qmd b/tests/docs/smoke-all/2026/01/19/13913.qmd index edea9019cea..28cff8487e4 100644 --- a/tests/docs/smoke-all/2026/01/19/13913.qmd +++ b/tests/docs/smoke-all/2026/01/19/13913.qmd @@ -1,14 +1,19 @@ --- -title: Shortcode with trailing dash +title: Shortcode with trailing punctuation format: html _quarto: tests: html: ensureFileRegexMatches: - - ['

Normal shortcode: [0-9]+\.[0-9]+\.[0-9]+

', '

Shortcode with trailing dash: [0-9]+\.[0-9]+\.[0-9]+-

'] + - + - '

Normal shortcode: [0-9]+\.[0-9]+\.[0-9]+

' + - '

Shortcode with trailing dash: [0-9]+\.[0-9]+\.[0-9]+-

' + - '

Shortcode with trailing semicolon: [0-9]+\.[0-9]+\.[0-9]+;suffix

' - [] --- Normal shortcode: {{< version >}} Shortcode with trailing dash: {{< version >}}- + +Shortcode with trailing semicolon: {{< version >}};suffix