1
0
mirror of https://github.com/bitwarden/help synced 2025-12-06 00:03:30 +00:00
Files
help/_plugins/callout.rb
fred_the_tech_writer a491a9587e Landing Page (#413)
* crazy egg script

* Client gs guides (#398)

* JS for intra-article tabbing

* Combine Android/iOS guide to tabbable "Getting Started with Mobile" + image.

* Link changes -> redirect.

* b.e. & mobile edits

* GS w/ Desktop App + Images

* tagging

* video cleanup

* header improvements

* GS w/ Web Vault + reorder

* orgs name change

* web vault article frame

* web vault article

* Landing (#399)

* poc

* "Home" sidebar option

* Events into Resources card

* events <-> suggest an edit

* tweaks

* card fix

* fix video icons

* video size

* margin/border on secondary cards

* added table items

* links & drop a stray item

* more responsive secondary cards

* fixed linking

* link fixes

* crazy egg script merge

* mobile view for alignment of columns in help

* mobile image width issue fix

* responsiveness fixes

* final edits

* link check

Co-authored-by: David Choi <davidgumzchoi@gmail.com>
2021-02-22 09:42:06 -05:00

42 lines
1.1 KiB
Ruby

# Source: https://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.strip!
if %w(info warning success).include?(type)
@type = type
else
puts "{% callout #{type} %} not supported. Defaulting to 'info'"
@type = "info"
end
if @type == 'warning'
@fa = 'warning'
@header = 'Warning'
elsif @type =='success'
@fa = 'lightbulb-o'
@header = 'Tip'
else
@fa = 'info-circle'
@header = 'Note'
end
end
def render(context)
site = context.registers[:site]
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
output = converter.convert(super(context))
"<div class=\"callout callout-#{@type}\">
<h5><i class=\"fa fa-#{@fa}\"></i> #{@header}</h5>
#{output}
</div>"
end
end
end
end
Liquid::Template.register_tag('callout', Jekyll::Tags::CalloutTag)