Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}
block(above: 0em, below: 2em)[
#outline(
title: toc_title,
title: title,
depth: toc_depth,
indent: toc_indent
);
Expand Down
6 changes: 6 additions & 0 deletions tests/docs/smoke-all/typst/toc/strip-toc-title.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Removes the toc-title metadata that Quarto adds before Pandoc runs,
-- causing article() to use its `toc_title: none` default.
function Meta(meta)
meta["toc-title"] = nil
return meta
end
30 changes: 30 additions & 0 deletions tests/docs/smoke-all/typst/toc/toc-title-auto-fallback.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "TOC title auto fallback"
lang: en
toc: true
format:
typst:
keep-typ: true
filters:
- strip-toc-title.lua
_quarto:
tests:
typst:
ensureTypstFileRegexMatches:
- # Patterns that MUST be found
# The outline is emitted, so the `if toc` branch of article() ran
- '#outline\('
- # Patterns that must NOT be found
# No toc_title argument in the article() call: the filter removed the
# metadata, so article() falls back to its own `toc_title: none` default
- 'toc_title: \['
ensurePdfRegexMatches:
- # Typst's `auto` outline title for lang: en
- 'Contents'
---

Quarto fills `toc-title` with a localized default before Pandoc runs, so the
Typst `article()` function normally receives a `toc_title` argument. This test
uses a Lua `Meta` filter to remove the key and reach the function's own
`toc_title: none` default. In that case, `outline(title: auto)` provides the
table of contents heading.
Loading