Skip to content

Font family and size can spill out of Typst raw html blocks #11093

@gordonwoodhull

Description

@gordonwoodhull

Since we use typst:no-figure on our tables (implemented in jgm/pandoc#9778), Pandoc may not enclose tables in blocks.

Unfortunately, when the Pandoc Typst writer encounters typst:text:fontor typst:text:size on a table, it emits #set text(...) before the table, which will affect the entire scope.

E.g.

---
format: typst
---

Normal paragraph text.

```{=html}
<table style="font-size: 8px;">
    <tr><td>A</td><td>B</td></tr>
</table>
```

Normal paragraph text.

produces

Normal paragraph text.

#set text(size: 6pt); #table(
  columns: 2,
  align: (auto,auto,),
  [A], [B],
)
Normal paragraph text.

Image

Oops!

One way to correct the Typst output is to wrap the set text + table in #[...]:

Normal paragraph text.

#[#set text(size: 6pt); #table(
  columns: 2,
  align: (auto,auto,),
  [A], [B],
)]
Normal paragraph text.

Plan:

  • Add temporary patch, wrapping in #[] block, to our Typst post-processing filter here:

Table = function(tbl)
-- https://github.com/quarto-dev/quarto-cli/issues/10438
tbl.classes:insert("typst:no-figure")
return tbl
end,

  • File bug on Pandoc illustrating the bug in pure Pandoc
  • Submit fix upstream to Pandoc, using brackets only when the Typst output properties are used here.
  • Remove temporary patch after fix is merged upstream and we are using that version of Pandoc.

Metadata

Metadata

Labels

bugSomething isn't workingtypst

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions