How can I make an inline literal with a colon in restructuredText?
I'm trying to document a Python function that returns a dictionary, e.g., something like:
def function(...):
"""
...
Returns:
A dictionary mapping ``{id: {role: value}}``
"""
But when I compile with Sphinx, it complains:
WARNING: Inline literal start-string without end-string.
The literal end-string is certainly there, and it doesn't seem to violate other formatting rules, but I cannot get it to render the literal correctly with the colons (the braces aren't an issue; one: two
is also problematic inside an inline literal). Escaping doesn't help:
""" ``one\: two`` """ --> WARNING
""" ``one\\: two`` """ --> WARNING
r""" ``one\: two`` """ --> WARNING
The only thing that seems to work is a :code:
role:
""" :code:`{one: {two: three}}` """ --> OK
Is this a limitation of Sphinx? Or a bug with docutils? Or is there a way to get colons inside inline literals?