Skip to content

{ Daily Archives } Sunday, August 2012

Line Numbering Plugin for Prism

Updated 2013-12-09 to use much simpler code One thing that is nice about Prism is that it provides hooks to extend the syntax highlighting, so it is straightforward to create a plugin that adds features like my line numbering, so I can do things like: <pre><code class="language-javascript" data-linenumber=4> function foo(arg){ console.log('You said: '+arg); }</code></pre> Download […]

The Perfect Syntax Highlighter—Prism

I've been looking for a good Javascript-based syntax highlighter, and it looks like Prism is it. It fulfills just about all my criteria: works on code blocks whether inline or in block elements, is HTML5-friendly, uses classes on spans rather than hard-coded styles, and is easy to extend. It's what is running on the website […]

Line Numbering in <pre> Elements

I've thought about creating my own syntax highlighter. I've been using Chili, but there are some odd bugs that pop up here and there and it doesn't seem to play well with Chrome. And it hasn't been updated in 2 years. One thing I did want was line numbering, but that's been a bugaboo of […]