Sha256: 230536b4adb46c70d9513c835c21867db0c8019339aaffce880f59d91456d21a
Contents?: true
Size: 826 Bytes
Versions: 1
Compression:
Stored size: 826 Bytes
Contents
require 'liquid' module Eyemask module Liquid class Note < ::Liquid::Block MARKDOWN = Redcarpet::Markdown.new(Eyemask::Liquid::Markdown::HTML.new(hard_wrap: true), autolink: true, tables: true, footnotes: false, fenced_code_blocks:true, no_intra_emphasis: true, superscript: true, underline: true, highlight: true) def initialize(tag_name, markup, tokens) super params = markup.split(" ") @note_class = params.first @note_data = params.drop(1).join(" ") end def render(context) content = MARKDOWN.render(::Liquid::Template.parse(super).render(context.registers)) "<aside class=\"note note-#{@note_class}\" data-note=\"#{@note_data}\">#{content}</aside>" end end end end Liquid::Template.register_tag('note', Eyemask::Liquid::Note)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eyemask-0.1.0 | lib/eyemask/liquid/note.rb |