mkdocs-thumbnails
MkDocs plugin to generate thumbnails automatically.
Provides a mechanism to indicate, in Markdown, the desire for PDF files and YouTube links to have a thumbnail image, automatically generated/downloaded.
Setup
Install the plugin using pip:
pip install mkdocs-thumbnails
Edit mkdocs.yml:
- Add
thumbnailsto the list of plugins. - Add
markdown.extensions.attr_list(explained here) to the list of markdown extensions:
plugins:
- search
- thumbnails:
# optional styling for the thumbnail:
style: margin-top:5px;margin-bottom:5px;margin-right:25px
markdown_extensions:
- markdown.extensions.attr_list
Note: The extension If you have no
pluginsentry in your config file yet, you'll likely also want to add thesearchplugin. MkDocs enables it by default if there is nopluginsentry set, but now you have to enable it explicitly.
More information about plugins in the MkDocs documentation.
Config
style- This is the CSS style to be set in the thumbnail's image tag
Usage
In the attribute list of a link, add .pdf or .youtube to turn on the thumbnail for that link:
[My PDF file](foo.pdf){.pdf}⸱⸱
[A YouTube video link](https://youtu.be/dQw4w9WgXcQ){.youtube}⸱⸱
The markdown conversion generates:
<a href="foo.pdf" class="pdf" >My PDF file</a>
<br>
<a href="https://youtu.be/dQw4w9WgXcQ" class="youtube" >A YouTube video link</a>
<br>
...which is converted by the plugin:
<a href="foo.pdf"><img src="foo.pdf-thumb.png" class="pdf" >My PDF file</a>
<br>
<a href="https://youtu.be/dQw4w9WgXcQ"><img src="dQw4w9WgXcQ-thumb.png" class="youtube" >A YouTube video link</a>
<br>
Thumbnails are generated automatically. PDF links will have the first page of the PDF in the thumbnail. YouTube thumbnails are downloaded from Youtube via the link: https://img.youtube.com/vi/{id}/default.jpg
In the example above two spaces are added after each line, to force a markdown line break.
Release files for mkdocs-thumbnails 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocs-thumbnails-0.0.10.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocs_thumbnails-0.0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / mkdocs-thumbnails-0.0.10.tar.gz
| Download URL | mkdocs-thumbnails-0.0.10.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14eda833eecdc3b607adbf76cd733aeb7fe785a132e6a63e9542bc619cb38bdc
|
|
BLAKE2b-256 checksum How to use checksums |
32800ec8e6c93731dce21fd0ddaecfee3342d9ed6a05267c3e317eb18a9bb27c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / mkdocs_thumbnails-0.0.10-py3-none-any.whl
| Download URL | mkdocs_thumbnails-0.0.10-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a31c737abd3ffdeab57a8da315e53897133ae7598bb6fde8c49bf9ff5cf8aee5
|
|
BLAKE2b-256 checksum How to use checksums |
f1adbe3b39cac269ffdd78c5203f135e239e6b9df653b0126e3b255ea89ba2a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|