语法突出显示库 [英] Syntax Highlighting libraries

查看:102
本文介绍了语法突出显示库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何免费的PHP库/实用程序函数可以为各种编程语言(例如Java和C ++)的语法添加颜色?


I我在我的网站上发布了代码片段,想知道是否有一种方式

可以轻松地自动给出语法高亮显示。


谢谢!


-

Christoph Burschka< ch **************** @ rwth-aachen.de>

Math.-Techn。助手iA

Are there any free PHP libraries/utility functions that can color the syntax of
various programming languages (eg. Java and C++)?

I am posting code snippets on my site and would like to know if there is a way
to easily give them syntax highlighting automatically.

Thanks!

--
Christoph Burschka <ch****************@rwth-aachen.de>
Math.-Techn. Assistent i.A.

推荐答案

Christoph Burschka写道:
Christoph Burschka wrote:

有没有免费的PHP库/实用函数可以为各种编程语言(例如Java和C ++)的语法着色吗?


我在我的网站上发布代码片段并希望要知道是否有一种方法

可以轻松自动地给它们语法高亮。


谢谢!
Are there any free PHP libraries/utility functions that can color the syntax of
various programming languages (eg. Java and C++)?

I am posting code snippets on my site and would like to know if there is a way
to easily give them syntax highlighting automatically.

Thanks!



有一个PEAR类Text_Highlighter,它在

中提供了一个框架,解析了每种语言的基于XML的文件以突出显示代码。不确定是否有人已经为你想要的语言构建了XML文件。愿谷歌成为你最好的朋友!


HTH


Sh

There is a PEAR class Text_Highlighter which provides a framework in
which XML based files per language are parsed to highlight code. Not
sure if someone has already build the XML files for the languages you
are looking for. May Google be your best friend!

HTH

Sh


Christoph Burschka写道:
Christoph Burschka wrote:

是否有任何免费的PHP库/实用程序函数可以为各种编程语言(例如Java和C ++)的

语法着色)?
Are there any free PHP libraries/utility functions that can color the
syntax of various programming languages (eg. Java and C++)?



GeSHi和PEAR Text_Highlighter各有很多语言。他们之间存在重大的重叠;当一种语言被两者覆盖时,

Text_Highlighter输出通常会更好。

GeSHi and PEAR Text_Highlighter each cover plenty of languages. There''s
significant overlap between them; when a language is covered by both, the
Text_Highlighter output is usually a bit nicer.


我在我的网站上发布代码片段想知道是否有

a方式可以轻松地自动给出语法高亮显示。
I am posting code snippets on my site and would like to know if there is
a way to easily give them syntax highlighting automatically.



看看我的demitextile类< http://demiblog.org/etc/demitextile/>。

它结合了语法高亮(通过GeSHi,Text_Highlighter和一些

内置),带有智能引号和Textile标记语言

< http://textism.com/tools/textile /> ;.


示例:
http://examples.tobyinkster.co.uk/demitextile-usage1
http://examples.tobyinkster.co.uk/demitextile-output1


请注意,它足够智能检测当你在一些HTML中嵌入CSS,Javascript

和PHP,并相应地切换语法高亮模式




-

Toby A Inkster BSc(荣誉)ARCS

联系我〜 http://tobyinkster.co.uk/contact

Geek of~HTML / SQL / Perl / PHP / Python * / Apache / Linux


* =我到了那里!

Take a look at my demitextile class <http://demiblog.org/etc/demitextile/>.
It combines syntax highlighting (via GeSHi, Text_Highlighter and some
built-in) with smart quotes and the Textile markup language
<http://textism.com/tools/textile/>.

Example:
http://examples.tobyinkster.co.uk/demitextile-usage1
http://examples.tobyinkster.co.uk/demitextile-output1

Note that it''s smart enough to detect when you''ve embedded CSS, Javascript
and PHP within some HTML, and switches syntax highlighting mode
accordingly.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I''m getting there!


Schraalhans Keukenmeester写道:
Schraalhans Keukenmeester wrote:

Christoph Burschka写道:

有一个PEAR类Text_Highlighter,它提供了一个

的框架,解析了每种语言的基于XML的文件以突出显示代码。不确定是否有人已经为你想要的语言构建了XML文件。愿谷歌成为你最好的朋友!


HTH


Sh
Christoph Burschka wrote:
There is a PEAR class Text_Highlighter which provides a framework in
which XML based files per language are parsed to highlight code. Not
sure if someone has already build the XML files for the languages you
are looking for. May Google be your best friend!

HTH

Sh



谢谢非常,我会看到这对我有帮助。


我尝试使用谷歌,但搜索一些条款真的很棘手。

显然,在* Java *应用程序中着色* PHP *脚本的语法是比其他方式更常见的任务,所以syntax + color + php + java"不是没有b $ b非常有帮助。 ;)

-

Christoph Burschka

Thanks very much, I''ll see if that helps me.

I tried using Google, but it''s really tricky to search for some terms.
Apparently, coloring the syntax of *PHP* scripts in *Java* applications is a far
more common task than the other way around, so "syntax+color+php+java" isn''t
exactly helpful. ;)
--
Christoph Burschka


这篇关于语法突出显示库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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