Creating custom directives

10 views
Skip to first unread message

Robin Liu

unread,
Apr 3, 2022, 11:06:11 PM4/3/22
to sphinx-dev
Is there an existing way to create a duplicate of :param: that's formatted /displays the same way, but renamed to something else (say "states")? So something like:

class temp():
""" temp class

     :param a: ....
     :type a:  ....

     :states state1: ....
     :type state1:  ....
"""

Thanks!

Charles Bouchard-Légaré

unread,
Apr 8, 2022, 9:24:00 PM4/8/22
to sphinx-dev
There might be a simpler way, but by subclassing PyClassLike, probably changing the values of doc_field_types and registering this with app.add_directive_to_domain("py", "class", YourClass, override=True) in a setup(app) fonction in your conf.py, you might get what you want.
Reply all
Reply to author
Forward
0 new messages