1.1.1.2.1.2.1.1. nikola.plugins.compile.markdown package — Nikola 8.1.3 documentation

# 1.1.1.2.1.2.1.1. nikola.plugins.compile.markdown package

Page compiler plugin for Markdown.

class nikola.plugins.compile.markdown.CompileMarkdown

  Bases: :class:`nikola.plugin_categories.PageCompiler`

  Compile Markdown into HTML.

  compile(source, dest, is_two_file=True, post=None, lang=None)

    Compile the source file into HTML and save as dest.

  compile_string(data, source_path=None, is_two_file=True, post=None, lang=None)

    Compile Markdown into HTML strings.

  create_post(path, **kw)

    Create a new post.

  demote_headers = True
  friendly_name = 'Markdown'
  name = 'markdown'
  read_metadata(post, lang=None)

    Read the metadata from a post, and return a metadata dict.

  set_site(site)

    Set Nikola site.

  site = None
  supports_metadata = False

class nikola.plugins.compile.markdown.ThreadLocalMarkdown(extensions, extension_configs)

  Bases: :class:`_thread._local`

  Convert Markdown to HTML using per-thread Markdown objects.

  See discussion in #2661.

  convert(data)

    Convert data to HTML and reset internal state.

## 1.1.1.2.1.2.1.1.1. Submodules

## 1.1.1.2.1.2.1.1.2. nikola.plugins.compile.markdown.mdx_gist module

Extension to Python Markdown for Embedded Gists (gist.github.com).

Basic Example:

> Text of the gist: [:gist: 4747847]

Example with filename:

> Text of the gist: [:gist: 4747847 zen.py]

Basic Example with hexidecimal id:

> Text of the gist: [:gist: c4a43d6fdce612284ac0]

Example with hexidecimal id filename:

> Text of the gist: [:gist: c4a43d6fdce612284ac0 cow.txt]

Example using reStructuredText syntax:

> Text of the gist: .. gist:: 4747847 zen.py

Example using hexidecimal ID with reStructuredText syntax:

> Text of the gist: .. gist:: c4a43d6fdce612284ac0

Example using hexidecimal ID and filename with reStructuredText syntax:

> Text of the gist: .. gist:: c4a43d6fdce612284ac0 cow.txt

Error Case: non-existent Gist ID:

> Text of the gist: [:gist: 0]

Error Case: non-existent file:

> Text of the gist: [:gist: 4747847 doesntexist.py]

class nikola.plugins.compile.markdown.mdx_gist.GistExtension(configs={})

  Bases: :class:`nikola.plugin_categories.MarkdownExtension`, :class:`markdown.extensions.Extension`

  Gist extension for Markdown.

  extendMarkdown(md, md_globals=None)

    Extend Markdown.

exception nikola.plugins.compile.markdown.mdx_gist.GistFetchException(url, status_code)

  Bases: :class:`Exception`

  Raised when attempt to fetch content of a Gist from github.com fails.

class nikola.plugins.compile.markdown.mdx_gist.GistPattern(pattern, configs)

  Bases: :class:`markdown.inlinepatterns.Pattern`

  InlinePattern for footnote markers in a document’s body text.

  get_raw_gist(gist_id)

    Get raw gist text.

  get_raw_gist_with_filename(gist_id, filename)

    Get raw gist text for a filename.

  handleMatch(m)

    Handle pattern match.

nikola.plugins.compile.markdown.mdx_gist.makeExtension(configs=None)

  Make Markdown extension.

## 1.1.1.2.1.2.1.1.3. nikola.plugins.compile.markdown.mdx_nikola module

Markdown Extension for Nikola.

- Specific post-processing.

- Strikethrough inline patterns.

class nikola.plugins.compile.markdown.mdx_nikola.NikolaExtension

  Bases: :class:`nikola.plugin_categories.MarkdownExtension`, :class:`markdown.extensions.Extension`

  Nikola Markdown extensions.

  extendMarkdown(md, md_globals=None)

    Extend markdown to Nikola flavours.

class nikola.plugins.compile.markdown.mdx_nikola.NikolaPostProcessor(md=None)

  Bases: :class:`markdown.postprocessors.Postprocessor`

  Nikola-specific post-processing for Markdown.

  run(text)

    Run the postprocessor.

nikola.plugins.compile.markdown.mdx_nikola.makeExtension(configs=None)

  Make extension.

## 1.1.1.2.1.2.1.1.4. nikola.plugins.compile.markdown.mdx_podcast module

Extension to Python Markdown for Embedded Audio.

Basic Example:

    >>> import markdown
    >>> text = "[podcast]https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3[/podcast]"
    >>> html = markdown.markdown(text, [PodcastExtension()])
    >>> print(html)
    <p><audio controls=""><source src="https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3" type="audio/mpeg"></source></audio></p>

class nikola.plugins.compile.markdown.mdx_podcast.PodcastExtension(configs={})

  Bases: :class:`nikola.plugin_categories.MarkdownExtension`, :class:`markdown.extensions.Extension`

  Podcast extension for Markdown.

  extendMarkdown(md, md_globals=None)

    Extend Markdown.

class nikola.plugins.compile.markdown.mdx_podcast.PodcastPattern(pattern, configs)

  Bases: :class:`markdown.inlinepatterns.Pattern`

  InlinePattern for footnote markers in a document’s body text.

  handleMatch(m)

    Handle pattern matches.

nikola.plugins.compile.markdown.mdx_podcast.makeExtension(configs=None)

  Make Markdown extension.