jekyll-commonmark-pluggable adds support for plugins to CommonMarker.
cmark reference parser used by CommonMarker supports extensions to the
CommonMark specification but these are written in C. The
jekyll-commonmark-pluggable plugin allows users to extend CommonMarker's parsing
capabilities with plugins written in Ruby.
The jekyll-commonmark-pluggable plugin requires the jekyll-commonmark plugin to
be installed and configured (instructions here). The only additional
step is to add jekyll-commonmark-pluggable to your
Gemfile like so:
group :jekyll_plugins do gem 'jekyll-commonmark' gem 'jekyll-commonmark-pluggable' end
Once jekyll-commonmark-pluggable is installed, you can add Jekyll plugins that
manipulate the Markdown document parsed by
A Jekyll plugin must implement the
self.call() module method. This method
takes one argument:
doc. This is a
CommonMarker::Node object representing
the top-most node of a parsed Markdown document.
An example plugin is set out below:
module CommonMarker module Plugin module Example def self.call(doc) doc.walk do |node| node.delete if node.string_content == 'To be deleted' end end end end end
This plugin would be installed in Jekyll's plugins directory (default:
Found a bug? I'd love to know about it. The best way is to report them in the Issues section on GitHub.
If you're interested in contributing to jekyll-commonmark-pluggable, feel free to fork and submit a pull request.
The jekyll-commonmark-pluggable plugin uses Semantic Versioning 2.0.0.
The jekyll-commonmark-pluggable plugin is released into the public domain. See LICENSE.md for more details.