Skip to main content

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" />

referenced images, and shorthand references are also supported

![caption][ref]
![caption2]

[ref]: 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>

Metadata

Release files for markdown-captions 2.1.2

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-captions 2.1.2
File Size Uploaded Provenance Actions
markdown-captions-2.1.2.tar.gz 3.0 kB Without provenance Details for markdown-captions-2.1.2.tar.gz

Release files / markdown-captions-2.1.2.tar.gz

Download URL markdown-captions-2.1.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1c3ec0b674dd41a4c5f125724188c32a17bd46fd527db29f0c55a001e2d7abaf
BLAKE2b-256 checksum
How to use checksums
811d15ef64ed904c85d0520d632ec6844b7da886a45b0cb7970644be493181d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.5

Security for markdown-captions 2.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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