summaryrefslogtreecommitdiff
path: root/_plugins/admonition_md.rb
diff options
context:
space:
mode:
Diffstat (limited to '_plugins/admonition_md.rb')
-rw-r--r--_plugins/admonition_md.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/_plugins/admonition_md.rb b/_plugins/admonition_md.rb
new file mode 100644
index 0000000..614e09a
--- /dev/null
+++ b/_plugins/admonition_md.rb
@@ -0,0 +1,36 @@
+module Jekyll
+ class AdmonitionMarkdownBlock < Liquid::Block
+ @type = ""
+
+ def initialize(tag_name, text, tokens)
+ super
+
+ @type = text
+ end
+
+ require "redcarpet"
+
+ def render(context)
+ content = super
+
+ '<div class="admonitionblock">
+ <table>
+ <tbody>
+ <tr>
+ <td class="icon">
+ <div class="title">' + @type + '</div>
+ </td>
+ <td class="content">
+ <div class="paragraph">' +
+ Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content) + '
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>'
+ end
+ end
+end
+
+Liquid::Template.register_tag('admonition_md', Jekyll::AdmonitionMarkdownBlock)