Reputation: 1005
I have a class method with an argument that ends in an underscore, from_
, and I am using autoclass
to generate the documentation for the class. I want the argument from_
to appear as normal text in my Sphinx documentation, but currently it appears as a hyperlink.
Here is a simplified version of the class method with the docstring:
class Twilio:
def get_messages(to=None, from_=None):
"""
Get messages.
`Args:`
to: str
Receiver.
from_: str
Sender.
`Returns:`
Messages: dict
"""
return fetch_messages(to=to, from_=from_)
And I am generating the documentation for this class using:
.. autoclass :: Twilio
:inherited-members:
The problem can be seen in the get_messages
function at the very bottom of this page, you can see that it is formatted as a hyperlink.
Upvotes: 2
Views: 1466
Reputation: 50957
Use a backslash to escape the underscore.
from\_: str
Sender.
Reference: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#escaping-mechanism
Upvotes: 6