-
Notifications
You must be signed in to change notification settings - Fork 1
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
The syntax [symbol][]
doesn't work as in mkdocstrings-python
#16
Comments
I just noticed the syntax Footnotes
|
I think that in the case of python standard library definitions like The question is whether the problem is only that you get missing reference errors from the handler but the cross refs still work in the actual documentation. If that is the case, you can workaround this by prepending See https://analog-garage.github.io/mkdocstrings-python-xref/1.6.0/#cross-reference-checking
|
The intent is for all existing cross-references to work the same way as before. So apart from the cross reference checking issue, |
I have strict mode enabled by default, so it errors and stop generating/serving the docs. I disable it and it seems like the link works properly. I also noticed this only fails in class docstrings, for module docstrings it works fine. I would prefer to avoid the syntax It would be very nice if this could somehow work as in the upstream handler, couldn't you just add a special case for the empty string and fall back to the upstream handler when the empty string is used as target? |
The issue is that the upstream handler doesn't check the cross reference when the source is processed. It only checks it later after the source information has been lost which means you get errors saying "can't find reference to 'foo'", which can then require you to search your code for Clearly, there is something different about how the symbol is looked up later. I think that using the full path is perfectly fine but I think there may be some cases where the full path does not work either. And as I said, you will find some libraries where the |
I suppose I could add a special option to disable cross-reference checking for references not translated by this handler but then you would lose the benefit of the source location for error reporting. |
OK, I see. About:
In that case I think it is fair to require the What it is not clear to me is if this extension is providing extra/better checking of cross referencing than the upstream project, so if I disable the checking I will get the exact same checks as the upstream project provides, or will I get no checks at all and might end up with broken links? |
What checking in this handler gives you is the source location of the offending pattern. Using the standard handler, the checking is not done using Griffe but by the generic mkdocstrings renderer which has no access to the source location of the original cross reference specification. So you end up having to grep your code to try to find what is causing the lookup error. Sometimes that can be non trivial. |
Sorry to ask again. I understand that the checker in this extension is more powerful and precise than the upstream checking (with the downside of having this issue), but it is till unclear what happens if I set |
The checks done in this handler are in addition to any that are done upstream so when enabled you can get two errors one with source info and one later on without. If you turn this off, then you only get the upstream errors. |
OK, thanks. I gave this another try with the early checking disabled and it is true that it is quite nice to have the exact file:line of the error. Also this seems to be false:
It seems it have worked with So I wonder if there is a way to add some sort of |
For now the only consistent solution I can find is either using |
Another difference with the upstream handler, even when using |
Also this trick to hook the macros plugin to mkdocstrings doesn't work: But maybe it just needs some adaptation to hook it to this plugin instead. In any case, I think sadly it's too many road bumps for me, so we'll probably need to stick to the upstream handler. I really hope we can eventually switch because using fully qualified names is just too noisy. |
You should be able to just use the standard I wouldn't be surprised if using markup inside the title might not be handled correctly by my code, so if you are really writing:
that might not work. I will look into that and file a separate issue. I don't think I really understand your issue with mkdocs-macros. |
Thanks!
This is the script I'm using to hook with In particular when using the While when using the original Again, I didn't looked into it in details, so maybe I'm just missing updating some part of the script or configuration. |
Yes, |
Thanks. I am not familiar with mkdocs-macros. I will have to spend some time playing with that, but I am not sure when I will have the time... |
I'm trying to migrate a project using mkdocstrings-python to use this handler instead, and I use the syntax
[symbol][]
quite a bit, but it doesn't seem to be working with this handler. In particular I use it a lot to link to Python stdlib symbols, like[asyncio][]
,[float][]
, etc.The text was updated successfully, but these errors were encountered: