on_page_markdown does not include snippet content #2074
-
DescriptionMkDocs' hook for I'm not entirely sure whether this is an issue downstream (here) or upstream (mkdocs), but I'm starting here since you're going to be more familiar with where pymdown-extensions fits into MkDocs and whether you'd expect the current implementation to be subject to the hooks defined by MkDocs. Minimal Reproduction
# docs/README.md
the following content is included
--8<-- "docs/included.md" # docs/included.md
hello, world # mkdocs.yml
...
hooks:
- my_hooks.py
... # my_hooks.py
def on_page_markdown(markdown, page, config, files):
return markdown.replace("hello", "goodbye") Version(s) & System Info
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I'm not exactly sure what the complaint is here. Per the MkDocs documentation it states:
So, it loads the Markdown source, which contains |
Beta Was this translation helpful? Give feedback.
-
Moving to discussions |
Beta Was this translation helpful? Give feedback.
I'm not exactly sure what the complaint is here. Per the MkDocs documentation it states:
So, it loads the Markdown source, which contains
--8<--
and allows you to alter it. What is happening is that the theon_page_markdown
event in MkDocs let's you alter the Markdown source before the Python Markdown parser processes the content, and the Snippets extension is a Python Markdown extension, not a MkDocs plugin. Hopefully that makes sense.