An MkDocs plugin that adds tooltips to preview the content of page links using tooltipster.
Project description
Fork of midnightprioriem/mkdocs-tooltipster-links-plugin
mkdocs-tooltipster-links-plugin
An MkDocs plugin that adds tooltips to preview the content of page links using tooltipster
Setup
Install the Plugin
Install the plugin using pip:
pip install mkdocs-preview-links-plugin
Activate the plugin in mkdocs.yml:
plugins:
- search
- tooltipster-links
Note: If you have no
pluginsentry in your config file yet, you'll likely also want to add thesearchplugin. MkDocs enables it by default if there is nopluginsentry set, but now you have to enable it explicitly.
More information about plugins in the MkDocs documentation.
Install Tooltipster
Please reference Tooltipster's getting started guide for additional installation instructions.
Download Tooltipster and add the css and javascript to mkdocs.yml:
extra_css:
- css/tooltipster.bundle.min.css
extra_javascript:
- js/tooltipster.bundle.js
Create custom directory and main.html file for overriding the extra_head template block
mkdir theme
touch theme/main.html
Add the following to main.html:
{% extends "base.html" %}
{% block extrahead %}
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$('.link-tooltip').tooltipster();
});
</script>
{% endblock %}
Add the custom directory to mkdocs.yml:
theme:
name: mkdocs
custom_dir: theme
Add additonal css to the site (either in a new css file or existing one):
.tooltipster-base {
max-width: 50%;
}
.tooltipster-content img.wikilink {
max-width: 10%;
}
.tooltip_templates {
display: none;
}
Usage
Once configured property, tooltips-links should create tooltips automagically!
The plugin is not compatible with navigation.instant in Material Theme. For this theme, some styling are disponible in the docs/material.css file.
Custom configuration
In you config file to add compatibility for these plugins :
Just edit your config file and add the following:
plugins:
- search
- tooltipster-links:
callouts: true
custom-attributes: 'assets/css/custom_attributes.css'
Moreover, you can configure the max characters limits and the characters used after truncate (400 used by default):
plugins:
- search
- tooltipster-links:
max-characters: 400 #use 0 or 1 for no limit
truncate-characters: '...'
See Also
More information about templates here.
More information about blocks here.
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-preview-links-plugin-0.6.2.tar.gz.
File metadata
- Download URL: mkdocs-preview-links-plugin-0.6.2.tar.gz
- Upload date:
- Size: 694.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d30194c38d5a2278fca566db789b3541dc8975b925e3a81e501d93faaf5bde22
|
|
| MD5 |
88079137494fa738292f567a765584be
|
|
| BLAKE2b-256 |
f161d216adc6adf4104f32621fe28197e2934ff71dc15ccbf41e7ac27365cc0e
|
File details
Details for the file mkdocs_preview_links_plugin-0.6.2-py3-none-any.whl.
File metadata
- Download URL: mkdocs_preview_links_plugin-0.6.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df9fc1ceecd7de2143e55a682c9fbec5bd83ec637e978b75daa8043f466c7be6
|
|
| MD5 |
c20b657144ce63b1627808ca2a85965e
|
|
| BLAKE2b-256 |
7a581e2afdadaac8f0bf553f0f99fb7ffc5381da2d6ca602912911b054bd3711
|