‹› markdown.extensions.smarty

Convert ASCII dashes, quotes and ellipses to their HTML entity equivalents.

See the documentation for details.

Classes:

‹› markdown.extensions.smarty.SubstituteTextPattern(pattern: str, replace: Sequence[int | str | etree.Element], md: Markdown)

‹› markdown.extensions.smarty.SmartyExtension(**kwargs)

Bases: Extension

Add Smarty to Markdown.

Methods:

Attributes:

  • config

    Default configuration options.

‹› markdown.extensions.smarty.SmartyExtension.config instance-attribute

Default configuration options.

Defined Value:

self.config = {
    'smart_quotes': [True, 'Educate quotes'],
    'smart_angled_quotes': [False, 'Educate angled quotes'],
    'smart_dashes': [True, 'Educate dashes'],
    'smart_ellipses': [True, 'Educate ellipses'],
    'substitutions': [{}, 'Overwrite default substitutions'],
}

‹› markdown.extensions.smarty.SmartyExtension.extendMarkdown(md)

Register the processors.

Class Instance Registry Name Priority
markdown.treeprocessors.InlineProcessor treeprocessors smarty 6
markdown.inlinepatterns.HtmlInlineProcessor inlinepatterns html 90

The HtmlInlineProcessor , above, is only used if the smart_angled_quotes option is enabled.

The InlineProcessor, above, is a separate instance from the InlineProcessor used for standard inline parsing. It contains a collection of inline patterns dependent upon the various configuration options.