Java 语法荧光笔
如您所知,有一个名为 GeSHi 的 PHP 语法荧光笔,它支持大量编程语言或代码格式。
但是,我找不到这样一个支持我需要的编程语言(ADA、ASP、BNF、Bash、Brainfuck、C、C++、C#、CSS、Cobol、ColdFusion、D、Fortran、Haskell、HTML、 (Config)、Java、JavaScript、Lisp、Make、Objective C、PASCAL、Perl、PHP、PLSQL、Prolog、Python、Ruby、Scheme、SQL、VB.NET、Verilog、VHDL、Visual Basic、XML。)
INI 知道一种还是我应该更喜欢低效的方式,即通过 http 事务从远程 PHP 服务器检索突出显示的代码?有什么想法吗?
谢谢。
As you know there is a Syntax highlighter for PHP called GeSHi which supports a great number of Programming Languages or Code formats.
However, I couldn't find such a library for Java which supports programming languages that I need (ADA, ASP, BNF, Bash, Brainfuck, C, C++, C#, CSS, Cobol, ColdFusion, D, Fortran, Haskell, HTML, INI (Config), Java, JavaScript, Lisp, Make, Objective C, PASCAL, Perl, PHP, PLSQL, Prolog, Python, Ruby, Scheme, SQL, VB.NET, Verilog, VHDL, Visual Basic, XML.)
Do you know one or should I prefer inefficient way which is retrieving the highlighted code from a remote PHP server via http transaction? Any ideas?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
两个相关问题:
Java 有哪些代码突出显示库?
在哪里可以找到 Java 语法突出显示库?< /a>
我发现了一个库: http://colorer.sourceforge.net/
Two related questions:
What code highlighting libs are there for Java?
Where can I find a syntax highlighting library for Java?
And one library I found: http://colorer.sourceforge.net/
看看 JHighlighter 或 jEdit 语法包。所有提到的语言均不受开箱即用支持。但是,您有资源,所以我想应该可以添加语言支持。
不是直接答案,但是,如果可以选择客户端语法突出显示,那么 Alex Gorbatchev 的 SyntaxHighlighter 库是一个很棒的库javascript 库,支持多种语言并且是高度可扩展。
Have a look at JHighlighter or jEdit Syntax Package. All mentioned languages aren't supported out of the box. However, you have the sources, so I guess it should be possible to add language support.
Not a direct answer but, if client-side syntax highlighting is an option, the SyntaxHighlighter library from Alex Gorbatchev is an awesome javascript library, supports lots of languages and is highly extensible.
您可以通过 Jython 使用 Pygments。不会像 Java 解决方案那么快,但比与远程服务器交互快得多。
除此之外,您可以在本地运行 Geshi 并通过它传输源代码,这也将击败 HTTP 往返。
You could use Pygments through Jython. Won't be as fast as a Java solution, but much faster than interacting with a remote server.
Barring that, you could run Geshi locally and pipe source code through it, that would also beat an HTTP round trip.
似乎可以从 Java 运行 GeSHi:GeSHi4J 它似乎是一个在 JVM 上运行 PHP 库的包装器。
It seems that it is possible to run GeSHi from Java: GeSHi4J it seems to be a wrapper that run the PHP library on the JVM.
有一个用于 Java 的 prettify.js 端口:java-prettify。
它可以用来生成 HTML(用 Java 计算),正如我在这里讨论的:
使用 java-prettify 解析器创建 HTML
There is a port of prettify.js for Java: java-prettify.
It can be used to produce HTML (computed in Java), as I discussed here:
Use the java-prettify parser to create HTML
jedit 是一个文本编辑器,通过“模式”支持约 170 多种语言的语法突出显示。它还允许您指定自己的语法。您可以在自己的应用程序中使用 StandaloneTextArea 组件,如下所示:
使用 ant 将所有 textarea 文件复制到 ..\textarea 例如:
D:\Source\jedit\jEdit> ant prepare-textArea
但是,它错过了文件 BufferUndoListener.java。通过执行手动复制此内容
D:\Source\jedit\jEdit> copy org\gjt\sp\jedit\buffer\BufferUndoListener.java ..\textarea\src\org\gjt\sp\jedit\buffer\
在 Eclipse 中,从目录 D:\Source 中的现有源创建一个 Java 项目\jedit\textarea
jedit is a text editor with syntax highlighting support for some 170+ languages via "modes". It also allows you to specify your own syntaxes. You can use the StandaloneTextArea component in your own application as follows:
Use ant to copy all the textarea files to ..\textarea eg:
D:\Source\jedit\jEdit> ant prepare-textArea
However, it misses the file BufferUndoListener.java. Copy this manually by executing
D:\Source\jedit\jEdit> copy org\gjt\sp\jedit\buffer\BufferUndoListener.java ..\textarea\src\org\gjt\sp\jedit\buffer\
In Eclipse create a Java Project from existing source in the directory D:\Source\jedit\textarea