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

docs: pymdownx.inlinehilite (via mkdocs-gallery) breaking autorefs #584

Closed
tlambert03 opened this issue Sep 7, 2023 · 6 comments · Fixed by #587
Closed

docs: pymdownx.inlinehilite (via mkdocs-gallery) breaking autorefs #584

tlambert03 opened this issue Sep 7, 2023 · 6 comments · Fixed by #587
Labels
bug Something isn't working

Comments

@tlambert03
Copy link
Member

Hey @GenevieveBuckley,

I just noticed an unfortunate problem with mkdocs-gallery that might require a reversion of #571 . Any mkdocstrings link that uses backticks for formatting like [`magicgui.some.class`][] (which is a lot of them) breaks when mkdocs gallery is enabled, even if it's a file that has nothing to do with an example.

For example on the main widgets page:

with mkdocs-gallery enabled:

Screen Shot 2023-09-07 at 6 42 58 AM

without mkdocs-gallery enabled:

Screen Shot 2023-09-07 at 6 43 32 AM
@tlambert03 tlambert03 added the bug Something isn't working label Sep 7, 2023
@GenevieveBuckley
Copy link
Contributor

Oh noooo 😢

@GenevieveBuckley
Copy link
Contributor

I looked at this problem more today.

  1. I have a PR open to fix the immediate issue in this repository docs: Fix broken mkdocs links #587
  2. I tried figuring out the root cause of the issue, but wasn't able to reproduce it with a more minimal example repository.

See here for the example repository: https://github.com/GenevieveBuckley/test-mkdocs-links
Running mkdocs serve on that doesn't break the hyperlink in the same way we saw here in magicgui.

I originally thought there might be some bad interaction between the mkdocstrings and mkdocs-gallery plugins, but I didn't see that happening here. It's possible there is some sort of funky interaction going on when you make the configuration file more complicated & add more plugins (or add python gallery example scripts, or scripts involving pyqt, etc., etc.). I wonder if it's possibly the gallery_conf.py file, too?

I don't have any more time to dedicate to this, but wanted to share what I had anyway.

@tlambert03
Copy link
Member Author

Thanks so much @GenevieveBuckley, I appreciate you taking a look and the minimal repo is very useful.

I'll take it from here and see what I can figure out

@tlambert03
Copy link
Member Author

ok, I was able to determine that this isn't an issue with mkdocs-gallery per se, but rather the addition of pymdownx.inlinehilite to the markdown_extensions (which mkdocs gallery does implicitly). That breaks mkdocs-autorefs when using code backticks

With this mkdocs config:

site_name: My Docs
markdown_extensions:
  - pymdownx.inlinehilite
plugins:
  - mkdocstrings

I can reproduce the issue on a tiny little docs site:

This breaks:

# Welcome to MkDocs

[`thing.MyClass`][]

::: thing.MyClass

whereas using [thing.MyClass][] works fine.

@tlambert03
Copy link
Member Author

related issue on autorefs here: mkdocstrings/autorefs#34

@tlambert03 tlambert03 changed the title mkdocs-gallery breaking links all over docs docs: pymdownx.inlinehilite (via mkdocs-gallery) breaking autorefs Sep 26, 2023
@GenevieveBuckley
Copy link
Contributor

You narrowed that down impressively fast, nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants