Format text in a link in reStructuredText
This construct: Here you have |optparse.OptionParser|_. .. |optparse.OptionParser| replace:: “optparse.OptionParser“ documentation .. _optparse.OptionParser: http://docs.python.org/library/optparse.html produces this HTML (some linebreaks added): <p>Here you have <a class=”reference external” href=”http://docs.python.org/library/optparse.html”> <tt class=”docutils literal”><span class=”pre”>optparse.OptionParser</span></tt> documentation</a>. </p> I realize that this is not exactly what you asked for, but maybe it’s close enough. See also http://docutils.sourceforge.net/FAQ.html#is-nested-inline-markup-possible.