We've usually used document.note_explicit_target() and document.note_implicit_target() to register node IDs to document . But they don't support a node having multiple IDs.
from docutils import nodes
document = nodes.document(None, None)
target = nodes.target(ids=['foo', 'bar'])
document.note_explicit_target(target)
assert list(document.ids) == ['foo', 'bar'], document.ids # => foo was not registered
I think all of IDs for the node should be registered into the document.
Any updates? Please let me know if my thought is incorrect.
sorry. for the delay.
I will have a look ... and try to get someone more knowledgable to decide
I applied a version in r8522.
Unfortunately, I supoose that only David may tell whether direct specification of more than one ID could lead to problems later.
Docutils only adds an "alias ID" when merging nodes.
Also mind that IDs must conform to the "identifier normalisation"
https://docutils.sourceforge.io/docs/ref/rst/directives.html#identifier-normalization, so it might be preferable to add "names" instead of "ids" and let Docutils do the rest.
Docutils 0.17 is out.