Skip to main content

Turn markdown images into captioned images using <figure>

Project description

markdown-captions

Converts images with alt text to <figure> with <figcaption>.

Usage

pip install markdown-captions
md = markdown.Markdown(
    extensions=[
        'markdown_captions',
        'attr_list' # optional
    ]
)

Examples

simple example

![caption](img.jpg)
![caption2](img2.jpg)
<p>
  <figure><img src="img.jpg" /><figcaption>caption</figcaption></figure>
  <figure><img src="img2.jpg" /><figcaption>caption2</figcaption></figure>
</p>

image title and class (with attr_list extension)

![caption](img.jpg "title"){: .class1 }
<figure class="class1"><img src="img.jpg" title="title" /><figcaption>caption</figcaption></figure>

inline captioned images

<style>
    .inline {
        display: inline-block;
    }
</style>
![caption](img.jpg){: .inline }
![caption2](img2.jpg){: .inline }
<p>
  <figure class="inline"><img src="img.jpg" /><figcaption>caption</figcaption></figure>
  <figure class="inline"><img src="img2.jpg" /><figcaption>caption2</figcaption></figure>
</p>

images with no alt text are not captioned

![](img.jpg)
<img src="img.jpg" />

Project details


Download files

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

Source Distribution

markdown-captions-2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

markdown_captions-2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file markdown-captions-2.tar.gz.

File metadata

  • Download URL: markdown-captions-2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

File hashes

Hashes for markdown-captions-2.tar.gz
Algorithm Hash digest
SHA256 f653955d4ca22cbe84c39dc19693317ec2ce7a0af03cf5d44b349be7baf0dc97
MD5 9352862f22ae3c213deed5359a1d2867
BLAKE2b-256 ef2a881766759ce520f7e858c21350bb4383a3896cf47080ddec10310cff1c7f

See more details on using hashes here.

File details

Details for the file markdown_captions-2-py3-none-any.whl.

File metadata

  • Download URL: markdown_captions-2-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

File hashes

Hashes for markdown_captions-2-py3-none-any.whl
Algorithm Hash digest
SHA256 0820b7ca1e7ea9041a0462584b4211d8023e6849709395fa34bfcd57c01bb49a
MD5 c86e66462fb365dda62c932e1f6d4c6a
BLAKE2b-256 88e41f007cdc598c9eb32c167112e6f872eaa007211c1350ebaf8907928c4a02

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page