Lua filters can change the content of math fomulas, except for formulas with labels when rendering to PDF.

This can be worked around by running the Lua filter before the quarto filters, so maybe it's not a bug? But it's a bit confusing that the behavior changes depending on the format and label vs no label...

Here's an MWE, tested with quarto 0.9.58: create `a.qmd` with

```
---
filters:
  - filter.lua
---

$$x=1$$ {#eq-x}
```

and `filter.lua` with

```
function Math(el)
    el.text = 'y'
    return el
end
```

The filter simply replaces all math formulas with `y`.

Running `quarto render a.qmd` gives the expected HTML output: the formula is "y".

However `quarto render a.qmd  --to pdf` makes a PDF with the original equation "x=1".

It does work if the label is removed, i.e. if the document contains `$$x=1$$` instead of `$$x=1$$ {#eq-x}` then the PDF shows "y".
dragonstyle
2022-03-04T09:42:26Z
knuesel
Future
open
Filters not applied on labelled math formulas when rendering to PDF
https://github.com/quarto-dev/quarto-cli/issues/383