blag.markdown

Markdown Processing.

This module contains the methods responsible for blag’s markdown processing.

Functions

convert_markdown(md, markdown)

Convert markdown into html and extract meta data.

markdown_factory()

Create a Markdown instance.

Classes

MarkdownLinkExtension(**kwargs)

markdown.extension that converts relative .md- to .html-links.

MarkdownLinkTreeprocessor([md])

Converts relative links to .md files to .html

class blag.markdown.MarkdownLinkExtension(**kwargs)

markdown.extension that converts relative .md- to .html-links.

__module__ = 'blag.markdown'
extendMarkdown(md)

Add the various proccesors and patterns to the Markdown Instance.

This method must be overriden by every extension.

Keyword arguments:

  • md: The Markdown instance.

  • md_globals: Global variables in the markdown module namespace.

class blag.markdown.MarkdownLinkTreeprocessor(md=None)

Converts relative links to .md files to .html

__module__ = 'blag.markdown'
convert(url)
run(root)

Subclasses of Treeprocessor should implement a run method, which takes a root ElementTree. This method can return another ElementTree object, and the existing root ElementTree will be replaced, or it can modify the current tree and return None.

blag.markdown.convert_markdown(md, markdown)

Convert markdown into html and extract meta data.

Some meta data is treated special:
  • date is converted into datetime with local timezone

  • tags is interpreted as a comma-separeted list of strings. All strings are stripped and converted to lower case.

Parameters
  • md (markdown.Markdown instance) –

  • markdown (str) –

Returns

html and metadata

Return type

str, dict

blag.markdown.markdown_factory()

Create a Markdown instance.

This method exists only to ensure we use the same Markdown instance for tests as for the actual thing.

Returns

Return type

markdown.Markdown