gfm.automail – Turn email addresses into links¶
The gfm.automail module provides an extension that turns all raw email
addresses into marked-up links.
Typical usage¶
import markdown
from gfm import AutomailExtension
print(markdown.markdown("You can mail me at foo@example.org for more info",
extensions=[AutomailExtension()]))
<p>You can mail me at <a href="mailto:foo@example.org">foo@example.org</a> for more info</p>
-
class
gfm.automail.AutomailExtension(**kwargs)[source]¶ Bases:
markdown.extensions.ExtensionAn extension that turns email addresses into links.
-
extendMarkdown(md)[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.
-
-
class
gfm.automail.AutomailPattern(pattern, md=None)[source]¶ Bases:
markdown.inlinepatterns.Pattern-
getCompiledRegExp()¶ Return a compiled regular expression.
-
handleMatch(m)[source]¶ Return a ElementTree element from the given match.
Subclasses should override this method.
Keyword arguments:
- m: A re match object containing a match of the pattern.
-
type()¶ Return class name, to define pattern type
-
unescape(text)¶ Return unescaped text given text with an inline placeholder.
-