是否有像 PHP 的 GeSHi 那样的 Perl 语法荧光笔(输出到 HTML)? [英] Is there a Perl Syntax Highlighter (outputting to HTML) like PHP's GeSHi?

查看:56
本文介绍了是否有像 PHP 的 GeSHi 那样的 Perl 语法荧光笔(输出到 HTML)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数 PHP 开发人员可能都熟悉名为GeSHi"的语法高亮器,它需要代码,高亮它, 使用 HTML 和 CSS:

Most PHP Developers are likely familar with the Syntax Highlighter called "GeSHi", which takes code, highlights it, with the use of HTML and CSS:

include('geshi.php');
$source = 'echo "hello, world!";
$language = 'php';
$path = 'geshi/';
$geshi = new GeSHi($source, $language, $path);
echo $geshi->parse_code();

GeSHi 支持多种语言.

我想知道,有没有类似的 Perl 模块?

I wonder, is there a similar Module for Perl?

推荐答案

  1. Perl 有一个 Kate 高亮系统的端口:Syntax::Highlight::Engine::Kate 似乎有点接近你所需要的.它似乎是 Padre 的一部分.

  1. Perl has a port of Kate highlighting system: Syntax::Highlight::Engine::Kate which seems to be somewhat close to what you need. It appears to be part of Padre.

您还可以选择 HTML 客户端高亮器(逻辑显然是 JS),例如 Google 的代码美化器

You also have an option of HTML client side highlighters (logic is obviously JS), such as Google's code prettifyer

语法高亮引擎的两个不错的列表是:

Two good lists of syntax highlighting engines are:

  • Wiki syntax highlighting article - among the ones it lists, the Perl ports/APIs seem to exist for Kate and Colorer (Syntax::Highlight::Universal)

这篇非常好的 HTML 语法高亮评论,其中包含许多客户端,例如 SHJS 和许多其他.

This very good review of HTML syntax highlighters, which contains a lot of client-side ones such as SHJS and many others.

请注意,这些通用高亮器中没有一个100% 正确"工作,语法高亮器在良好的 IDE 中工作的方式,因为它们使用正则表达式进行近似解析,而不是词法分析器进行实际语言语法解析.更多详情维基

Please be aware that NONE of those generic highlighters work "100% correctly", the way the syntax highlighters work in good IDEs, because they use regular expressions for approximate parsing instead of lexers for actual language grammar parsing. More details on the Wiki

这篇关于是否有像 PHP 的 GeSHi 那样的 Perl 语法荧光笔(输出到 HTML)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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