Class: Kramdown::Parser::MarkdownLint

Inherits:
Kramdown
  • Object
show all
Defined in:
lib/mdl/kramdown_parser.rb

Constant Summary collapse

FENCED_CODEBLOCK_MATCH =

Regular kramdown parser, but with GFM style fenced code blocks

Kramdown::Parser::GFM::FENCED_CODEBLOCK_MATCH

Instance Method Summary collapse

Constructor Details

#initialize(source, options) ⇒ MarkdownLint

Returns a new instance of MarkdownLint.



10
11
12
13
14
15
# File 'lib/mdl/kramdown_parser.rb', line 10

def initialize(source, options)
  super
  i = @block_parsers.index(:codeblock_fenced)
  @block_parsers.delete(:codeblock_fenced)
  @block_parsers.insert(i, :codeblock_fenced_gfm)
end

Instance Method Details

#add_text(text, tree = @tree, type = @text_type) ⇒ Object

Add location information to text elements



18
19
20
21
22
23
# File 'lib/mdl/kramdown_parser.rb', line 18

def add_text(text, tree = @tree, type = @text_type)
  super
  if tree.children.last
    tree.children.last.options[:location] = @src.current_line_number
  end
end