diff --git a/.gitignore b/.gitignore index 671a91c..26c926f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ .cache/ site +docs/all.txt # IDE / Editor .vscode/ diff --git a/hooks/gather.py b/hooks/gather.py new file mode 100644 index 0000000..0ad1d19 --- /dev/null +++ b/hooks/gather.py @@ -0,0 +1,12 @@ +from pathlib import Path + +src_dir = Path("./docs/content") +out_file = Path("./docs/all.txt") + +def gather_md(*args, **kwargs): + md_files = sorted(src_dir.rglob("*.md")) + + with out_file.open("w", encoding="utf-8") as out: + for md in md_files: + out.write(f"\n\n# [{md.relative_to(src_dir)}]\n\n") + out.write(md.read_text(encoding="utf-8")) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index a615881..24d7437 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -83,6 +83,9 @@ plugins: - redirects: redirect_maps: 'index.md': 'content/index.md' + - mkdocs-simple-hooks: + hooks: + on_pre_build: "hooks.gather:gather_md" hooks: - hooks/check.py diff --git a/requirements.txt b/requirements.txt index f83fdbf..ee3eed4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ mkdocs mkdocs-material pymdown-extensions -mkdocs-redirects \ No newline at end of file +mkdocs-redirects +mkdocs-simple-hooks \ No newline at end of file