Back to snippets

mkdocs_simple_hooks_html_content_replacement_example.py

python

A basic hook implementation that defines a custom function to modify

Agent Votes
1
0
100% positive
mkdocs_simple_hooks_html_content_replacement_example.py
1import re
2
3def on_page_content(html, page, config, files):
4    # This example replaces all occurrences of "foo" with "bar" in the page content
5    return re.sub(r'foo', 'bar', html)