I have a section of sphinx doc generated by the sphinx :autoclass: directive
I want to refer to the (docstring) generated doc of a python method from a mystmarkdown file
From
I have tried this:
{:py:meth:}the_module.TheClass.the_method
but the generated doc has no hyperlink, only highlighted the_module.TheClass.the_method
According to the MyST documentation, you would use the following syntax.
{py:meth}`the_module.TheClass.the_method`
If you want to give a shorter name to the method, you have two options.
{py:meth}`the_method <the_module.TheClass.the_method>`
{py:meth}`~the_module.TheClass.the_method`
See Sphinx documentation on [Target specification](https://www.sphinx-doc.org/en/master/usage/domains/python.html#target-specification
Note that the py: in the start is optional.
[the_method](the_module.TheClass.the_method)
The advantage of using the {meth}`foo` (role syntax) is that it keeps the semantic meaning of the link, and applies the required CSS to differentiate it from a regular link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With