mkdocs-markdownextradata-plugin | MkDocs plugin that injects the mkdocs.yml extra variables | Plugin library
kandi X-RAY | mkdocs-markdownextradata-plugin Summary
kandi X-RAY | mkdocs-markdownextradata-plugin Summary
A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize build files
- Add data to the config
- Applies the title to the given page
- Render a template string
- Read file content
mkdocs-markdownextradata-plugin Key Features
mkdocs-markdownextradata-plugin Examples and Code Snippets
site_name: My fantastic site
plugins:
- search
- markdownextradata
extra:
customer:
name: Your name here
web: www.example.com
salt: salt.example.com
{{ customer.name }}
{{ customer.web }}
plugins:
- search
- markdownextradata:
data: path/to/datafiles
plugins:
- search
- markdownextradata:
data: path/to/datafiles, another/path/to/datafiles
plugins:
- search
- markdownextradata
pip install mkdocs-markdownextradata-plugin
plugins:
- search
- markdownextradata: {}
Community Discussions
Trending Discussions on mkdocs-markdownextradata-plugin
QUESTION
I would like to write a plugin for mkdocs that allows to add a file of custom python code. Here is an example of plugin.
I would like to put the module in the website's main dir, alongside the mkdocs.yml
file, and declare that module in there, e.g.:
ANSWER
Answered 2018-Jun-25 at 17:40The answer depends on which version of MkDocs you are using. In #1376 the path was added to the config object as the attribute config.config_file_path
. However, that won't be available until the next release (1.0). Regardless, earlier versions include an undocumented config option config['config_file_path']
which holds the location of the file. Be careful however, as any undocumented features are subject to change without notice.
As for the location of the Markdown file, that is available in various attributes of the page object passed to the plugin event. You have your pick of page.input_path
, page.output_path
, page.abs_input_path
, and page.abs_output_path
. Again, these are undocumented and subject to change in a future release without notice. In fact, #1504 proposes changing them to page.file.src_path
, page.file.dest_path
, page.file.abs_src_path
, and page.file.abs_dest_path
for the 1.0 release. But that's the risk in working against pre-1.0 software. Things change as the developers try to get it right. The good news is that the 1.0 release will lock these things down going forward.
Full disclosure: I am a member of the MkDocs development team.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mkdocs-markdownextradata-plugin
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page