简体   繁体   中英

Can I use GitHub's Linguist as a replacement to Rouge in Jekyll

I want to improve syntax highlighting on my blog written in Jekyll. I've noticed that some languages (eg Scala) are not always correctly highlighted by Rouge (it performs wrong tokenization). In the same time GitHub's code examples and Gists are displaying Scala syntax correctly and apparently they use their own library, Linguist, to achieve better results.

Since patching Rouge looks like a long shot, is there a way to use Linguist to tokenize and create CSS for highlighting server-side?

is there a way to use Linguist to tokenize and create CSS for highlighting server-side?

No. Linguist only detects the language of files ; it doesn't perform the highlighting itself .

On GitHub, the rules of syntax highlighting are defined by a set of grammars from Sublime Text, Atom, and TextMate packages. In the case of Scala, GitHub relies on scala/vscode-scala-syntax . Syntax highlighting itself is performed by a closed-source library owned by GitHub.

Since patching Rouge looks like a long shot

That might still be your best option, especially since, at the moment, the Rouge lexer for Scala doesn't seem too complex.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM