aboutsummaryrefslogtreecommitdiff
path: root/docs/_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'docs/_plugins')
-rw-r--r--docs/_plugins/callout.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/_plugins/callout.rb b/docs/_plugins/callout.rb
new file mode 100644
index 000000000..29ecbc99d
--- /dev/null
+++ b/docs/_plugins/callout.rb
@@ -0,0 +1,29 @@
+# Source: http://stackoverflow.com/questions/19169849/how-to-get-markdown-processed-content-in-jekyll-tag-plugin
+
+module Jekyll
+ module Tags
+ class CalloutTag < Liquid::Block
+
+ def initialize(tag_name, type, tokens)
+ super
+ @type = type
+ if type == "danger"
+ @type = "danger"
+ elsif type == "warning"
+ @type = "warning"
+ elsif type == "info"
+ @type = "info"
+ end
+ end
+
+ def render(context)
+ site = context.registers[:site]
+ converter = site.getConverterImpl(::Jekyll::Converters::Markdown)
+ output = converter.convert(super(context))
+ "<div class=\"bd-callout bd-callout-#{@type}\">#{output}</div>"
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('callout', Jekyll::Tags::CalloutTag)