-
-
Notifications
You must be signed in to change notification settings - Fork 969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] improve default syntax highlighting for vignettes #2360
Comments
Yes Pandoc has a syntax highlighter which does the tokenization, and then brings some highlighting style that we can control with
I don't think those highlight rules still applies with recent Pandoc versions.
Changing / improving the tokenization means providing a new KDE SYNTAX XML file for Pandoc to use. Either by updating upstream or providing our own using I've done the former already to provide support for new R pipe So overall, we can try improve the tokenization along the line of your suggestion. The KDE syntax file definition logic is not the easiest though so that is not straightforward. |
When a vignette is rendered, any embedded code is also highlighted. However, it seems like the default highlighter is a bit limited in a few ways:
(
and)
) are not tokenized, and so they cannot be styled;=
) are tokenized as a single token, and so cannot be styled independently. (https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/syntax/r.xml#L58):=
is not tokenized as a single operator; in particular, the=
following a:
is tokenized as an error.(please ignore the class names here; those are RStudio-specific experiments)
My understanding is that this highlighting / tokenization is performed by pandoc, with some extra highlight rules provided here:
https://github.com/rstudio/rmarkdown/blob/de02c926371fdadc4d92f08e1ad7b77db069be49/inst/rmarkdown/templates/html_vignette/resources/vignette.css#L187-L202
Could this be changed / improved by changing the highlight engine used by pandoc for vignettes?
The text was updated successfully, but these errors were encountered: