2 Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid.
4 {% markdown <filename> %}
9 class MarkdownTag
< Liquid
::Tag
10 def initialize(tag_name
, text
, tokens)
16 site
= context
.registers
[:site]
17 if @tag_name == 'markdown' then
18 fname
= File
.join site
.source
, "_includes", @text
20 page
= context
.registers
[:page]
21 fname
= File
.join site
.source
, File
.dirname(page
['path'])
, @text
23 tmpl
= Liquid
::Template.parse(File
.read fname)
.render site
.site_payload
24 html
= Kramdown
::Document.new(tmpl)
.to_html
28 Liquid
::Template.register_tag('markdown', Jekyll
::MarkdownTag)
29 Liquid
::Template.register_tag('markdown_relative', Jekyll
::MarkdownTag)