Skip to content

Commit

Permalink
Use hooks for generating examples (mkdocs 1.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
athackst committed Oct 1, 2022
1 parent 6fdc9b8 commit bb26848
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
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

0 comments on commit bb26848

Please sign in to comment.