aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-03-22 10:30:16 -0700
committerJohn MacFarlane <[email protected]>2025-03-22 10:30:16 -0700
commit4ab4c62de38372def66b07cfc8f75518a599d249 (patch)
tree92bb51ad522cf862462e9b83772a2453e5f8414f /src
parent59fb9c40de5cdb3f5842c5519c88cb1175b757d8 (diff)
Commonmark Reader: handle GFM math irregularity with braces.
In GFM, you need to use `\\{` rather than `\{` for a literal brace. Closes #10631.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/CommonMark.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs
index e3c8afc4c..aa76a43e8 100644
--- a/src/Text/Pandoc/Readers/CommonMark.hs
+++ b/src/Text/Pandoc/Readers/CommonMark.hs
@@ -120,8 +120,10 @@ handleGfmMath (CodeBlock ("",["math"],[]) raw) = Para [Math DisplayMath raw]
handleGfmMath x = walk handleGfmMathInline x
handleGfmMathInline :: Inline -> Inline
-handleGfmMathInline (Math InlineMath math') =
- let (ticks, rest) = T.span (== '`') math'
+handleGfmMathInline (Math InlineMath math'') =
+ let math' = T.replace "\\\\{" "\\{" . T.replace "\\\\}" "\\}" $ math''
+ -- see #10631
+ (ticks, rest) = T.span (== '`') math'
in if T.null ticks
then Math InlineMath math'
else case T.stripSuffix ticks rest of