mkdocs-section-index icon indicating copy to clipboard operation
mkdocs-section-index copied to clipboard

section-index returns error when using in combination with material's blog plugin

Open thinkORo opened this issue 1 year ago • 2 comments

I want to use "section index" to define my navigation structure with the "literate nav plugin".

Unfortunately in combination with the original mkdocs-material blog plugin I get the following error:

Traceback (most recent call last):
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/mkdocs/livereload/__init__.py", line 211, in _build_loop
    self.builder()
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/mkdocs/commands/build.py", line 299, in build
    nav = config.plugins.on_nav(nav, config=config, files=files)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/mkdocs/plugins.py", line 596, in on_nav
    return self.run_event('nav', nav, config=config, files=files)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/mkdocs/plugins.py", line 566, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/material/plugins/blog/plugin.py", line 187, in on_nav
    for view in self._resolve_views(self.blog):
  File "/home/oro/Program/mambaforge/envs/mkdocs/lib/python3.12/site-packages/material/plugins/blog/plugin.py", line 496, in _resolve_views
    assert isinstance(next, View)
           ^^^^^^^^^^^^^^^^^^^^^^
AssertionError
ERROR   -  [07:16:33] An error happened during the rebuild. The server will appear stuck until build errors are resolved.

First I thought it is an error within mkdocs-material. But Martin from squidfunk pointed me to this plugin. See the original bug report: https://github.com/squidfunk/mkdocs-material/issues/7283

thinkORo avatar Jun 22 '24 03:06 thinkORo

Thanks for taking this upstream. As pointed out in https://github.com/squidfunk/mkdocs-material/issues/7283#issuecomment-2182236581, both plugins extend the page object, which makes them incompatible with each other. I don't think this can be solved in the way MkDocs works, so I recommended asking here for discussion ☺️ Happy to discuss potential solutions so we can make them work together.

squidfunk avatar Jun 22 '24 08:06 squidfunk

Hi everyone,

I just stumbled upon this issue and noticed it was already discussed here. I see that @squidfunk pointed out that the incompatibility is due to both plugins extending the page object, and that it might be difficult to resolve given how MkDocs works.

I was wondering if there have been any updates or potential workarounds discovered since this comment? I'd love to use both plugins together if possible.

Thanks for any insights, and happy to help test if needed!

capjan avatar Dec 07 '24 13:12 capjan