oprypin / mkdocs-section-index

MkDocs plugin to allow clickable sections that lead to an index page
https://oprypin.github.io/mkdocs-section-index
MIT License
78 stars 8 forks source link

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

Open thinkORo opened 5 months ago

thinkORo commented 5 months ago

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

squidfunk commented 5 months ago

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.