oprypin / mkdocs-gen-files

MkDocs plugin to programmatically generate documentation pages during the build
https://oprypin.github.io/mkdocs-gen-files
MIT License
107 stars 10 forks source link

Generated docs are missing #32

Open ZhiyuanChen opened 4 months ago

ZhiyuanChen commented 4 months ago

Hi,

Thank you for this work!

I'm a bit lost when trying to use MkDocs-gen-files to build my doc site. Can I ask if you are keen to point out what mistakes I made?

Currently I have the following code in docs/generate.py

import os

import mkdocs_gen_files

def process_file(filename):
    with open(filename) as f:
        content = f.read()
    # headline_index = 0
    # for line in content:
    #     if line.startswith("# "):
    #         break
    #     headline_index += 1
    # content = content[headline_index:]

    filename = os.path.dirname(filename.removeprefix("multimolecule/")) + ".md"

    with mkdocs_gen_files.open(filename, "w") as file:
        print(content, file=file)

    mkdocs_gen_files.set_edit_path(filename, "gen_pages.py")

for root, _dirs, files in os.walk("multimolecule/models"):
    if "README.md" in files:
        process_file(os.path.join(root, "README.md"))

I have inspected that all files are successfully generated under mkdocs_gen_files.directory. But they are missing from then since.

You can find my full code at:

https://github.com/DLS5-Omics/multimolecule/tree/autodoc

The command I used to build the docs is mkdocs build -f docs/mkdocs.yml