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


<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)
{: .class1 }
<figure class="class1"><img src="img.jpg" title="title" /><figcaption>caption</figcaption></figure>
inline captioned images
<style>
.inline {
display: inline-block;
}
</style>
{: .inline }
{: .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 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>
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
File details
Details for the file markdown-captions-2.1.2.tar.gz.
File metadata
- Download URL: markdown-captions-2.1.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3ec0b674dd41a4c5f125724188c32a17bd46fd527db29f0c55a001e2d7abaf
|
|
| MD5 |
d0d46de638e820fdd5d0522b68257960
|
|
| BLAKE2b-256 |
811d15ef64ed904c85d0520d632ec6844b7da886a45b0cb7970644be493181d0
|