From 59c5eab2a08c41a6fe69188ea9e18134bfbaa9d7 Mon Sep 17 00:00:00 2001 From: Amir Dekel <6893125+adql@users.noreply.github.com> Date: Wed, 8 Jul 2026 10:42:56 +0200 Subject: [PATCH] Add support for tight terms in Typst writer (#11748) This just affects whether a blank line is emitted in the markup. Note that pandoc's default template contains a show rule for terms that will make these blank lines irrelevant, but this change allows one to use tight lists with custom templates. --- src/Text/Pandoc/Writers/Typst.hs | 7 +++++-- test/writer.typst | 5 ----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 198f678cf..2dc3f46a1 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -264,8 +264,11 @@ blockToTypst block = return $ (if isTightList items then vcat items' else vsep items') $$ blankline - DefinitionList items -> - ($$ blankline) . vsep <$> mapM defListItemToTypst items + DefinitionList items -> do + let concat' = if all (isTightList . snd) items + then vcat + else vsep + ($$ blankline) . concat' <$> mapM defListItemToTypst items Table (ident,tabclasses,tabkvs) (Caption _ caption) colspecs thead tbodies tfoot -> do let lab = toLabel FreestandingLabel ident capt' <- if null caption diff --git a/test/writer.typst b/test/writer.typst index 74c71c14c..fbcd87d6a 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -447,11 +447,9 @@ Tight using spaces: / apple: #block[ red fruit ] - / orange: #block[ orange fruit ] - / banana: #block[ yellow fruit ] @@ -461,11 +459,9 @@ Tight using tabs: / apple: #block[ red fruit ] - / orange: #block[ orange fruit ] - / banana: #block[ yellow fruit ] @@ -511,7 +507,6 @@ red fruit computer ] - / orange: #block[ orange fruit