Extension for Python-Markdown to handle <figure> and <figcaption>.
Project description
markdown-figcap
Extension for Python-Markdown to handle <figure>
and <figcaption>
.
Usage
%%%
start a<figure>
%:
start a<figcaption>
from markdown import Markdown
text = r'''
%%%
%%% figure-class here
{: img-attributes here}
%: figcaption here
{: figcaption-attributes here}
%: will not be a figcaption
'''
md = Markdown(extensions=['markdown_figcap','attr_list'])
print(md.convert(text))
Output:
<p>%%%</p>
<figure class="figure-class here">
<img alt="img-alt" here="here" img-attributes="img-attributes" src="/source/of/img.jpg" />
<figcaption figcaption-attributes="figcaption-attributes" here="here">figcaption here</figcaption>
</figure>
<p>%: will not be a figcaption</p>
Notice
- The attributes rendering (except
<figure>
's class) is supported by the origin Python-Markdown'sattr_list
extension. - Figure starter only will not be rendered as
<figure>
. - Figcaption starter will not take effect until it is in the
figure
block. - If the
<p>
in<figure>
has no text and only one<img>
child, the<p>
tag will be got rid of.
Installation
From PyPI:
pip install markdown-figcap
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markdown-figcap-0.1.1.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for markdown_figcap-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3513ba7e5afd0778fa85acf64984e2ecc881e72bfccc6e12af3c767aeaa3b4f2 |
|
MD5 | 784ee623ee96dfebaf8d0f680bc17386 |
|
BLAKE2b-256 | 43b1e704857af285a65aca4844ac50abee4a478f711f6e0b7addf4ff8e9dfeee |