oprypin / mkdocs-gen-files

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

Using markdown snippets with mkdocs-gen-files #25

Closed Oli4 closed 1 year ago

Oli4 commented 1 year ago

I wanted to insert a generated file with markdown snippet syntax --8<--. But it seems as if the files are not found. Probably when trying to include the files content the required pages are not generated yet. Am I missing any configuration or is this just not possible currently.

Best regards

Oli4 commented 1 year ago

I figured that when I create the files instead of using the virtual files the snippet syntax works for the first run. So the order or execution does not seem to be the problem but somehow the snippet extension has no access to the virtual files.

oprypin commented 1 year ago

pymdownx.snippets only looks at real files relative to the current working directory. I just checked and this keeps working even if the reference to a real file is generated with mkdocs-gen-files.

Looking at files relative to the current file is not how pymdownx.snippets works anyway, regardless of whether it's with mkdocs-gen-files or not.

So I think there will be no way to use these two together. However, if you're already using mkdocs_gen_files, you certainly can achieve all the same functionality without also combining it with pymdownx.snippets - just print the content directly.