Scroll to navigation

MARKDOWN2(1) User Commands MARKDOWN2(1)

NAME

markdown2 - Command to convert a markdown file to HTML

SYNOPSIS

markdown2 [PATHS...]

DESCRIPTION

A fast and complete Python implementation of Markdown, a text-to-HTML conversion tool for web writers.

Supported extra syntax options (see -x|--extras option below and see <https://github.com/trentm/python-markdown2/wiki/Extras> for details):

* code-friendly: Disable _ and __ for em and strong. * cuddled-lists: Allow lists to be cuddled to the preceding paragraph. * fenced-code-blocks: Allows a code block to not have to be indented

by fencing it with '```' on a line before and after. Based on <http://github.github.com/github-flavored-markdown/> with support for syntax highlighting.

* footnotes: Support footnotes as in use on daringfireball.net and

implemented in other Markdown processors (tho not in Markdown.pl v1.0.1).

* header-ids: Adds "id" attributes to headers. The id value is a slug of

the header text.

* highlightjs-lang: Allows specifying the language which used for syntax

highlighting when using fenced-code-blocks and highlightjs.

* html-classes: Takes a dict mapping html tag names (lowercase) to a

string to use for a "class" tag attribute. Currently only supports "img", "table", "pre" and "code" tags. Add an issue if you require this for other tags.

* link-patterns: Auto-link given regex patterns in text (e.g. bug number

references, revision number references).

* markdown-in-html: Allow the use of `markdown="1"` in a block HTML tag to

have markdown processing be done on its contents. Similar to <http://michelf.com/projects/php-markdown/extra/#markdown-attr> but with some limitations.

* metadata: Extract metadata from a leading '---'-fenced block.

See <https://github.com/trentm/python-markdown2/issues/77> for details.

* nofollow: Add `rel="nofollow"` to add `<a>` tags with an href. See

<http://en.wikipedia.org/wiki/Nofollow>.

* numbering: Support of generic counters. Non standard extension to

allow sequential numbering of figures, tables, equations, exhibits etc.

* pyshell: Treats unindented Python interactive shell sessions as <code>

blocks.

* smarty-pants: Replaces ' and " with curly quotation marks or curly

apostrophes.
Replaces --, ---, ..., and . . . with en dashes, em dashes,
and ellipses.

* spoiler: A special kind of blockquote commonly hidden behind a

click on SO. Syntax per <http://meta.stackexchange.com/a/72878>.

* strike: text inside of double tilde is ~~strikethrough~~ * tag-friendly: Requires atx style headers to have a space between the # and

the header text. Useful for applications that require twitter style tags to pass through the parser.

* tables: Tables using the same format as GFM

<https://help.github.com/articles/github-flavored-markdown#tables> and PHP-Markdown Extra <https://michelf.ca/projects/php-markdown/extra/#table>.

* toc: The returned HTML string gets a new "toc_html" attribute which is

a Table of Contents for the document. (experimental)

* use-file-vars: Look for an Emacs-style markdown-extras file variable to turn

on Extras.

* wiki-tables: Google Code Wiki-style tables. See

<http://code.google.com/p/support/wiki/WikiSyntax#Tables>.

* xml: Passes one-liner processing instructions and namespaced XML tags.

OPTIONS

--version
show program's version number and exit
-h, --help
show this help message and exit
-v, --verbose
more verbose output
--encoding=ENCODING
specify encoding of text content
--html4tags
use HTML 4 style for empty element tags
-s MODE, --safe=MODE
sanitize literal HTML: 'escape' escapes HTML meta chars, 'replace' replaces with an [HTML_REMOVED] note
-x EXTRAS, --extras=EXTRAS
Turn on specific extra features (not part of the core Markdown spec). See above.
--use-file-vars=USE_FILE_VARS
Look for and use Emacs-style 'markdown-extras' file var to turn on extras. See <https://github.com/trentm/pythonmarkdown2/wiki/Extras>
--link-patterns-file=LINK_PATTERNS_FILE
path to a link pattern file
--self-test
run internal self-tests (some doctests)
--compare
run against Markdown.pl as well (for testing)
December 2018 markdown2 2.3.7