我可以使用GitHub的Linguist代替Jekyll中的Rouge吗 [英] Can I use GitHub's Linguist as a replacement to Rouge in Jekyll

查看:81
本文介绍了我可以使用GitHub的Linguist代替Jekyll中的Rouge吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用Jekyll撰写的博客上改善语法突出显示的功能.我注意到,某些语言(例如Scala)并非总是被Rouge正确地突出显示(它执行了错误的标记化).同时GitHub的代码示例和Gists正确显示了Scala语法,显然他们使用了自己的语言库Linguist来达到更好的结果.

I want to improve syntax highlighting on my blog written in Jekyll. I've noticed that some languages (e.g. 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.

由于修补Rouge看起来很困难,是否有一种方法可以使用Linguist标记化并创建CSS以突出显示服务器端?

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

推荐答案

是否可以使用Linguist标记和创建CSS来突出显示服务器端?

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

不. 仅语言学家检测文件的语言它没有执行突出显示自己.

在GitHub上,语法高亮显示规则由一组语法定义来自Sublime Text,Atom和TextMate程序包.对于Scala,GitHub依赖于 scala/vscode-scala-syntax .语法高亮显示本身是由GitHub拥有的一个封闭源代码库执行的.

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

这仍然可能是您的最佳选择,尤其是由于目前 Scala的Rouge词法分析器似乎不太复杂.

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

这篇关于我可以使用GitHub的Linguist代替Jekyll中的Rouge吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆