A MKDocs plugin that generates a button for a URL defined in the frontmatter
Project description
MkDocs Frontmatter URL Plugin
This MkDocs plugin generates a button or tag from a URL specified in the frontmatter of a markdown document.
Installation
Install the package with pip:
pip install mkdocs-frontmatter-url
Usage
- Activate the plugin in your
mkdocs.yml:
plugins:
- frontmatter-url
- In your markdown files, add a
urlfield to the frontmatter:
---
title: My Page
gitlab: https://example.com
---
# Welcome to My Page
Content goes here...
-
The plugin will automatically generate a button with the specified URL after the frontmatter.
-
To verify if the
on_page_markdownfunction is triggering, run MkDocs with the verbose flag:
mkdocs build -v
or for serving:
mkdocs serve -v
This will display detailed logs, including messages from the plugin showing when the on_page_markdown function is triggered for each page.
Configuration
You can customize the button text in your mkdocs.yml:
plugins:
- frontmatter-url:
button-text: 'My external button'
frontmatter-url-name: 'github'
button-text is the text that is shown on the button.
The default is Visit link.
frontmatter-url-name is the name of the url-field in your frontmatter.
The default is url.
Limitations
- The css is not configurable
- There are multiple fontawesome-icons usable as an icon, but the icon itself is not configurable
- There is only room for one URL
- The button will always try to place itself under the first heading. If there is no first heading it will place itself on the top
The interaction with other plugins has not been tested
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_frontmatter_url-0.1.2.tar.gz.
File metadata
- Download URL: mkdocs_frontmatter_url-0.1.2.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06fa5fbaf9beab5b27089d211d52086ff8b07a0ed6b556ce61b8e33bc4e422f8
|
|
| MD5 |
ad7fa129fbcded4354c59ef012123db7
|
|
| BLAKE2b-256 |
8585085376c14ade140429955cf0f1712d5199813d16ae26fa2107da75cdd85e
|
File details
Details for the file mkdocs_frontmatter_url-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mkdocs_frontmatter_url-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b90e05cfd3541322caa2eca23a255f0c7e1770f7c158b2c2c649ad507f7d48
|
|
| MD5 |
14a1b1aa6fd53741f90fc9ea2deb08d7
|
|
| BLAKE2b-256 |
cfbcd1c99635c689e6a36026ab1b78396042986483976242bc5db6706709c4f7
|