I am creating a custom directive in sphinx. This directive lists all possible objects (each one in separate section).
Now I would like those objects to be referenceable from other parts (files) of documentation.
I was trying to do something very simple like:
class MyDirective(Directive):
def run(self, obj):
id1 = 'object-unique-id1'
id2 = 'object-unique-id2'
label = nodes.label('abc1', refid=id1)
section = nodes.section(ids=[id2])
section += nodes.title(text='abc')
section += label
return [section]
but it doesn't allow me to reference to this section neither by :ref:object-unique-id1
, :ref:object-unique-id2
nor :ref:abc
.
So my question is: How to create node that can be referenced ?