diff options
author | Patrick Spek <p.spek@tyil.nl> | 2021-02-05 09:55:25 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2021-02-05 09:55:25 +0100 |
commit | 70a2c42a5eef1dab2b7ab75e3c7f6ffc8c8c1959 (patch) | |
tree | c30a3e1d52e7a92fe3866f9833aa77ac4092eef4 /src/_plugins/admonition_md.rb | |
parent | 1d60b596b53202c0814663ed53b4279b40e05154 (diff) |
Move source files into src
Diffstat (limited to 'src/_plugins/admonition_md.rb')
-rw-r--r-- | src/_plugins/admonition_md.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/_plugins/admonition_md.rb b/src/_plugins/admonition_md.rb new file mode 100644 index 0000000..d22cceb --- /dev/null +++ b/src/_plugins/admonition_md.rb @@ -0,0 +1,26 @@ +module Jekyll + class AdmonitionMarkdownBlock < Liquid::Block + @type = "" + + def initialize(tag_name, text, tokens) + super + + @type = text + end + + require "redcarpet" + + def render(context) + content = super + + '<section class="admonition"> + <div class="admonition-title">' + @type + '</div> + <div class="admonition-content"> + ' + Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) + ' + </div> + </section>' + end + end +end + +Liquid::Template.register_tag('admonition_md', Jekyll::AdmonitionMarkdownBlock) |