A mkdocs plugin that makes linking to other documents easy.
Project description
mkdocs-ezlinks-plugin
Plugin for mkdocs which enables easier linking between pages.
This plugin was written in order to provide an up-to-date and feature complete plugin for easily referencing documents with a variety of features:
- File name linking (e.g.
[Text](file)
) - Absolute paths (e.g.
[Text](/link/to/file.md)
) - WikiLinks support (e.g.
[[Link]]
)
Install
pip install mkdocs-ezlinks-plugin
Edit your mkdocs configuration file to enable the plugin:
plugins:
- search
- ezlinks
NOTE
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.
Configuration Options
plugins:
- search
- ezlinks:
- wikilinks: {true|false}
- absolute: {true|false}
wikilinks
Determines whether to scan for wikilinks or not (See WikiLink Support).
absolute
Determines whether to translate absolute liks to relative links (see Absolute Links).
NOTE
This plugin does not function well when the 'wikilinks' markdown extension is enabled.
Features
Filename Links
Given a layout such as
- index.md
- folder/
+-- filename.md
+-- image.png
The following links will result in the following translations
Link | Translation |
---|---|
[Link Text](filename) |
[Link Text](folder/filename.md) |
[Link Text](filename#Anchor) |
[Link Text](folder/filename.md#Anchor) |
[Link Text](filename.md) |
[Link Text](folder/filename.md) |
[Link Text](filename.md#Anchor) |
[Link Text](folder/filename.md#Anchor) |
![Image Alt Text](image) |
![Image Alt Text](folder/image.png) |
![Image Alt Text](image.png) |
![Image Alt Text](folder/image.png) |
Absolute Links
Given a layout such as
- static/
+-- image.png
- folder/
+-- document.md
- index.md
Given that we are entering the links into the folder/document.md
file,
Link | Translation |
---|---|
![Link Text](/static/image.png) |
![Link Text](../static/image.png) |
This behavior can be disabled by setting the absolute
property to false
in the mkdocs configuration file.
WikiLink Support
Given a layout such as
- folder1/
+-- main.md
- folder2/
+-- page-name.md
- images/
+-- puppy.png
and these links are entered in folder1/main.md
, this is how wikilinks will be translated
Link | Translation |
---|---|
[[Page Name]] |
[Page Name](../folder2/page-name.md) |
![[Puppy]] |
![Puppy](../images/puppy.png) |
[[Page Name|Link Text]] |
[Link Text](../folder2/page-name.md) |
[[Page Name#Section Heading|Link Text]] |
[Link Text](../folder2/page-name.md#section-heading) |
Attribution
This work is highly inspired from the following plugins:
I have combined some the features of these plugins, fixed several existing bugs, and am adding features in order to provide a cohesive, up-to-date, and maintained solution for the mkdocs community.
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-ezlinks-plugin-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47136dcb7fd2c441fdd1f9fe4b100656a2714c474fd22b89393f9946bebeffc8 |
|
MD5 | d0ebb2489eda36e9cd9562a99fd56b14 |
|
BLAKE2b-256 | 15cf5ad5ca98aa840c93e626037aaf26ca31d52b0952c9922bcf881beddbda24 |
Hashes for mkdocs_ezlinks_plugin-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcc7c75b18730e81660408db055bd15868cd1cee72c238c4238d1ef72dfd1969 |
|
MD5 | 10599bf98f026a4227aad08ae2f1b9c6 |
|
BLAKE2b-256 | 802c6519a7cb92a7d67d92b1f3032a94ba9209e30b469cf499041ab32485317b |