### Home Classes Methods

### In Files

- lib/kramdown/parser/gfm.rb

### Parent

Kramdown::Parser::Kramdown::Parser::Kramdown

### Methods

- ::new
- #parse_paragraph

### Class/Module Index

Quicksearch

- Kramdown
- Kramdown::Converter
- Kramdown::Converter::Base
- Kramdown::Converter::Html
- Kramdown::Converter::Kramdown
- Kramdown::Converter::Latex
- Kramdown::Converter::RemoveHtmlTags
- Kramdown::Converter::Toc
- Kramdown::Document
- Kramdown::Element
- Kramdown::Error
- Kramdown::Options
- Kramdown::Options::Boolean
- Kramdown::Parser
- Kramdown::Parser::Base
- Kramdown::Parser::GFM
- Kramdown::Parser::Html
- Kramdown::Parser::Html::Constants
- Kramdown::Parser::Html::ElementConverter
- Kramdown::Parser::Html::Parser
- Kramdown::Parser::Kramdown
- Kramdown::Parser::Markdown
- Kramdown::Utils
- Kramdown::Utils::Entities
- Kramdown::Utils::Entities::Entity
- Kramdown::Utils::Html
- Kramdown::Utils::OrderedHash
- Kramdown::Utils::Unidecoder

No matching classes.

# Kramdown::Parser::GFM

### Constants

FENCED_CODEBLOCK_MATCH

### Public Class Methods

new(source, options) click to toggle source

    # File lib/kramdown/parser/gfm.rb, line 8
    def initialize(source, options)
      super
      i = @block_parsers.index(:codeblock_fenced)
      @block_parsers.delete(:codeblock_fenced)
      @block_parsers.insert(i, :codeblock_fenced_gfm)
    end

### Public Instance Methods

parse_paragraph() click to toggle source

    # File lib/kramdown/parser/gfm.rb, line 19
    def parse_paragraph
      result = @src.scan(PARAGRAPH_MATCH)
      while !@src.match?(self.class::PARAGRAPH_END)
        result << @src.scan(PARAGRAPH_MATCH)
      end
      result.chomp!
      unless @tree.children.last && @tree.children.last.type == :p
        @tree.children << new_block_el(:p)
      end
      lines = result.lstrip.split(/\n/)
      lines.each_with_index do |line, index|
        @tree.children.last.children << Element.new(@text_type, line) << Element.new(:br) << Element.new(@text_type, "\n")
      end
      @tree.children.last.children.pop # added one \n too many
      @tree.children.last.children.pop # added one :br too many
      true
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.