开发者

Common format or convention for syntax highlighting JS, CSS and XML/HTML?

Somewhat related to this question, I'd lik开发者_开发知识库e to know if there is any common conventions to syntax highlight JavaScript, CSS and HTML/XML? I’m thinking mostly about things like using standardised class names, IDs, or other hooks (such as using RDFa, Microdata, etc.) to highlight the code on the client side. I know there are a number of libraries to syntax highlight in JavaScript, as mentioned in the linked question, and a number of text editors and IDEs also support themes to style the syntax highlighting. Espresso even uses CSS to specify the highlight colours (I’ve not found a spec though).

Our needs are very performance sensitive, but ideally if we write our own highlighter, it would be nice to use a common convention so syntax highlight style sheets can be shared between apps and sites, or ported easily.


There doesn’t seem to be a common standard. However the team behind the Ace editor are looking into a similar goal and have a syntax highlight spec that they hope other editors and applications/sites that need syntax highlighting will use this spec. See this blog post for more information. It is based on Text Mate and has had input from people that write other highlighters such as CodeMirror. This is probably as close as there is to a possible agreed format.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜