Skip to content

Commit c93acab

Browse files
authored
Add support for reading typst pagebreak (#11126)
The pagebreak is parsed as a HorizontalRule inside a wrapper Div with class `page-break`. Closes #11101.
1 parent 71a0c5c commit c93acab

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Text/Pandoc/Readers/Typst.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ blockHandlers = M.fromList
396396
getField "body" fields >>= pWithContents pBlocks)
397397
,("pad", \_ _ fields -> -- ignore paddingy
398398
getField "body" fields >>= pWithContents pBlocks)
399+
,("pagebreak", \_ _ _ -> pure $ B.divWith ("", ["page-break"], [("wrapper", "1")]) B.horizontalRule)
399400
]
400401

401402
inlineHandlers :: PandocMonad m =>

test/command/11101.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```
2+
% pandoc -f typst -t native
3+
First paragraph.
4+
5+
#pagebreak()
6+
7+
Second paragraph.
8+
^D
9+
[ Para [ Str "First" , Space , Str "paragraph." ]
10+
, Div
11+
( "" , [ "page-break" ] , [ ( "wrapper" , "1" ) ] )
12+
[ HorizontalRule ]
13+
, Para [ Str "Second" , Space , Str "paragraph." ]
14+
]
15+
```

0 commit comments

Comments
 (0)