I am very surprised that there was no any announcements about highlight.js
in this list.
Highlight.js highlights syntax in code examples and initially was created
for blogs, forums and in fact on any web pages.
It's very easy to use because it works automatically: finds blocks of code,
detects a language, highlights it.
Highlight.js knows 51 languages and (sic!) can perform autodetection of
code fragment language.
>From some time highlight.js is available as npm module and now support for
Node.js is merged to highlight.js upstream repo.
Example usage with Node.js:
Pass in Language:
var hl = require("highlight.js");
var text = "var test = 'asdf'";
var result = hl.highlight('javascript', text);
console.log(html.value);
Output: '<span class="keyword">var</span> test = <span
class="string">\'asdf\'</span>',
Auto Language Detection:
var hl = require("highlight.js");
var text = "var test = 'asdf'";
var result = hl.highlightAuto(text);
console.log(result.value);
GitHub repository: https://github.com/isagalaev/highlight.js
Install via npm for Node.js: npm install highlight.js
Browser version description: http://softwaremaniacs.org/soft/highlight/en/
Regards goes to Ivan Sagalaev, highlight.js creator.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en