Skip to content

Commit 3238896

Browse files
committed
typst: alias divider() to Quarto's horizontalrule for Pandoc 3.13
Pandoc 3.13's typst writer emits #divider() for HorizontalRule. With Typst 0.15 that resolves to std.divider, a full-width 0.55pt line, silently replacing Quarto's centered 25-75% rule. Define divider() as an alias of the existing horizontalrule so documents keep their look; the name horizontalrule stays because notes.typ and external typst templates call it.
1 parent 2182ec6 commit 3238896

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎llm-docs/pandoc-quarto-typst-templates.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Combines Pandoc definitions with Quarto-specific functionality:
8686

8787
**From Pandoc**:
8888
- `content-to-string` helper to extract text from content nodes (used for PDF metadata and link colors)
89-
- `horizontalrule` definition for horizontal rules
89+
- `horizontalrule` definition for horizontal rules, plus a `divider()` alias to it (Pandoc 3.13's typst writer emits `#divider()`; the alias keeps Quarto's centered 25-75% line instead of typst's full-width std divider)
9090
- Term list hanging indent (`#set terms(hanging-indent: 1.5em)`; Pandoc 3.13 dropped its custom `terms.item` show rule)
9191
- CSL citeproc formatting (`#show <refs>: set par(...)` with `csl-hanging-indent` / `csl-entry-spacing` under `$if(csl-settings)$`, from Pandoc 3.12.1's `default.typst`; applies CSL hanging indent and entry spacing to Pandoc-citeproc bibliographies)
9292
- Code highlighting definitions (conditionally included)

‎src/resources/formats/typst/pandoc/quarto/definitions.typ‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
}
1313

1414
#let horizontalrule = line(start: (25%,0%), end: (75%,0%))
15+
// Pandoc 3.13's typst writer emits #divider() for HorizontalRule; alias it to
16+
// Quarto's rule so documents keep the centered 25-75% line instead of typst's
17+
// full-width std divider.
18+
#let divider() = horizontalrule
1519

1620
#let endnote(num, contents) = [
1721
#stack(dir: ltr, spacing: 3pt, super[#num], contents)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: "Horizontal rule keeps Quarto's look"
3+
format:
4+
typst:
5+
keep-typ: true
6+
_quarto:
7+
tests:
8+
typst:
9+
# Pandoc 3.13 writer emits #divider() for HorizontalRule; Quarto's
10+
# template aliases divider to its centered 25-75% horizontalrule.
11+
ensureTypstFileRegexMatches:
12+
- ['\#divider\(\)', '\#let divider\(\) = horizontalrule']
13+
- ['std\.divider']
14+
noErrors: default
15+
---
16+
17+
a
18+
19+
---
20+
21+
b

0 commit comments

Comments
 (0)