# markdown-captions
Converts images with alt text to `<figure>` with `<figcaption>`.
## Usage
```
pip install markdown-captions
```
``` python
md = markdown.Markdown(
extensions=[
'markdown_captions',
'attr_list' # optional
]
)
```
## Examples
simple example
``` md
![caption](img.jpg)
![caption2](img2.jpg)
```
``` html
<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)
``` md
![caption](img.jpg "title"){: .class1 }
```
``` html
<figure class="class1"><img src="img.jpg" title="title" /><figcaption>caption</figcaption></figure>
```
inline captioned images
``` md
<style>
.inline {
display: inline-block;
}
</style>
![caption](img.jpg){: .inline }
![caption2](img2.jpg){: .inline }
```
``` html
<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
``` md
![](img.jpg)
```
``` html
<img src="img.jpg" />
```
referenced images, and shorthand references are also supported
``` md
![caption][ref]
![caption2]
[ref]: img.jpg
[caption2]: img2.jpg
```
``` html
<p>
<figure><img src="img.jpg" /><figcaption>caption</figcaption></figure>
<figure><img src="img2.jpg" /><figcaption>caption2</figcaption></figure>
</p>
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Evidlo/markdown_captions",
"name": "markdown-captions",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "markdown figures captions subtitles",
"author": "evidlo",
"author_email": "evan@evanw.org",
"download_url": "https://files.pythonhosted.org/packages/81/1d/15ef64ed904c85d0520d632ec6844b7da886a45b0cb7970644be493181d0/markdown-captions-2.1.2.tar.gz",
"platform": null,
"description": "# markdown-captions\n\nConverts images with alt text to `<figure>` with `<figcaption>`.\n\n## Usage\n\n```\npip install markdown-captions\n```\n\n``` python\nmd = markdown.Markdown(\n extensions=[\n 'markdown_captions',\n 'attr_list' # optional\n ]\n)\n```\n\n## Examples\n\nsimple example\n``` md\n![caption](img.jpg)\n![caption2](img2.jpg)\n```\n``` html\n<p>\n <figure><img src=\"img.jpg\" /><figcaption>caption</figcaption></figure>\n <figure><img src=\"img2.jpg\" /><figcaption>caption2</figcaption></figure>\n</p>\n```\n\nimage title and class (with attr_list extension)\n``` md\n![caption](img.jpg \"title\"){: .class1 }\n```\n``` html\n<figure class=\"class1\"><img src=\"img.jpg\" title=\"title\" /><figcaption>caption</figcaption></figure>\n```\n\ninline captioned images\n``` md\n<style>\n .inline {\n display: inline-block;\n }\n</style>\n![caption](img.jpg){: .inline }\n![caption2](img2.jpg){: .inline }\n```\n``` html\n<p>\n <figure class=\"inline\"><img src=\"img.jpg\" /><figcaption>caption</figcaption></figure>\n <figure class=\"inline\"><img src=\"img2.jpg\" /><figcaption>caption2</figcaption></figure>\n</p>\n```\n\nimages with no alt text are not captioned\n``` md\n![](img.jpg)\n```\n``` html\n<img src=\"img.jpg\" />\n```\n\nreferenced images, and shorthand references are also supported\n\n``` md\n![caption][ref]\n![caption2]\n\n[ref]: img.jpg\n[caption2]: img2.jpg\n```\n\n``` html\n<p>\n <figure><img src=\"img.jpg\" /><figcaption>caption</figcaption></figure>\n <figure><img src=\"img2.jpg\" /><figcaption>caption2</figcaption></figure>\n</p>\n```\n\n\n\n",
"bugtrack_url": null,
"license": "GPL3",
"summary": "Turn markdown images into captioned images using <figure>",
"version": "2.1.2",
"project_urls": {
"Homepage": "https://github.com/Evidlo/markdown_captions"
},
"split_keywords": [
"markdown",
"figures",
"captions",
"subtitles"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "811d15ef64ed904c85d0520d632ec6844b7da886a45b0cb7970644be493181d0",
"md5": "d0d46de638e820fdd5d0522b68257960",
"sha256": "1c3ec0b674dd41a4c5f125724188c32a17bd46fd527db29f0c55a001e2d7abaf"
},
"downloads": -1,
"filename": "markdown-captions-2.1.2.tar.gz",
"has_sig": false,
"md5_digest": "d0d46de638e820fdd5d0522b68257960",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3031,
"upload_time": "2022-07-19T22:29:28",
"upload_time_iso_8601": "2022-07-19T22:29:28.959906Z",
"url": "https://files.pythonhosted.org/packages/81/1d/15ef64ed904c85d0520d632ec6844b7da886a45b0cb7970644be493181d0/markdown-captions-2.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-07-19 22:29:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Evidlo",
"github_project": "markdown_captions",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "markdown-captions"
}