An MkDocs plugin allowing links to your pages using a custom alias
Project description
mkdocs-alias-plugin
An MkDocs plugin allowing links to your pages using a custom alias.
The use syntax of the alias is reminiscent of MediaWiki links.
Rationale
I maintain a fairly large wiki and occasionally will restructure parts of it, resulting in many broken links. This plugin allows me to separate the wiki contents from the file system structure and resolves the paths during build time. Maybe this plugin will help you out as well.
Usage
In the meta section atop your page add an alias
section:
---
alias:
name: wuthering-heights
text: Wuthering Heights, a novel by Emily Brontë
---
Then, using the alias in the markdown content of your pages:
The song references [[wuthering-heights]].
If you'd like to supply your own link text instead, you can do so using a pipe to separate it from the alias:
The song references [[wuthering-heights|Wuthering Heights]].
Installation
Install the package with pip:
pip install mkdocs-alias-plugin
Then in your mkdocs.yml
file add the following entry to the plugins section:
plugins:
- alias
Options
You may customize the plugin by passing options in mkdocs.yml:
plugins:
- alias:
verbose: true
verbose
You may use the optional verbose
option to print more information about which aliases were used and defined during build. The default value is false
.
Troubleshooting
My alias not being replaced
Or: WARNING - Alias 'my-alias' not found
The alias could not be found in the defined aliases, usually due to a typo. Enable verbose output in the plugin's configuration to display all of the found aliases.
"Alias already defined"
You're getting a message resembling this in your output:
WARNING - page-url: alias alias-name already defined in other-url, skipping.
Aliases must be unique. Ensure that you're not redefining the same alias for a different page. Rename one of them and the warning should go away.
Local Development
pip install -e /path/to/mkdocs-alias-plugin/
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
Hashes for mkdocs-alias-plugin-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01186cfad05a80d191eb229cda529f91862131d83ed9d7e583a1d7537512fa22 |
|
MD5 | d66dfd85aa09a87ce7324789a245391b |
|
BLAKE2b-256 | 6234765f0bbbc766956a5b0389b3a4abaa030fa6f2eaccdeac957eb56e109698 |
Hashes for mkdocs_alias_plugin-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4717360b1397091520a9910ef5afb0a9673649debab3b89c13d697da81753f46 |
|
MD5 | d75526cb99431eea367c5665ce1a198d |
|
BLAKE2b-256 | 62e0a5a123fbe37d7bc83c0b3088c19239d0d164502850cb5fe2254502a73760 |