Jekyll Prisim Plugin

A Prism plugin for Jekyll with support included for the official plugins.

Installation

Add this line to your application's Gemfile:

gem mm-jekyll-prism

And then execute:

$ bundle

Or install it yourself as:

$ gem install mm-jekyll-prism

Usage

These instructions assume you are familiar with using Prism. If not please read the Prisim documentation from the Prism website. This plugin does not install prism but allows for easy inclusion of Prism code blocks in your Jekyll website.

To start using this plugin replace your <pre><code class="language-*">...</code></pre> block with {% prism myLanguage %}...{% endprism %} replacing myLanguage with any language supported by Prisim.

Plugins

Line Highlighting

Help document: http://prismjs.com/plugins/line-highlight/

To use line highlighting provide the highlight option with the values for the line-highlight plugin as specified on the plugins help page. The value is passed verbatim to the data-line attribute used by Prism.

Example
{% prism javascript highlight="1-5,7,10-13" %}
// ...
{% endprism %}

Line Numbering

Help document: http://prismjs.com/plugins/line-numbers/

To use line numbering add the option numbering. To offset line numbering provide a value to the numbering option as specified in the help page for the plugin. The value is passed verbatim to the data-start attribute used by Prism.

Example

No offset

{% prism javascript numbering %}
// ...
{% endprism %}

With offset

{% prism javascript numbering=10 %}
// ...
{% endprism %}

Show invisibles

Help document: http://prismjs.com/plugins/show-invisibles/

Works without any further configuration assuming the plugin is installed.

Autolinker

Help document: http://prismjs.com/plugins/autolinker/

Works without any further configuration assuming the plugin is installed.

WebPlatform Docs

Help document: http://prismjs.com/plugins/wpd/

Works without any further configuration assuming the plugin is installed.

File Highlight

Help document: http://prismjs.com/plugins/file-highlight/

To use file highlighting add the option file with the path to the file. See the help document for further information. There is no need to specifiy a language when using File Highlight but you can provide one. The value is passed verbatim to the data-src attribute used by Prism. Other plugins may not function with this plugin; this is a limitation of the Prism plugin.

Example

No language

{% prism file="myfile.js" %}
// ...
{% endprism %}

With offset

{% prism javascript file="myfile.js" %}
// ...
{% endprism %}

Command Line

Help document: http://prismjs.com/plugins/command-line/

To use add the options user and host with the desired user name and host name.

For those that want a Window's style prompt, use the option prompt with the desire prompt string.

You can also choose which files are considered output lines using the output tag. It operates similar to the highlighting tag.

Example

With User and Host

{% prism user="john" host="local" %}
// ...
{% endprism %}

With User and Host with Output

{% prism user="john" host="local" output="1,3-5,10%}
// ...
{% endprism %}

With Prompt

{% prism prompt="john"%}
// ...
{% endprism %}

Show Language

Help document: http://prismjs.com/plugins/show-language/

Works without any further configuration assuming the plugin is installed.

Contributing

  1. Fork it ( https://github.com/mitmaro/jekyll-prism-plugin/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request