rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.3k stars 732 forks source link

Language highlight for dtx file #1973

Open SwitWu opened 1 year ago

SwitWu commented 1 year ago

.dtx file is a special LaTeX file used in literate programming in which all % characters at the beginning of code lines are not regarded as comment characters. In vscode with the LaTeX-workshop plugin (switch the language in the lower status bar to DocTeX) the code (take docstrip.dtx for example) is rendered as follows:

image

How to make rouge support this language?

tancnle commented 1 year ago

@SwitWu We can add .dtx as an extension in the Tex lexer and that will allow Rouge to highlight .dtx. From a cursory look, think the existing Tex lexer does not pick up all the extra nuances introduced in .dtx so we might also want to extend it.

Screenshot 2023-07-04 at 6 12 45 pm

By the way, I could not access the link above but this works for me https://tug.ctan.org/macros/latex/base/docstrip.dtx/