gfm.spaced_link – Links with optional whitespace¶

The gfm.spaced_link module provides an extension that supports links and images with additional whitespace.

GitHub’s Markdown engine allows links and images to have whitespace – including a single newline – between the first set of brackets and the second (e.g. [text] (href)). This extension adds such support.

Typical usage¶

import markdown
from gfm import SpacedLinkExtension

print(markdown.markdown("Check out [this link] (http://example.org/)!",
                        extensions=[SpacedLinkExtension()]))
<p>Check out <a href="http://example.org/">this link</a>!</p>
class gfm.spaced_link.SpacedLinkExtension(*args, **kwargs)[source]¶

Bases: markdown.extensions.Extension

An extension that supports links and images with additional whitespace.

extendMarkdown(md, md_globals)[source]¶

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.
getConfig(key, default='')¶

Return a setting for the given key or an empty string.

getConfigInfo()¶

Return all config descriptions as a list of tuples.

getConfigs()¶

Return all configs settings as a dict.

setConfig(key, value)¶

Set a config setting for key with the given value.

setConfigs(items)¶

Set multiple config settings given a dict or list of tuples.

py-gfm

Navigation

  • gfm.autolink – Turn URLs into links
  • gfm.automail – Turn email addresses into links
  • gfm.hidden_hilite – Fenced code blocks with no highlighting
  • gfm.semi_sane_lists – GitHub-like list parsing
  • gfm.spaced_link – Links with optional whitespace
  • gfm.strikethrough – Strike-through support
  • gfm.tasklist – Task list support
  • gfm – Base module for GitHub-Flavored Markdown
  • mdx_gfm – Full extension for GFM (comments, issues)
  • mdx_partial_gfm – Partial extension for GFM (READMEs, wiki)

Related Topics

  • Documentation overview
    • <no title>
      • Previous: gfm.semi_sane_lists – GitHub-like list parsing
      • Next: gfm.strikethrough – Strike-through support

Quick search

©2018, The Dart Team, Alexandre Macabies. | Powered by Sphinx 1.7.9 & Alabaster 0.7.8 | Page source