background preloader

Markdown Parsers

Facebook Twitter

HTML Converter | kramdown. Introduction This converter converts a kramdown element tree into an HTML fragment and supports all available element types. Below is a list of additional features of the HTML converter as well as some additional information. Automatic Generation of Header IDs kramdown supports the automatic generation of header IDs if the option auto_ids is set to true (which is the default). This is done by converting the untransformed, i.e. plain, header text (or, if the option auto_id_stripping is set, only the text from real text elements) via the following steps: All characters except letters, numbers, spaces and dashes are removed. Note that the option auto_id_stripping will be removed in version 2.0 because this will be the default behaviour!

Following are some examples of header texts and their respective generated IDs: The automatic creation of header IDs is not part of standard Markdown. Such generated IDs are only used if no ID has been set manually before. Code Blocks Automatic Syntax Highlighting. Vmg/redcarpet. Syntax | kramdown. This is version 1.3.3 of the syntax documentation. The kramdown syntax is based on the Markdown syntax and has been enhanced with features that are found in other Markdown implementations like Maruku, PHP Markdown Extra and Pandoc. However, it strives to provide a strict syntax with definite rules and therefore isn’t completely compatible with Markdown.

Nonetheless, most Markdown documents should work fine when parsed with kramdown. All places where the kramdown syntax differs from the Markdown syntax are highlighted. Following is the complete syntax definition for all elements kramdown supports. Source Text Formatting A kramdown document may be in any encoding, for example ASCII, UTF-8 or ISO-8859-1, and the output will have the same encoding as the source.

The document consists of two types of elements, block-level elements and span-level elements: Thus span-level elements can only occur inside block-level elements or other span-level elements. Line Wrapping headers fenced code blocks tables. Documentation | kramdown. Overview kramdown is first and foremost a library for converting text written in a superset of Markdown to HTML. However, due to its modular architecture it is able to support additional input and output formats. The following input and output formats are currently supported: The kramdown syntax page describes in detail what is supported and how it differs from standard Markdown.

For all available options have a look at the options documentation or have a look at a parser/converter page to see which options they support! Usage The kramdown package provides two ways for using it: As a library kramdown uses basically the same API as RedCloth, BlueCloth and Maruku: require 'kramdown' puts Kramdown::Document.new(text).to_html The second parameter to the new call is an options hash for (de)activating certain features. Tests kramdown uses various test suites to verify the correct working of the parsers and converters. Quick Reference | kramdown. Below are examples of all available structural elements that can be used in a kramdown text. Since the kramdown syntax is a superset of the Markdown syntax, only a small part of the available syntax is not available in standard Markdown syntax. Note, that only the most basic syntax information is given. However, a link to the detailed syntax for each element is provided (which also details the differences to the standard Markdown syntax).

The quick reference is for version 1.3.3 of the syntax documentation. kramdown has two main classes of elements: block and span-level elements. Block-level elements are used to create paragraphs, headers, lists and so on whereas span-level elements are used to markup text phrases as emphasized, as a link and so on. All examples below feature the kramdown source, the converted HTML source (shown when hovering over the kramdown source) and the output as it appears in the browser.

Paragraphs Consecutive lines of text are considered to be one paragraph. Migrating your Pages site from Maruku.