aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-07-04 11:04:14 -0700
committerJohn MacFarlane <[email protected]>2023-07-04 11:04:14 -0700
commit2d20b3aad0a80de3b394bbce7b261f9e11c8b6fc (patch)
tree8600a52093f1f6905b275fe8f70329e81a930149
parentae57c6e3fb4c57e94669ec7453260a402ef58a92 (diff)
Typst writer: support `unlisted` class in headings.
Closes #8941.
-rw-r--r--src/Text/Pandoc/Writers/Typst.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs
index 587a5e777..a844865aa 100644
--- a/src/Text/Pandoc/Writers/Typst.hs
+++ b/src/Text/Pandoc/Writers/Typst.hs
@@ -91,10 +91,15 @@ blockToTypst block =
case block of
Plain inlines -> inlinesToTypst inlines
Para inlines -> ($$ blankline) <$> inlinesToTypst inlines
- Header level (ident,_,_) inlines -> do
+ Header level (ident,cls,_) inlines -> do
contents <- inlinesToTypst inlines
let lab = toLabel ident
- return $ literal (T.replicate level "=") <> space <> contents <> cr <> lab
+ return $
+ if "unlisted" `elem` cls
+ then literal "#heading(outlined: false)" <> brackets contents <>
+ cr <> lab
+ else literal (T.replicate level "=") <> space <> contents <>
+ cr <> lab
RawBlock fmt str ->
case fmt of
Format "typst" -> return $ literal str