aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-08-21 11:29:27 -0700
committerJohn MacFarlane <[email protected]>2023-08-21 11:29:27 -0700
commit40accba747a8bbcf82260bb60316ded731233492 (patch)
treebdebfd63ebcf9560941a9d7134bbd7742e6cea4e /src
parent70329edcd7afb7b3f8f015b13ab2e734c9e31d05 (diff)
Typst writer: use `~` for nonbreaking space.
And escape literal `~`. Closes #9010.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Typst.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs
index 8cd64d2ac..a92924aa0 100644
--- a/src/Text/Pandoc/Writers/Typst.hs
+++ b/src/Text/Pandoc/Writers/Typst.hs
@@ -298,8 +298,10 @@ escapeTypst context t =
else t
where
escapeChar c
+ | c == '\160' = "~"
| needsEscape c = "\\" <> T.singleton c
| otherwise = T.singleton c
+ needsEscape '\160' = True
needsEscape '[' = True
needsEscape ']' = True
needsEscape '#' = True
@@ -314,6 +316,7 @@ escapeTypst context t =
needsEscape '=' = True
needsEscape '_' = True
needsEscape '*' = True
+ needsEscape '~' = True
needsEscape ':' = context == TermContext
needsEscape _ = False