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

Add generated_by attribute to page.file #20

Closed timvink closed 1 year ago

timvink commented 1 year ago

This PR adds an attribute to generated files.

Currently, mkdocs-gen-files and mkdocs-git-revision-date-localized-plugin are incompatible.

Using this new attribute, this PR can add support: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/pull/102

More details in https://github.com/timvink/mkdocs-git-revision-date-localized-plugin/issues/101

timvink commented 1 year ago

Can you give me a pointer on how to solve the style error?

mkdocs_gen_files/editor.py:48: error: "File" has no attribute "generated_by"  [attr-defined]
timvink commented 1 year ago

Fixed it.. after a bit of search I released it was a mypy error (I'm not familiar with hatch), # type: ignore fixed it.

timvink commented 1 year ago

This time it was black. I needed to upgrade also.

p.s. A small section on 'contributing' and how to run the hatch commands would be a nice addition :)

timvink commented 1 year ago

Hi @oprypin , any blockers to merging this PR? Seems ready to go :)

pawamoy commented 1 year ago

I'm interested in this as well (would like to to use mkdocs-git-revision-date-localized-plugin :wink:). Let me know if I can be of any help!

oprypin commented 1 year ago

And released. Sorry for the huge delay.

squidfunk commented 11 months ago

Sorry for necroposting, but could we add generated_by to MkDocs' File class? That would allow for better plugin inter-op. Currently, it's added as an anonymous attribute and you can't be sure that it's there. One improvement might be to add the plugin instance to generated_by, so other plugins might even be able to access public state in plugins.