quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.54k stars 291 forks source link

Typst: Improve syntax highlighting support #7824

Open cwickham opened 6 months ago

cwickham commented 6 months ago

Bring typst support up to the level of PDF as described in PDF Basics.

In particular, add support for the highlight-style option.

This one might be out of our scope, since from what I can tell, the syntax highlighting we currently get is via Typst directly not Pandoc.

Perhaps we could provide an option to specify the style Typst uses via the theme argument to raw().

cscheid commented 6 months ago

I agree, I think this one will be pretty hard to do in general (and specifically I'm not looking to do it for 1.4)

cwickham commented 6 months ago

And I guess if someone really wants different syntax highlighting, it's easy enough to set through Typst with a raw block:

```{=typst} 
#set raw(theme: "Adventure_Time.tmTheme.txt")
cscheid commented 3 weeks ago

This one might be out of our scope, since from what I can tell, the syntax highlighting we currently get is via Typst directly not Pandoc.

This is the main complication indeed.

Perhaps we could provide an option to specify the style Typst uses via the theme argument to raw().

Yes, that's one way of doing it, but the real problem is that we have two incompatible notions of syntax highlighting.

I don't want to do this for 1.5, but I wonder if the solution for 1.6 is to add support for native syntax highlighting of text in Pandoc's Typst writer directly.

cderv commented 3 weeks ago

I think this is something we should work on with Pandoc team, to add support for Pandoc's highlighter for Typst output format This is the library that powers it https://github.com/jgm/skylighting and which is used by pandoc It needs to gain a format to typst feature.

mcanouil commented 3 weeks ago

FYI:

cderv commented 3 weeks ago

Thanks @mcanouil - I have seen this one obviously, and this not the same. I haven't linked to it because this is about highlighting style for code block of language typst


```typst
<raw typst here>


so that this is highlighted correctly in format where Pandoc's syntax highlighter applies. It is about XML language highlighting support.

Here were are talking about syntax highlighter - The fact that Pandoc does the highlighting for the Typst format, which would allow for `highlighting-style` to then be applied.

As mentioned originally, currently we get code block highlighting by Typst directly. 

So we could either: 

- Improve our configuration for native Typst highlighting, and this would mean different them than current `highlight-style` option
- Add support in Pandoc for its syntax highlighter knowing how to write typst output and adapt the highlighting style and xml language file (like it is done for HTML or PDF)

Hope it clarifies. 
mcanouil commented 3 weeks ago

oh, I misunderstood.