Skip to main content

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

  1. Activate the plugin in your mkdocs.yml:
plugins:
  - frontmatter-url
  1. In your markdown files, add a url field to the frontmatter:
---
title: My Page
gitlab: https://example.com
---

# Welcome to My Page

Content goes here...
  1. The plugin will automatically generate a button with the specified URL after the frontmatter. alt text

  2. To verify if the on_page_markdown function 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_frontmatter_url-0.1.1.tar.gz (12.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_frontmatter_url-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_frontmatter_url-0.1.1.tar.gz.

File metadata

  • Download URL: mkdocs_frontmatter_url-0.1.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for mkdocs_frontmatter_url-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e8b08ebe480104cad59564735975355ffb1ba28caf213cdd5666c1eca30288ae
MD5 7fdc42d1df97343c868e5a1b2bb7cea0
BLAKE2b-256 d7262af1d86f2f2752ddd4bdb74bd31e649b831bd1bcd04a362f0b8d50aca16d

See more details on using hashes here.

File details

Details for the file mkdocs_frontmatter_url-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_frontmatter_url-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dfd0fc4be91354d1ef72db218767b6006152114c615c4c2c6ca7d4549ea00bea
MD5 69c9a31be936a356ee45b89feeac784e
BLAKE2b-256 d8fb6f1ee967e3f071ae0d72fc255168d10ceef4ce33afb7733f15d7712f836e

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