Closed johanseland closed 3 years ago
Good point. The solution is to register a domain in the Sphinx extension. Then we can process the cref
database when Sphinx is handling :any:
links (essentially, it enumerates all registered domains and calls Domain.resolve_any_xref
).
Please check the latest commit and let me know if it works for you.
Thanks - I will try it out and give you feedback.
I am happy to report that you patch works exactly as I wanted. Thank you so much and merry Christmas!
Just a little background on my motivation for this. I have some existing markdown material that I wish to cross-refer with Doxygen generated API references. I am using recommonmark for this, and if a markdown link does not matches any known url schemes it will try lookup using the any-role.
One caveat if anyone is stumbling upon this issue; you must ensure that you have set recommonmark.known_url_schemes, if not any C++ namespace entity will be matched as a URL and the lookup will not work.
I personally try to avoid markdown as much as possible, only use reStructruredText -- even for GitHub READMEs ;) And inside RST I also prefer not to use the :any:
role. But I know that the official Sphinx documentation recommends setting :any:
as the default role, so your proposal totally made sense (and wasn't hard to implement).
Closing this issue.
Merry Christmas and Happy New Year to you too!
Would it be possible to ensure that the cref domain is loaded into the list of domains that is searched when using the RST :any: role?
Currently I must either use :cref:
Foo::Bar
orFoo::Bar
if I enable the default role. However, I would like to be able to resolve Doxyrest generated references using e.g. :any:Foo::Bar