quarto-dev / quarto-dev/quarto-cli
mini-epic: AST uniformization across engines for floats
@cscheid is already working on this.
Since Sep 28, 2023.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
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:
-
#7999
-
#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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.