Description
All float (Figures, Tables, etc) emitted before Pandoc should emit the same markdown AST.
- Jupyter
- Knitr
- OJS
- mermaid
- dot
Let's start with writing tests the generate the documents so we can inspect them.
- Decide what ids/classes/attrs need to appear where
Issues that are blocked because of this:
-
Figure layouts broken in LaTeX/PDF #7017.
Specifically, we need to decide what's the correct output for float layouts that have subfigures but no subcaptions:
--- title: "Layout test" format: pdf: keep-tex: true --- ```{r} #| label: fig-charts #| fig-cap: "Charts" #| layout: "[1, 1]" plot(cars) plot(pressure) ```
Current status
Test documents are in tests/docs/smoke-all/issues/7062-ast-uniformization/*.qmd
.
TODO
- Create pre-ast Lua filter that checks for the correct structure in the right places, and fails if the divs don't match.
- I really wish we had a "Pandoc AST validator" module like we do for YAML, so we could write "Pandoc AST schema"... It would be the same technology, even.
Simple layouts
Currently, "simple layouts" (single figure, caption and label) are (by inspection) compatible with each other. Jupyter and Knitr both emit images as an "image-style" float:
{#fig-label attributes}
OJS, mermaid, and dot all emit div-style floats:
::: {#fig-label attributes}
FIGURE_CONTENT_HERE
Caption here
:::
The exact nature of the content isn't important. It is not perfectly equivalent across formats, but it doesn't have to be, since our FloatRefTarget node works well with this structure.