kramdown

fast, pure-Ruby Markdown-superset converter

GFM Parser

Introduction

This parser can parse “Github Flavored Markdown”. This is a format of Markdown that is used on Github.com for most places where textual input is required, such as issues and comments. Some of the extensions, notably the “backtick fenced code blocks” are also used on other sites, for example StackOverflow.

Conformance

At the moment this parser is based on the kramdown parser, with the following changes:

Please note that the GFM parser tries to mimic the parser used at Github which means that for some special cases broken behaviour is the expected behaviour.

Here is an example:

This ~~is a complex strike through *test ~~with nesting~~ involved* here~~.

In this case the correct GFM result is:

<p>This <del>is a complex strike through *test ~~with nesting</del> involved* here~~.</p>

Options

The GFM parser supports the following options:

hard_wrap
Interprets line breaks literally

Insert HTML <br /> tags inside paragraphs where the original Markdown document had newlines (by default, Markdown ignores these newlines).

Default: true
Used by: GFM parser

gfm_quirks
Enables a set of GFM specific quirks

The way how GFM is transformed on Github often differs from the way kramdown does things. Many of these differences are negligible but others are not.

This option allows one to enable/disable certain GFM quirks, i.e. ways in which GFM parsing differs from kramdown parsing.

The value has to be a list of quirk names that should be enabled, separated by commas. Possible names are:

  • paragraph_end

    Disables the kramdown restriction that at least one blank line has to be used after a paragraph before a new block element can be started.

    Note that if this quirk is used, lazy line wrapping does not fully work anymore!

Default: paragraph_end
Used by: GFM parser