# mkdocs-thumbnails
[MkDocs](https://www.mkdocs.org/) 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)](https://python-markdown.github.io/extensions/attr_list/) to the list of markdown extensions:
```yaml
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](http://www.mkdocs.org/user-guide/plugins/).
## 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:
```markdown
[My PDF file](foo.pdf){.pdf}⸱⸱
[A YouTube video link](https://youtu.be/dQw4w9WgXcQ){.youtube}⸱⸱
```
The markdown conversion generates:
```html
<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:
```html
<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.
Raw data
{
"_id": null,
"home_page": "https://github.com/normanlorrain/mkdocs-thumbnails",
"name": "mkdocs-thumbnails",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Norman Lorrain",
"author_email": "normanlorrain@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/32/80/0ec8e6c93731dce21fd0ddaecfee3342d9ed6a05267c3e317eb18a9bb27c/mkdocs-thumbnails-0.0.10.tar.gz",
"platform": null,
"description": "# mkdocs-thumbnails\r\n\r\n[MkDocs](https://www.mkdocs.org/) plugin to generate thumbnails automatically.\r\n\r\nProvides a mechanism to indicate, in Markdown, the desire for PDF files and YouTube links to have a thumbnail image, automatically generated/downloaded.\r\n\r\n## Setup\r\n\r\nInstall the plugin using pip:\r\n\r\n`pip install mkdocs-thumbnails`\r\n\r\nEdit `mkdocs.yml`: \r\n1. Add `thumbnails` to the list of plugins. \r\n2. Add `markdown.extensions.attr_list` [(explained here)](https://python-markdown.github.io/extensions/attr_list/) to the list of markdown extensions:\r\n\r\n\r\n```yaml\r\nplugins:\r\n - search\r\n - thumbnails:\r\n # optional styling for the thumbnail:\r\n style: margin-top:5px;margin-bottom:5px;margin-right:25px \r\n\r\nmarkdown_extensions:\r\n - markdown.extensions.attr_list \r\n```\r\n> **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.\r\n\r\nMore information about plugins in the [MkDocs documentation](http://www.mkdocs.org/user-guide/plugins/).\r\n\r\n## Config\r\n\r\n* `style` - This is the CSS style to be set in the thumbnail's image tag\r\n\r\n## Usage\r\nIn the attribute list of a link, add `.pdf` or `.youtube` to turn on the thumbnail for that link:\r\n```markdown\r\n[My PDF file](foo.pdf){.pdf}\u2e31\u2e31\r\n[A YouTube video link](https://youtu.be/dQw4w9WgXcQ){.youtube}\u2e31\u2e31 \r\n\r\n```\r\n\r\nThe markdown conversion generates:\r\n```html\r\n<a href=\"foo.pdf\" class=\"pdf\" >My PDF file</a>\r\n<br>\r\n<a href=\"https://youtu.be/dQw4w9WgXcQ\" class=\"youtube\" >A YouTube video link</a>\r\n<br>\r\n```\r\n\r\n...which is converted by the plugin:\r\n```html\r\n<a href=\"foo.pdf\"><img src=\"foo.pdf-thumb.png\" class=\"pdf\" >My PDF file</a>\r\n<br>\r\n<a href=\"https://youtu.be/dQw4w9WgXcQ\"><img src=\"dQw4w9WgXcQ-thumb.png\" class=\"youtube\" >A YouTube video link</a>\r\n<br>\r\n```\r\nThumbnails 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`\r\n\r\nIn the example above two spaces are added after each line, to force a markdown line break.\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "An MkDocs plugin. Generates thumbnails of PDF files and YouTube links.",
"version": "0.0.10",
"project_urls": {
"Bug Tracker": "https://github.com/normanlorrain/mkdocs-thumbnails/issues",
"Homepage": "https://github.com/normanlorrain/mkdocs-thumbnails"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1adbe3b39cac269ffdd78c5203f135e239e6b9df653b0126e3b255ea89ba2a3",
"md5": "4c9ea56bb6aa7ae22683e966eb763e1b",
"sha256": "a31c737abd3ffdeab57a8da315e53897133ae7598bb6fde8c49bf9ff5cf8aee5"
},
"downloads": -1,
"filename": "mkdocs_thumbnails-0.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4c9ea56bb6aa7ae22683e966eb763e1b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6225,
"upload_time": "2023-06-05T20:31:56",
"upload_time_iso_8601": "2023-06-05T20:31:56.576513Z",
"url": "https://files.pythonhosted.org/packages/f1/ad/be3b39cac269ffdd78c5203f135e239e6b9df653b0126e3b255ea89ba2a3/mkdocs_thumbnails-0.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "32800ec8e6c93731dce21fd0ddaecfee3342d9ed6a05267c3e317eb18a9bb27c",
"md5": "443a66c656e894256337e45941825e5a",
"sha256": "14eda833eecdc3b607adbf76cd733aeb7fe785a132e6a63e9542bc619cb38bdc"
},
"downloads": -1,
"filename": "mkdocs-thumbnails-0.0.10.tar.gz",
"has_sig": false,
"md5_digest": "443a66c656e894256337e45941825e5a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5683,
"upload_time": "2023-06-05T20:31:58",
"upload_time_iso_8601": "2023-06-05T20:31:58.528662Z",
"url": "https://files.pythonhosted.org/packages/32/80/0ec8e6c93731dce21fd0ddaecfee3342d9ed6a05267c3e317eb18a9bb27c/mkdocs-thumbnails-0.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-05 20:31:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "normanlorrain",
"github_project": "mkdocs-thumbnails",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "mkdocs-thumbnails"
}