Repository navigation
Keep the .cell wrapper around knitr floats so Typst doesn't double-wrap tables - #767
Draft
gordonwoodhull wants to merge 2 commits into
Draft
gordonwoodhull wants to merge 2 commits into
gordonwoodhull wants to merge 2 commits into
Conversation
…ap tables A captioned knitr table rendered to Typst with an extra #block[ between #figure([ and #table(. The float desugaring turned a .cell #tbl-* div into a FloatRefTarget and discarded the .cell div, so Quarto's Typst post filter never marked cell-output-display as scaffolding. Keep the .cell div around the float with only the cell-output-display divs inside it, as Quarto's parsefiguredivs.lua does for non-layout cells. Port Quarto's tbl-align-issue10086 smoke-all fixture.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
CI has no R/knitr runtime, so the test failed with 'Engine knitr is registered but its runtime is not available'. Declare tests.run.requires so the harness skips it when knitr is missing.
Member
Author
|
(I honestly kind of hate the div shuffling and wish it were better in q2. Hard for me to merge this because it's a test for a regression in Q1, but there doesn't seem to be any corresponding bug to regress in q2. I'll probably let this draft PR decay and then close it, unless we find we need it later.) |
1 of 3 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A captioned table produced by a knitr chunk (for example
knitr::kable()with#| label: tbl-…and#| tbl-cap:) rendered to Typst asThe extra
#block[between#figure([and#table(is the shape Quarto's issue 10086 fix removes.The cause was in q2's float desugaring. A
.cell #tbl-…div was turned into aFloatRefTargetwith the.celldiv discarded. Quarto's Typst post filter only markscell-output-displayas scaffolding, so it disappears from the output, when it sits under a.cellparent. Without that parent, the div reached Pandoc's Typst writer and came out as a block.q2 now keeps the
.celldiv around the float and leaves only thecell-output-displaydivs inside it, as Quarto'sparsefiguredivs.luadoes for non-layout cells. Layout cells and cells with no output div are unchanged.The same knitr table now produces
#figure([followed directly by#table(, matching Quarto.typst/tbl-align-issue10086.qmdis ported from Quarto's smoke-all corpus with its two assertions. The first requires that shape, and the second rejects a block wrapped around the whole figure.q2's output for this fixture was centered before and after, so the rendered PDF is unchanged. The fix guards against the double-wrapped
#block[ #figure([ #block[shape, which left-aligns the figure in Quarto when the scaffold rule fails to match. Because the.celldiv is back, that shape would now reappear if the scaffold rule stopped matching. The second assertion covers that case.Not addressed: for
echo: truechunks using the#| label:shorthand, the code listing is still placed inside the figure, where Quarto puts it above.