Class: TTY::Markdown::Parser Private

Inherits:
Kramdown::Parser::Kramdown
  • Object
show all
Defined in:
lib/tty/markdown/parser.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for parsing standard and extended Markdown syntax

Constant Summary collapse

FENCED_CODEBLOCK_MATCH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The fenced code block pattern

Returns:

  • (Regexp)
/
  ^ {0,3}(([~`]){3,})\s*?((\S+?)(?:\?\S*)?)?\s*?\n
  (.*?)
  ^ {0,3}\1\2*\s*?\n
/mx.freeze

Instance Method Summary collapse

Constructor Details

#initialize(source, options) ⇒ Parser

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a TTY::Markdown::Parser instance

Examples:

parser = TTY::Markdown::Parser.new("# TTY Toolkit", {})

Parameters:

  • source (String)

    the Markdown source

  • options (Hash)

    the parsing options



44
45
46
47
# File 'lib/tty/markdown/parser.rb', line 44

def initialize(source, options)
  super
  replace_fenced_codeblock_parser
end