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

Intersphinx inventory fragment IDs get over-normalized. #1758

Open
ebolyen opened this issue Jan 10, 2025 · 4 comments
Open

Intersphinx inventory fragment IDs get over-normalized. #1758

ebolyen opened this issue Jan 10, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@ebolyen
Copy link

ebolyen commented Jan 10, 2025

Description

It appears that xref:sphinx style link nodes have their url attribute normalized, whereas the original urlSource preserves case.
Here is an example:

<xref:qiime2#qiime2.plugin.Bool>

This correctly matches the intersphinx inventory and myst resolves it, but produces the following AST:

{
    "type": "link",
    "url": "https://develop.qiime2.org/en/latest/plugins/references/api/types.html#qiime2.plugin.bool",
    "position": {
        "start": {
            "line": 5,
            "column": 1
        },
        "end": {
            "line": 5,
            "column": 1
        }
    },
    "children": [
        {
            "type": "text",
            "value": "qiime2",
            "key": "WmC8YrGWys"
        }
    ],
    "urlSource": "xref:qiime2#qiime2.plugin.Bool",
    "internal": false,
    "protocol": "xref:sphinx",
    "key": "PAt4Q0ZuxY"
}

This normalized url does not function as the fragment has changed from Bool to bool.
In the browsers I've checked (Firefox and Chrome), URL fragments are case-sensitive.

Proposed solution

Don't normalize the fragment id under the xref:sphinx protocol.

Additional notes

§ jupyter-book --version
v2.0.0-a0

myst.yml references section

  references:
    qiime2: https://develop.qiime2.org/en/latest/
@ebolyen ebolyen added the bug Something isn't working label Jan 10, 2025
@ebolyen
Copy link
Author

ebolyen commented Jan 10, 2025

Oh and the children property makes it look like this normalization must have happened relatively early, since I would expect something other than the project label to make it into link's text.

@ebolyen
Copy link
Author

ebolyen commented Jan 10, 2025

Looks like it may be this line in the intersphinx package:
https://github.com/continuous-foundation/intersphinx/blob/main/src/intersphinx.ts#L157

It's been that way for a few years, @rowanc1, do you recall the reason for this?

§ intersphinx list https://develop.qiime2.org/en/latest/ --domain py:data --includes Bool
py:data  (qiime2.plugin.Bool)
  https://develop.qiime2.org/en/latest/plugins/references/api/types.html#qiime2.plugin.bool

vs

§ python -m sphinx.ext.intersphinx Downloads/objects.inv | grep -C1 Bool
py:data
    qiime2.plugin.Bool                                                               : plugins/references/api/types.html#qiime2.plugin.Bool
    qiime2.plugin.Categorical                                                        : plugins/references/api/types.html#qiime2.plugin.Categorical

@ebolyen
Copy link
Author

ebolyen commented Jan 11, 2025

I maybe have a fix here: continuous-foundation/intersphinx#5

@rowanc1
Copy link
Member

rowanc1 commented Jan 11, 2025

Thanks @ebolyen - I will take a look monday and get this in!

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

No branches or pull requests

2 participants