diff --git a/.claude/rules/testing/pptx-tests.md b/.claude/rules/testing/pptx-tests.md new file mode 100644 index 00000000000..4efbd962f62 --- /dev/null +++ b/.claude/rules/testing/pptx-tests.md @@ -0,0 +1,8 @@ +--- +paths: + - tests/docs/smoke-all/pptx/** +--- + +# pptx Tests + +How the `ensurePptx*` verifiers address slides, their argument shapes, and why layout assertions depend on the bundled Pandoc: `llm-docs/pptx-testing.md`. diff --git a/.gitignore b/.gitignore index 77ff60c350a..bc4ddf0677d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,9 @@ package/dist/** /tests/test-out.json *~ .env -# deno lock file generated by test runs (the root deno.lock is committed) +# deno lock files generated outside the pinned root lockfile (the root deno.lock is committed) tests/deno.lock +src/deno.lock # deno_std library src/resources/deno_std/cache diff --git a/configuration b/configuration index 5bec25a9701..abbb75ff8e5 100644 --- a/configuration +++ b/configuration @@ -13,7 +13,7 @@ export DENO=v2.9.8 # TODO figure out where 0.1.41 apple silicon libs are available export DENO_DOM=v0.1.41-alpha-artifacts -export PANDOC=3.10 +export PANDOC=3.13 export DARTSASS=1.107.1 export ESBUILD=0.28.2 export TYPST=0.15.1 diff --git a/llm-docs/pandoc-quarto-latex-templates.md b/llm-docs/pandoc-quarto-latex-templates.md index 31a007ef89b..40fa17b3550 100644 --- a/llm-docs/pandoc-quarto-latex-templates.md +++ b/llm-docs/pandoc-quarto-latex-templates.md @@ -120,7 +120,7 @@ Pandoc's `common.latex` is copied as `latex.common`; Quarto maintains its own `c | File | Purpose | | ---------------- | --------------------------------------------------------------------------- | -| `tables.tex` | Table packages (longtable, booktabs, array, multirow) and footnote handling | +| `tables.tex` | Table packages (longtable, booktabs, array, multirow) and caption setup | | `graphics.tex` | graphicx package and `\pandocbounded` command for auto-scaling images | | `citations.tex` | CSL citation definitions (`\citeproc`, `CSLReferences` environment) | | `babel-lang.tex` | Babel language configuration and font setup | diff --git a/llm-docs/pandoc-quarto-typst-templates.md b/llm-docs/pandoc-quarto-typst-templates.md index a94cb9175ed..897f366cbd6 100644 --- a/llm-docs/pandoc-quarto-typst-templates.md +++ b/llm-docs/pandoc-quarto-typst-templates.md @@ -36,7 +36,7 @@ Two files are copied from Pandoc for typst support: **default.typst** (becomes `typst.template`): The main Pandoc template that orchestrates the document structure. It: - Defines a horizontal rule helper -- Sets up term list rendering with indented descriptions +- Sets up term list rendering with a hanging indent - Configures table styling with no strokes - Sets figure caption positions for tables (top) and images (bottom) - Optionally includes syntax highlighting definitions @@ -86,8 +86,9 @@ Combines Pandoc definitions with Quarto-specific functionality: **From Pandoc**: - `content-to-string` helper to extract text from content nodes (used for PDF metadata and link colors) -- `horizontalrule` definition for horizontal rules -- Term list show rule with indented descriptions +- `horizontalrule` definition (a centered 25-75% line, kept for `notes.typ` and external templates that call `#horizontalrule`). Pandoc 3.13's typst writer emits `#divider()` for HorizontalRule; Quarto deliberately does not define `divider`, so it resolves to Typst 0.15's native `std.divider` (full-width, restyleable via `#show divider:` rules), matching pandoc's default template behavior with typst >= 0.15 +- Term list hanging indent (`#set terms(hanging-indent: 1.5em)`; Pandoc 3.13 dropped its custom `terms.item` show rule) +- CSL citeproc formatting (`#show : 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) - Code highlighting definitions (conditionally included) **Quarto additions**: diff --git a/llm-docs/pptx-testing.md b/llm-docs/pptx-testing.md new file mode 100644 index 00000000000..5cc1697adb1 --- /dev/null +++ b/llm-docs/pptx-testing.md @@ -0,0 +1,50 @@ +--- +main_commit: 38e34ec50 +analyzed_date: 2026-11-09 +key_files: + - tests/verify.ts + - tests/smoke/smoke-all.test.ts + - tests/docs/smoke-all/pptx/bullets-table-bullets-one-slide.qmd +--- + +# Testing PowerPoint (pptx) output + +pptx is tested through smoke-all documents (`tests/docs/smoke-all/`), with the verifiers `ensurePptxXpath`, `ensurePptxLayout`, `ensurePptxMaxSlides` and `ensurePptxRegexMatches` in `tests/verify.ts`. Few tests exist; for one worth copying see `tests/docs/smoke-all/pptx/bullets-table-bullets-one-slide.qmd`. + +## How a verifier reads the deck + +`withPptxContent` (`tests/verify.ts`) copies the `.pptx`, unzips it, and reads `ppt/slides/slide.xml` (or its `_rels/slide.xml.rels` for layouts). Everything is per slide number. + +- **Slide 1 is the generated title slide** whenever the document has a `title` (and `author`/`date`). The first slide made from a `##` heading is slide 2. +- **Text before the first heading becomes its own slide.** Put the scenario explanation of a test in an HTML comment, not in body prose, or the slide count changes. + +## Verifier arguments in `_quarto: tests: pptx:` + +| Key | Value | Notes | +|---|---|---| +| `ensurePptxMaxSlides` | `- N` | Fails if slide N+1 exists. A ceiling, not an exact count. Also fails if slide N is missing. | +| `ensurePptxLayout` | `- [N, "Layout name"]`, one entry per slide | Layout name is the `p:cSld/@name` of the slide's layout. | +| `ensurePptxXpath` | `- [N, [must-match xpaths], [must-not-match xpaths]]` | Namespaces such as `a:` and `p:` are available, e.g. `//a:tbl`. | +| `ensurePptxRegexMatches` | `- [regexes]` then `- N` | Regexes run on the raw slide XML. Slide number is the second item, after the regex list. | + +Pass a list of lists to check several slides with `ensurePptxLayout` or `ensurePptxXpath`; a single `[N, ...]` entry also works. + +## Layouts come from Pandoc + +Pandoc's pptx writer chooses the layout (Title Slide, Section Header, Two Content, Comparison, Content with Caption, Blank, Title and Content) from the slide content, using the layouts of its default `reference-doc`. A Pandoc upgrade can change both the choice and the slide splitting, so layout and slide-count assertions are characterization tests of the bundled Pandoc, not of Quarto code. Say so in the test comment, and re-check them on each Pandoc bump. + +Pandoc 3.13 example: text followed by a table gets "Title and Content" where Pandoc 3.10 chose "Content with Caption", and a bullet list, a table and another bullet list stay on one slide. + +## Comparing against another Pandoc version + +To show that a pptx test depends on the Pandoc version, run it with `QUARTO_PANDOC` set to the `bin/tools/pandoc` of an installed Quarto release (see the `qvm` skill), then run it again without. `QUARTO_` overrides any bundled tool path. + +## Inspecting a deck by hand + +```bash +quarto render doc.qmd --to pptx +mkdir x && cd x && unzip -q ../doc.pptx +ls ppt/slides/*.xml # slide count +cat ppt/slides/_rels/slide2.xml.rels # which slideLayout.xml +grep -o '