Allows use of PrismJS on Jekyll sites.
Ruby
Latest commit c8355eb Apr 4, 2015 @gmurphey Merge pull request #5 from tomjanssens/master
Registering gem.
Permalink
Failed to load latest commit information.
lib Initial commit Jul 31, 2014
.gitignore Initial commit Jul 31, 2012
Gemfile Initial commit Jul 31, 2014
Gemfile.lock Initial commit Jul 31, 2014
README.md Adding gittip badge. May 15, 2014
Rakefile Initial commit Jul 31, 2014
VERSION Version bump to 0.0.1 Jul 31, 2014
jekyll-prism-plugin.gemspec Regenerate gemspec for version 0.0.1 Jul 31, 2014

README.md

Jekyll Prism Plugin

Gittip

The Jekyll Prism plugin is a replacement for native Pygments syntax highlighting in Jekyll. It uses the Prism Syntax Highlighter.

The Setup

The Prism plugin is very easy to install and start using.

Copy prism.rb to your plugins folder and setup your layouts to use the Prism JavaScript and styles.

<html>
  <head>
    <link href="prism.css" rel="stylesheet" type="text/css">
  </head>
  <body>
    ...
    <!-- after all your content -->
    <script src="prism.js"></script>
  </body>
</html>

Getting Started

Much of my work on the plugin is based on the Jekyll's native highlight tag, and it's used much the same way.

For a plain, old vanilla experience (like you see on this page), the syntax is pretty straightforward.

... content ...
{% prism javascript %}
var obj = { 'foo': true, 'bar': false };

for (key in obj) {
  console.log(obj[key]);
}
{% endprism %}
... more content ...

Like Jekyll's highlight, the Prism plugin also can highlight lines using linenos. The value can be a comma-separated list or a range (1, 3-7).

Note: you need to include line highlighting in your Prism download for this to work.

... content ...
{% prism javascript linenos=1,4 %}
var obj = { 'foo': true, 'bar': false };

for (key in obj) {
  console.log(obj[key]);
}
{% endprism %}
... more content ...

And for something Prism doesn't offer out of the box, declaring linenos without a value will highlight all lines.

... content ...
{% prism javascript linenos %}
var obj = { 'foo': true, 'bar': false };

for (key in obj) {
  console.log(obj[key]);
}
{% endprism %}
... more content ...