Skip to main content

Extension for Python-Markdown to handle <figure> and <figcaption>.

Project description


Extension for Python-Markdown to handle <figure> and <figcaption>.


  • %%% 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'])


<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>
<p>%: will not be a figcaption</p>


  • 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.


From PyPI:

pip install markdown-figcap

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for markdown-figcap, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size markdown_figcap-0.1.1-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size markdown-figcap-0.1.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page