mkdocs_macros_plugin | Create richer and more beautiful pages
kandi X-RAY | mkdocs_macros_plugin Summary
kandi X-RAY | mkdocs_macros_plugin Summary
mkdocs-macros-plugin is a plugin that makes it easier for contributors of an MkDocs website to produce richer and more beautiful pages. It transforms the markdown pages into jinja2 templates that use variables, calls to macros and custom filters. You can also partially replace MkDocs plugins with mkdocs-macros modules, and pluglets (pre-installed modules).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Called when the config is loaded
- Load a Python module
- Log a formatted trace
- Recursively update two dicts
- Load modules
- Define the environment
- Fix urls
- Return whether the given URL is relative
- Format a value
- Render markdown
- Start watcher
- Recursively update a dictionary
mkdocs_macros_plugin Key Features
mkdocs_macros_plugin Examples and Code Snippets
Community Discussions
Trending Discussions on mkdocs_macros_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_macros_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