In Jekyll, is there a compressed way to partially mark out Markdown?

I have a Markdown-protected sidebar that I would like to show on my Jekyll blog. I used to try to include it as {% include sidebar.markdown %} , but didn't actually display Markdown. I can successfully enable it as:

 {% capture sidebar %}{% include sidebar.markdown %}{% endcapture %} {{ sidebar | markdownify }} 

and although this is a manageable solution, I would prefer a more elegant way to solve it. Any ideas? Thanks in advance!

+45
markdown jekyll
Aug 29 2018-11-11T00:
source share
2 answers

Jekyll now supports the creation of simple plugins for adding tags, converters or generators. Take a look at http://jekyllrb.com/docs/plugins/ .

+5
Sep 17 '11 at 15:34
source share

I also searched for this, it was PITA, discovering how to do it, not so much Google content, the most accurate discovery was an entity that would not work here ... a dead simple solution:

./_plugins/markdown_tag.rb :

 module Jekyll class MarkdownTag < Liquid::Tag def initialize(tag_name, text, tokens) super @text = text.strip end require "kramdown" def render(context) tmpl = File.read File.join Dir.pwd, "_includes", @text Jekyll::Converters::Markdown::KramdownParser.new(Jekyll.configuration()).convert(tmpl) end end end Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag) 

UPDATE: example usage blog: http://wolfslittlestore.be/2013/10/10/rendering-markdown-in-jekyll/

+21
Jan 09 '13 at 22:05
source share



All Articles