简体   繁体   English

Rails浏览器语法突出显示插件?

[英]Rails Browser Syntax Highlighting Plugin?

什么是语法高亮的标准Rails插件(例如,在网站管理面板中,而不是TextMate),它在Rails项目中开箱即用?

I've seen many different ways for code highlighting in the Rails community. 我在Rails社区中看到了许多不同的代码突出显示方式。

  • The GitHub crew loves Pygments . GitHub的工作人员喜欢Pygments They are using it on many different places, including Jekyll and GitHub itself. 他们在许多不同的地方使用它,包括Jekyll和GitHub本身。 The downside is that it's a python library so you would need to install python and execute it as a shell task. 缺点是它是一个python库,所以你需要安装python并将其作为shell任务执行。
  • SyntaxHighlighter is an other popular, JavaScript based solutions. SyntaxHighlighter是另一种流行的基于JavaScript的解决方案。 This is the one adopted by WordPress and Yahoo! 这是WordPress和Yahoo!采用的那个。 There are many different Rails plugins for this even if the integration doesn't actually require a plugin. 即使集成实际上不需要插件,也有许多不同的Rails插件。
  • Ruby offers 3 code highlighting Gems: Ultraviolet , Syntax and CodeRay . Ruby提供3个代码,突出显示Gems: UltravioletSyntaxCodeRay AFAIK, the last one is the most adopted. AFAIK,最后一个是最被采用的。

I tried all those solutions in the past. 我过去尝试过所有这些解决方案。 I'm actually using Pygments for a couple of Jekyll blogs and JavaScript based solutions in all the other cases. 我实际上在所有其他情况下使用Pygments来处理几个Jekyll博客和基于JavaScript的解决方案。

I have been using CodeMirror . 我一直在使用CodeMirror Not quite a plugin, but still very straight forward to integrate with Rails. 不是一个插件,但仍然非常直接与Rails集成。

We use highlight.js on http://giantrobots.thoughtbot.com (isn't a Rails app, but whatever), and it's awesome. 我们在http://giantrobots.thoughtbot.com上使用highlight.js(不是Rails应用程序,但无论如何),它真棒。

http://softwaremaniacs.org/soft/highlight/en/ http://softwaremaniacs.org/soft/highlight/en/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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