diff options
| -rw-r--r-- | src/Text/Pandoc/Writers/Typst.hs | 4 | ||||
| -rw-r--r-- | test/writer.typst | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index 53edbcb0c..8cd64d2ac 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -189,10 +189,12 @@ blockToTypst block = return $ "#figure(" <> nest 2 (brackets contents <> "," <> cr <> ("caption: [" $$ nest 2 caption $$ "]")) $$ ")" $$ lab $$ blankline + Div (ident,_,_) (Header lev ("",cls,kvs) ils:rest) -> + blocksToTypst (Header lev (ident,cls,kvs) ils:rest) Div (ident,_,_) blocks -> do let lab = toLabel ident contents <- blocksToTypst blocks - return $ lab $$ contents + return $ "#block[" $$ contents $$ ("]" <+> lab) defListItemToTypst :: PandocMonad m => ([Inline], [[Block]]) -> TW m (Doc Text) defListItemToTypst (term, defns) = do diff --git a/test/writer.typst b/test/writer.typst index 14658c489..d645d11b2 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -497,20 +497,32 @@ orange fruit <html-blocks> Simple block on one line: +#block[ foo +] And nested without indentation: +#block[ +#block[ +#block[ foo +] +] +#block[ bar +] +] Interpreted markdown in a table: This is #emph[emphasized] And this is #strong[strong] Here’s a simple block: +#block[ foo +] This should be a code block, though: ``` @@ -527,7 +539,13 @@ As should this: Now, nested: +#block[ +#block[ +#block[ foo +] +] +] This should just be an HTML comment: Multiline: |
