summaryrefslogtreecommitdiff
path: root/src/_plugins/admonition_md.rb
diff options
context:
space:
mode:
Diffstat (limited to 'src/_plugins/admonition_md.rb')
-rw-r--r--src/_plugins/admonition_md.rb26
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)