Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
OTHER License
Bot releases are hidden (Show)
macro_info()
) areImproved user guide, with introduction of two new pages:
"Controlling macro rendering" and "Post production".
Fixed: (#158) In modules, on_pre_page_macros()
, the env.markdown
attribute is now available to create a header or footer.
Changed: In on_post_page_macros()
use env.markdown
instead of
env.raw_markdown
, for the same purpose.
Added: (#162) Allow opt-in of page rendering, by using parameter
render_macros: true
in yaml header of the page
(requires render_by_default:false
in the macro parameters,
in the config file).
Fixed: macro_info()
now generates a header of category 2,
so as to be used with other material in the same page,
and not confuse the macro generators.
Changed: ignore_macros: true
in page header is deprecated.
Use render_macros: false
instead.
Fixed: issues #155 (documentation type), #143 (git.tab
),
#135 (indicate page where rendering failed).
Published by fralau almost 4 years ago
Now mkdocs-macros has has better integration with the general workflow
Metavariables declared in the YAML header of a markdown page are now directly accessible by macros in the page, without needing to go through the page.meta
object (e.g. if the meta-variable foo
is declared in the YAML header, it can be accessible as {{ foo }}
as well as {{ page.meta.foo }}
. It makes using macros much simpler.
The console messages of mkdocs-macros are now integrated with the standard logging of MkDocs. It means that you can both suppress them (--quiet
option) or expand them to include debug messages (--verbose
).
Macros have their own trace function (chatter()
) which writes into MkDocs' log as Info. If you are using the local server (mkdocs serve
), you can toggle that trace on and off, with a verbose
parameter in the plugin's configuration and this will be instantly reflected on the console.
The Python module can use a new on_post_build()
function, for actions that need to take place after the HTML site directory is built (typically adding or modifying files).
Published by fralau over 4 years ago
The purpose of this new version is to improve the usability and documentation (as in php).
A rendering error no longer stop the mkdocs server, but results in the error and traceback being displayed in the page.
A new command {{ macros_infos() }}
displays detailed information on the environment, and all variables, functions and filters available. This should be the go-to for questions on "is information XY available, and where?".
The config
and page
objects are now included.
To facilitate debugging and documentation, an environment
object is available out of the box, with information of platform and software versions. If the website is under a git repository, the git version is also indicated.
A function now()
has been added for timestamps and other operations related to time.
Let me know how this version works for you.
Published by fralau almost 5 years ago
This is a pre-release version. It contains the following improvements:
{{ % include ... % }}
directivedefine_env()
function.env
argument (the decorator @macro
is replaced by @env.macro
.@env.filter
decorator)env.conf
object.declarare_variables()
is still available though it will become deprecated.build
and serve
commands