aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-05-13 10:18:40 -0700
committerJohn MacFarlane <[email protected]>2025-05-13 10:18:40 -0700
commit605c1d4cde001344e8397a4359c53841e0a59f7a (patch)
tree1d9f1edab6617e41cb633aff46f5be41c7f4d240 /src
parentf4676c7dfb36fbd123917e9285a9df96434512a3 (diff)
Markdown writer: omit initial newlines in gfm `math` blocks.
When the input is of the form ``` $$ x=y $$ ``` we would previously get: ```` ``` math x=y ``` ```` which is ugly.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Markdown/Inline.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown/Inline.hs b/src/Text/Pandoc/Writers/Markdown/Inline.hs
index 98ac91cba..05106b259 100644
--- a/src/Text/Pandoc/Writers/Markdown/Inline.hs
+++ b/src/Text/Pandoc/Writers/Markdown/Inline.hs
@@ -537,7 +537,7 @@ inlineToMarkdown opts (Math DisplayMath str) = do
(url <> urlEncode str', str'))
_ | isEnabled Ext_tex_math_gfm opts ->
return $ cr <> (literal "``` math"
- $$ literal str
+ $$ literal (T.dropAround (=='\n') str)
$$ literal "```") <> cr
| isEnabled Ext_tex_math_dollars opts ->
return $ delimited "$$" "$$" (literal str)