From be877bc691190909b587454e7bb7c89818762338 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 9 Jul 2014 20:00:22 -0700 Subject: plugins: add new example doodad hackery bullshitery and markdown block plugin for markdown includes --- docs/_plugins/markdown-block.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/_plugins/markdown-block.rb (limited to 'docs/_plugins/markdown-block.rb') diff --git a/docs/_plugins/markdown-block.rb b/docs/_plugins/markdown-block.rb new file mode 100644 index 000000000..6aa761585 --- /dev/null +++ b/docs/_plugins/markdown-block.rb @@ -0,0 +1,20 @@ +module Jekyll + class MarkdownBlock < Liquid::Block + alias_method :render_block, :render + + def initialize(tag_name, markup, tokens) + super + end + + # Uses the default Jekyll markdown parser to + # parse the contents of this block + # + def render(context) + site = context.registers[:site] + converter = site.getConverterImpl(::Jekyll::Converters::Markdown) + converter.convert(render_block(context)) + end + end +end + +Liquid::Template.register_tag('markdown', Jekyll::MarkdownBlock) -- cgit v1.2.3