module MdocsKramdown::Parser::FencedAdmonitions

Constants

FENCED_ADMONITIONS_MATCH
FENCED_ADMONITIONS_START

Public Class Methods

included(klass) click to toggle source
# File lib/mdocs_kramdown/parser/fenced_admonitions.rb, line 18
def self.included(klass)
  klass.define_parser(:fenced_admonitions, FENCED_ADMONITIONS_START)
end

Public Instance Methods

parse_fenced_admonitions() click to toggle source
# File lib/mdocs_kramdown/parser/fenced_admonitions.rb, line 22
def parse_fenced_admonitions
  if @src.check(FENCED_ADMONITIONS_MATCH)
    start_line_number = @src.current_line_number
    @src.pos += @src.matched_size

    el = new_block_el(:blockquote, nil, { types: @src[:type].to_s.split(','), title: @src[:title] }, location: start_line_number, admonition: true)

    content = parse_inner_alert_content(@src[:content].gsub(/^\s{4}/, ''))
    el.children = content
    @tree.children << el
    true
  else
    false
  end
end
parse_inner_alert_content(content) click to toggle source
# File lib/mdocs_kramdown/parser/fenced_admonitions.rb, line 38
def parse_inner_alert_content(content)
  parsed = ::Kramdown::Parser::MdocsKramdown.parse(content, @options)
  parsed[0].children
end