Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Page' object has no attribute 'formats' when using mkdocs-print-site-plugin #48

Open
nbanyan opened this issue Nov 13, 2024 · 0 comments

Comments

@nbanyan
Copy link

nbanyan commented Nov 13, 2024

I've also encountered this error with a very large MkDocs project I manage, but I haven't been able to find a minimal way to reproduce this error from that, although I suspect it may be a mismatch between MkDocs' Page collection and the nav list after some large scale of both.
However, enabling the mkdocs-print-site-plugin reliably creates this error.

I found that setting an initializer when formats.pdf.Plugin.on_nav() enumerates the flattened nav resolves this issue. I don't know enough about the rest of the formats code to know if this might cause side effects, but I haven't noticed any yet.

self.pages = flatten(nav)

for index, page in enumerate(self.pages):
  page.index = index
  page.formats = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant