简体   繁体   English

如何在PHP博客上获取Haskell语法突出显示

[英]How to get Haskell syntax highlighting on PHP blog

I'm making a blog in PHP and I'd really like to have syntax highlighting on Haskell code. 我正在用PHP创建博客,我真的很想在Haskell代码上突出显示语法。

Are there any tools for that out there? 那里有什么工具吗?

I've found hscolour but I don't know if it's possible to integrate it in PHP. 我已经找到了hscolour,但是我不知道是否可以将其集成到PHP中。

I'm using CakePHP if that makes a difference. 我正在使用CakePHP,如果有所作为。

Thanks. 谢谢。

GeSHi is a PHP library that's quite often used for code-highlighting. GeSHi是一个PHP库,通常用于代码突出显示。

Judging from the list of supported languages, it seems it supports Haskell -- and there's a demo page if you want to try first. 从受支持的语言列表来看,它似乎支持Haskell -如果您想先尝试,则有一个演示页面

(Right now, the website seems not to be responding :-( Still, it's available from Google search's cache ) (目前,该网站似乎没有响应:-(仍然可以从Google搜索的缓存中访问

I use SHJS JavaScript syntax highlighter. 我使用SHJS JavaScript语法荧光笔。 It is based on on GNU Source-highlight, and highlights more correctly than google-code-prettify and GeSHi. 它基于GNU Source-highlight,并且比google-code-prettify和GeSHi更正确地突出显示。

See also: How to setup SHJS for Haskell . 另请参阅: 如何为Haskell设置SHJS

Comparison, the last time I checked: 比较,我上次检查:

该网站目前处于关闭状态,所以我无法确认,但是我最肯定GeSHi支持。

这是CakePHP的Geshi帮助器: http : //www.mech7.net/articles/view/7/cakephp-geshi-helper

Many tools support Haskell syntax highlighting: kate, GeSHI, pygments. 许多工具都支持Haskell语法高亮显示:kate,GeSHI和pygments。 Calling into haskell-color or hscolour. 调用为haskell-color或hscolour。 Pick whichever is easiest for you to interface with. 选择最容易与您交互的那个。

I really like how GitHub highlights Haskell code, so I hacked at GeSHi's Haskell syntax file for a while until it worked in a similar fashion. 我真的很喜欢GitHub突出显示Haskell代码的方式,因此我入侵了GeSHi的Haskell语法文件一段时间,直到它以类似的方式工作为止。 It hasn't been heavily tested, but someone might find it useful. 它尚未经过严格的测试,但有人可能会发现它有用。

You can download it from my blog entry, GitHub Haskell colours for GeSHi . 您可以从我的博客条目GeSHi的GitHub Haskell colors下载它。

You could use the Alex Gorbatchev's SyntaxHighlighter. 您可以使用Alex Gorbatchev的SyntaxHighlighter。 Its javascript and really simple and well supported, easy to install and modify. 它的javascript确实很简单并且得到很好的支持,易于安装和修改。 Here are some instructions for blogger... but all you have to do you to do is remove the blogger=true line for a php CakeApp. 以下是一些针对博客作者的说明...,但是您要做的就是删除PHP CakeApp的blogger = true行。

http://code-slim-jim.blogspot.com/2010/11/adding-syntax-higher-to-your-blog.html http://code-slim-jim.blogspot.com/2010/11/adding-syntax-higher-to-your-blog.html

And here is the Haskel brush for it: 这是Haskel笔刷:

https://github.com/mrueegg/haskell_syntax_highlighter https://github.com/mrueegg/haskell_syntax_highlighter

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

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