summaryrefslogtreecommitdiff
path: root/_plugins
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2018-09-20 11:32:56 +0200
committerPatrick Spek <p.spek@tyil.nl>2018-09-20 11:32:56 +0200
commite9365b34190c4a3c54385f963efcf56ecd705112 (patch)
tree5a0de5c3ae7024cafddf275c1b859699d17d2461 /_plugins
parente847b05ae3bae9cc4134a7b5f5f66f0771edfa9e (diff)
Add year subheadings in posts overview
Diffstat (limited to '_plugins')
-rw-r--r--_plugins/admonition_md.rb36
-rw-r--r--_plugins/html-markdown.rb17
2 files changed, 53 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)
diff --git a/_plugins/html-markdown.rb b/_plugins/html-markdown.rb
new file mode 100644
index 0000000..7d60137
--- /dev/null
+++ b/_plugins/html-markdown.rb
@@ -0,0 +1,17 @@
+module Jekyll
+ class MarkdownBlock < Liquid::Block
+ def initialize(tag_name, text, tokens)
+ super
+ end
+
+ require "redcarpet"
+
+ def render(context)
+ content = super
+
+ "#{Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(content)}"
+ end
+ end
+end
+
+Liquid::Template.register_tag('markdown', Jekyll::MarkdownBlock)