Skip to main content

An MkDocs plugin. Generates thumbnails of PDF files and YouTube links.

Project description

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:

  1. Add thumbnails to the list of plugins.
  2. 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 plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry 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.

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

mkdocs-thumbnails-0.0.9.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_thumbnails-0.0.9-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-thumbnails-0.0.9.tar.gz.

File metadata

  • Download URL: mkdocs-thumbnails-0.0.9.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for mkdocs-thumbnails-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a8e40e2976bc5b2f7d1cd88a39091606279862b43e888ebba1c5892c9b118ec0
MD5 88fff82179bfe53c1b4045429cc28851
BLAKE2b-256 39cedb467f83a35e0335b0938d87e2b353039c1c41a24b6f5d77589a71dcc517

See more details on using hashes here.

File details

Details for the file mkdocs_thumbnails-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_thumbnails-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for mkdocs_thumbnails-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8da0ed9f7d83438837a76df430616f5a5600f3aee669900aefecef2242c3bd88
MD5 318811d65245798f29bb95445a8c1e2d
BLAKE2b-256 022c12849103b6c8cc4deddff68aa43c52c1d7615e5f2c1858247452d13c18da

See more details on using hashes here.

Supported by

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