Sha256: 8f335cc3a54359bd0010ed9c378ab450a8c8f30b1c35f0db8604b4914fe85c73
Contents?: true
Size: 806 Bytes
Versions: 25
Compression:
Stored size: 806 Bytes
Contents
# frozen_string_literal: true require_relative 'div_tag' module Jekyll class AlertBlock < DivTag def initialize(tag_name, markup, tokens) @alert_type = tag_name.split('_').first super tag_name, markup + ' alert alert-' + @alert_type, tokens end def tag 'div' end HEADER = { 'info' => 'Note', 'warning' => 'Warning', 'danger' => 'Danger' } def render_content(context, content) super context, "**#{HEADER[@alert_type]}** \n" + content end end end Liquid::Template.register_tag('info_block', Jekyll::AlertBlock) Liquid::Template.register_tag('warning_block', Jekyll::AlertBlock) Liquid::Template.register_tag('danger_block', Jekyll::AlertBlock) # Liquid::Template.register_tag('success_block', Jekyll::AlertBlock)
Version data entries
25 entries across 25 versions & 1 rubygems