class Markdown: (source)
Convert Markdown to HTML.
Method | __init__ |
Creates a new Markdown instance. |
Method | build |
Build extension from a string name, then return an instance. |
Method | build |
Build the parser from the various parts. |
Method | convert |
Convert markdown to serialized XHTML or HTML. |
Method | convert |
Converts a markdown file and returns the HTML as a unicode string. |
Method | is |
Check if the tag is a block level HTML tag. |
Method | register |
This gets called by the extension |
Method | register |
Register extensions with this instance of Markdown. |
Method | reset |
Resets all state variables so that we can start with a new text. |
Method | set |
Set the output format for the class instance. |
Class Variable | doc |
Undocumented |
Class Variable | output |
Undocumented |
Instance Variable | block |
Undocumented |
Instance Variable | doc |
Undocumented |
Instance Variable | ESCAPED |
Undocumented |
Instance Variable | html |
Undocumented |
Instance Variable | inline |
Undocumented |
Instance Variable | lines |
Undocumented |
Instance Variable | output |
Undocumented |
Instance Variable | parser |
Undocumented |
Instance Variable | postprocessors |
Undocumented |
Instance Variable | preprocessors |
Undocumented |
Instance Variable | references |
Undocumented |
Instance Variable | registered |
Undocumented |
Instance Variable | serializer |
Undocumented |
Instance Variable | strip |
Undocumented |
Instance Variable | tab |
Undocumented |
Instance Variable | treeprocessors |
Undocumented |
Creates a new Markdown instance. Keyword arguments: * extensions: A list of extensions. If an item is an instance of a subclass of `markdown.extension.Extension`, the instance will be used as-is. If an item is of type string, first an entry point will be loaded. If that fails, the string is assumed to use Python dot notation (`path.to.module:ClassName`) to load a markdown.Extension subclass. If no class is specified, then a `makeExtension` function is called within the specified module. * extension_configs: Configuration settings for extensions. * output_format: Format of output. Supported formats are: * "xhtml": Outputs XHTML style tags. Default. * "html": Outputs HTML style tags. * tab_length: Length of tabs in the source. Default: 4
Build extension from a string name, then return an instance. First attempt to load an entry point. The string name must be registered as an entry point in the `markdown.extensions` group which points to a subclass of the `markdown.extensions.Extension` class. If multiple distributions have registered the same name, the first one found is returned. If no entry point is found, assume dot notation (`path.to.module:ClassName`). Load the specified class and return an instance. If no class is specified, import the module and call a `makeExtension` function and return the Extension instance returned by that function.
Convert markdown to serialized XHTML or HTML. Keyword arguments: * source: Source text as a Unicode string. Markdown processing takes place in five steps: 1. A bunch of "preprocessors" munge the input text. 2. BlockParser() parses the high-level structural elements of the pre-processed text into an ElementTree. 3. A bunch of "treeprocessors" are run against the ElementTree. One such treeprocessor runs InlinePatterns against the ElementTree, detecting inline markup. 4. Some post-processors are run against the text after the ElementTree has been serialized into text. 5. The output is written to a string.
Converts a markdown file and returns the HTML as a unicode string. Decodes the file using the provided encoding (defaults to utf-8), passes the file content to markdown, and outputs the html to either the provided stream or the file with provided name, using the same encoding as the source file. The 'xmlcharrefreplace' error handler is used when encoding the output. **Note:** This is the only place that decoding and encoding of unicode takes place in Python-Markdown. (All other code is unicode-in / unicode-out.) Keyword arguments: * input: File object or path. Reads from stdin if `None`. * output: File object or path. Writes to stdout if `None`. * encoding: Encoding of input and output files. Defaults to utf-8.