Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hooks for generating examples (mkdocs 1.4) #397

Merged
merged 2 commits into from Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions build.sh
Expand Up @@ -3,13 +3,7 @@ set -e
pip install -r requirements.txt
pip install -e .
# md file="build.snippet" content="^#?\s?(.*)"
# Building this package requires generating the readme files for the examples.
#
# ```bash
./examples/gen_readme.py
# ```
#
# And then using `mkdocs_simple_gen` to generate the site.
# Building this package requires using `mkdocs_simple_gen` to generate the site.
# ```bash
mkdocs_simple_gen --build -- --verbose
# ```
Expand Down
4 changes: 2 additions & 2 deletions examples/gen_readme.py
Expand Up @@ -187,7 +187,7 @@ def output_criteria(path):
os.system(f"rm -rf {folder}/site {folder}/mkdocs.yml")


def generate(*args, **kwargs):
def on_startup(*args, **kwargs):
"""Generate all of the readmes"""
file_loader = FileSystemLoader('.')
env = Environment(loader=file_loader)
Expand All @@ -212,4 +212,4 @@ def include_file(name):


if __name__ == "__main__":
generate()
on_startup()
2 changes: 2 additions & 0 deletions mkdocs.yml
Expand Up @@ -6,6 +6,8 @@ plugins:
- macros
- search
- mike
hooks:
- examples/gen_readme.py
edit_uri: ''
site_url: https://althack.dev/mkdocs-simple-plugin
repo_url: https://github.com/athackst/mkdocs-simple-plugin
Expand Down