Skip to main content

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-alt](/source/of/img.jpg){: 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's attr_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

Release files for markdown-figcap 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markdown-figcap 0.1.1
File Size Uploaded
markdown-figcap-0.1.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markdown-figcap 0.1.1
File Interpreter ABI Platform
markdown_figcap-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / markdown-figcap-0.1.1.tar.gz

Download URL markdown-figcap-0.1.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
61fa8a567cfad3d63754277f9d1341ada01695aafd42dd2a52c8739ce3546634
BLAKE2b-256 checksum
How to use checksums
d2ca2a08d8558b061aabbfcbdcac76a883589fd92a67917757b930defa915a7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

Release files / markdown_figcap-0.1.1-py3-none-any.whl

Download URL markdown_figcap-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3513ba7e5afd0778fa85acf64984e2ecc881e72bfccc6e12af3c767aeaa3b4f2
BLAKE2b-256 checksum
How to use checksums
43b1e704857af285a65aca4844ac50abee4a478f711f6e0b7addf4ff8e9dfeee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page