Skip to content

bug: show_symbol_type_toc not working with newest version of Python handler / material theme #158

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

Closed
femtomc opened this issue May 3, 2024 · 17 comments
Assignees

Comments

@femtomc
Copy link

femtomc commented May 3, 2024

Hi!

Description of the bug

I'm using the newest insider's edition of mkdocstrings-python, and I'm attempting to use:

plugins:
  - mkdocstrings:
      enabled: !ENV [ENABLE_MKDOCSTRINGS, true]
      handlers:
        python:
          options:
            show_symbol_type_toc: true

in my documentation (with an admittedly old insider's edition of mkdocs-material). However, the symbols are not rendering in the side ToC.

Expected behavior

I expect the symbol types to show up next to the entries in the side ToC.

Environment information

Here's my exact versioning:

mkdocs                                    1.5.3
mkdocs-autorefs                           1.0.1
mkdocs-git-authors-plugin                 0.7.2
mkdocs-git-committers-plugin-2            1.2.0
mkdocs-git-revision-date-localized-plugin 1.2.5
mkdocs-material                           9.5.4+insiders.4.49.2
mkdocs-material-extensions                1.3.1
mkdocstrings                              0.25.0
mkdocstrings-python                       1.10.0.1.8.2.dev19+g995e505

Additional context

Now, I do have some errors in my documentation -- but all other mkdocstrings-python options work correctly (e.g. show_symbol_type_heading works fine) and I can switch them on and off and build my documentation without issue.

@femtomc femtomc added the unconfirmed This bug was not reproduced yet label May 3, 2024
@pawamoy
Copy link
Member

pawamoy commented May 3, 2024

Try to upgrade your mkdocs-material dependency 🙂

@femtomc
Copy link
Author

femtomc commented May 3, 2024

haha, of course! thank you, sorry for the time waste

@femtomc femtomc closed this as completed May 3, 2024
@pawamoy
Copy link
Member

pawamoy commented May 3, 2024

No problem! Thanks for trying this so quickly 😄

@pawamoy pawamoy removed the unconfirmed This bug was not reproduced yet label May 3, 2024
@femtomc
Copy link
Author

femtomc commented May 4, 2024

@pawamoy Unfortunately, still encountering this with the following (up-to-date) dependencies:

mkdocs-material                           9.5.21+insiders.4.53.8
mkdocs-material-extensions                1.3.1
mkdocstrings                              0.25.0
mkdocstrings-python                       0.1.dev395+g995e505

Here's my full plugin config:

plugins:
  - mkdocstrings:
      enabled: !ENV [ENABLE_MKDOCSTRINGS, true]
      handlers:
        python:
          options:
            show_symbol_type_toc: true
            show_source: true
            show_root_heading: true
            show_root_full_path: true
            show_symbol_type_heading: true
            parameter_headings: true
            separate_signature: true
            signature_crossrefs: true
            show_signature_annotations: true

@femtomc femtomc reopened this May 4, 2024
@pawamoy
Copy link
Member

pawamoy commented May 4, 2024

Oh OK, I thought you confirmed the upgrade fixed the issue. I'll try to replicate.

mkdocstrings-python 0.1.dev395+g995e505: I guess you're installing with git+(https/ssh), from main branch? Try installing from latest tag instead.

@femtomc
Copy link
Author

femtomc commented May 4, 2024

Okay, will try this now!

@femtomc
Copy link
Author

femtomc commented May 4, 2024

Can reproduce same issue with my docs with:

mkdocs-material                           9.5.21+insiders.4.53.8
mkdocs-material-extensions                1.3.1
mkdocstrings                              0.25.0
mkdocstrings-python                       1.10.0.1.8.1

I believe that's the last tagged release of mkdocstrings-python!

Seems plausible I'm messing something up, but all the other features still work!

@pawamoy
Copy link
Member

pawamoy commented May 4, 2024

Thanks for your patience! I'll be able to verify in an hour or so :)

@pawamoy
Copy link
Member

pawamoy commented May 4, 2024

I cannot reproduce the issue 😕

I tried with these dependencies:

Markdown==3.6
mkdocs==1.6.0
mkdocs-material==9.5.19+insiders.4.53.7
mkdocs-material-extensions==1.3.1
mkdocstrings==0.25.0
mkdocstrings-python==1.10.0.1.8.1

...as well as mkdocs-material==9.5.21+insiders.4.53.8 (latest), and in both cases, symbols in the ToC showed up.

@pawamoy
Copy link
Member

pawamoy commented May 4, 2024

If your repository is public, don't hesitate to share it so I can see for myself 🙂 This will allow us to confirm if this is an environment issue. Otherwise, you could try to provide a minimum reproducible example (in a zip file, public Git repo, or just copy-pasted here in code blocks).

@femtomc
Copy link
Author

femtomc commented May 5, 2024

@pawamoy I can invite you to the repo! I think you've helped me out before in this way in the past (thanks for that!) -- if you don't mind doing this, let me know

@pawamoy
Copy link
Member

pawamoy commented May 5, 2024

Sure, lets do that 🙂

@pawamoy
Copy link
Member

pawamoy commented May 5, 2024

Ah, found the issue. I was going insane but it's actually a very simple bug: I wrongly recurse into heading tokens only when a parent heading has its label set by mkdocstrings. When top-level headings are not mkdocstrings headings, it fails, because I never descend into the other headings.

Will push a fix right now 😄 Thanks for your patience again and for giving me access to your repo where the issue was reproducible 😊

@femtomc
Copy link
Author

femtomc commented May 5, 2024

Cool! Awesome that you found the issue, and no problem!

pawamoy added a commit to mkdocstrings/mkdocstrings that referenced this issue May 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Issue-mkdocstrings/python-158: mkdocstrings/python#158
@pawamoy
Copy link
Member

pawamoy commented May 5, 2024

Version 0.25.1 of mkdocstrings is out :)

@femtomc
Copy link
Author

femtomc commented May 5, 2024

Thanks for a rapid response!

@pawamoy
Copy link
Member

pawamoy commented May 5, 2024

Closing, let me know if you have any issue 🙂 Don't forget to remove me from your project ^^

@pawamoy pawamoy closed this as completed May 5, 2024
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

2 participants