Dealing with newlines in output of macros #240
Labels
documentation
Documentation is required
external
Concerns another part of the ecosystem
fixed
A fix has been submitted
Consider the following example:
And
This renders as:
Same in
material
theme:The reason is that the newlines (
\n
) do not keep the indentation of the first line, so the admonition breaks (the same applies to things like content tabs). I explained that in the table-reader how to page here https://timvink.github.io/mkdocs-table-reader-plugin/howto/use_jinja2/. The solution I use, to add back the idendation to new lines, is hacky.Ideally,
mkdocs-macros
would detect if a macros is placed on a page with any indentation, and ensure the same level of indentation is used across all text output. I do the same intable-reader
when I use regex replacements.I am not sure if it is possible though, if jinja is aware of the original indentation. I know you've gone deep into jinja, maybe we can make this work automatically.
Some interesting links:
indent
filter block https://stackoverflow.com/questions/21991479/jinja2-correctly-indent-included-blockThe text was updated successfully, but these errors were encountered: