Skip to content

BracketSpan

New

BracketSpan is new in 12.0

Overview

BracketSpan is an extension that allows for the creation of arbitrary spans that can be decorated with the attr_list list extension. To use attr_list must also be enabled.

import markdown
md = markdown.Markdown(extensions=['pymdownx.bracketspan', 'attr_list'])

Spans can be created by enclosing content within a square bracket and applying some attributes using attr_list syntax. It can be noted that if you place an empty {}, a span with no special attributes will be created.

Whitespace
[span]{style="color: magenta"}

span

BracketSpan should be compatible with other bracket syntaxes, such as links, images, etc. For instance, if the bracket object represents a reference link, the reference processor will handle it before BracketSpan, and attr_list will apply attributes as it normally would.

Whitespace
[Pymdown Extensions]{style="color: magenta"}

[Pymdown Extensions]: https://github.com/facelessuser/pymdown-extensions 

Options

There are currently no options.