# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/callout-block.rb # Asciidoctor extension for callouts as a (HTML-)block # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # # ------------------------------------------------------------------------------ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' include Asciidoctor # A block macro that embeds a Callout block into the output document # # Usage # # callout::[, 'callout text to be specified', 'modifier' => 'ml-2 mb-1' def process parent, target, attrs doc = parent.document modifier_class = (modifier = attrs['modifier']) ? %(#{modifier}) : nil text_content = (text = attrs['text']) ? %(#{text}) : nil html = %(

#{text}

) create_pass_block parent, html, attrs, subs: nil end end block_macro CalloutBlockMacro end