Embed File
A way to embed a file present in your docs. Support both wikilinks & normal links. Intended to be used by obsidian user.
Activate the plugin
- Run
pip install mkdocs-embed-file-plugins - Update your
mkdocs.ymlwith :plugins: - search - embed_file
- Override your
main.htmlwith :{% extends "base.html" %} {% block extrahead %} <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/fontawesome.min.css" integrity="sha384-jLKHWM3JRmfMU0A5x5AkjWkw/EYfGUAGagvnfryNV3F9VqM98XiIH7VBGVoxVSc7" crossorigin="anonymous"> {% endblock %}
Usage
| Usage | wikilinks | markdown links |
|---|---|---|
| cite a entire file | ![[filename]] |
 |
| Cite a heading part | ![[filename#heading]] |
 |
| Cite a block | ![[filename#^blockid]] |
 |
CSS
The plugin will create :
- A link to the original file, with the form of :
<a href="original link" class="link_citation"><i class='fas fa-link'></i></a> - A div with the founded content :
<div class="citation">content founded</div> - In case of the link / contents is not found the following block is created instead :
<div class='citation'><a class='link_citation'><i class='fas fa-link'></i></a><p style="text-align: center; display: block"><i class="not_found"> link_alt </i> {a configured message}</p></div>
The message for the not found file can be customized inmkdocs.yml. The default message isfile not exists.
You can add a css in your docs/assets/css (or whatever the path is), and add it to your mkdocs.yml :
extra_css:
- assets/css/embed_link.css
You can find an example of custom css in docs
Configuration
If you want, you can add compatibility with :
To do that, adjust your mkdocs.yml
markdown_extensions:
- attr_list
- nl2br
- admonition
- pymdownx.details
plugins:
- search
- callouts
- custom-attributes:
file: 'assets/css/custom_attributes.css'
- embed_file:
callouts: true
custom-attribute: 'assets/css/custom_attributes.css' //need to be the same as in the config!
language_message: 'file not exists.'
Note : Every extension set in markdown_extensions will be used for the converting, so you can use any extension you want.
Limitation
- The embed file don't use plugin you would use.
- Wikilinks ambiguity are not supported : the first file with the name are used.
Credit
Thanks to midnightprioriem for the tooltip plugin.
Metadata
Release files for mkdocs-embed-file-plugins 2.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_embed_file_plugins-2.0.10.tar.gz | 22.5 kB | Without provenance | Details for mkdocs_embed_file_plugins-2.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_embed_file_plugins-2.0.10-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_embed_file_plugins-2.0.10-py3-none-any.whl |
Total release size: 44.3 kB
Release files / mkdocs_embed_file_plugins-2.0.10.tar.gz
| Download URL | mkdocs_embed_file_plugins-2.0.10.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
091160455be12d91e2eb2c6174db85997b696128561ff645df7db99fe3bb5e68
|
|
BLAKE2b-256 checksum How to use checksums |
6153faaea62f65bb24051328d933a819b497a018dfe73b9a15641f8ebcf1b22e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.0rc2
|
Release files / mkdocs_embed_file_plugins-2.0.10-py3-none-any.whl
| Download URL | mkdocs_embed_file_plugins-2.0.10-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
299a0f65039057a36458b64b62605a469050a7c4db23423e93fb2590a6810b39
|
|
BLAKE2b-256 checksum How to use checksums |
70e29c8984eb3eab675764b0d499a63c05c1c0f66353c0f41e8541f3f13fd451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.0rc2
|
Security for mkdocs-embed-file-plugins 2.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.