Consider the following code:
A link_
.. _link: /folder/MyPage.html
It breaks the page HTML code because wiki links are expanded after the ReStructuredText parser
has generated the HTML code. Word MyPage is assumed to be a wiki name.
There is at least two solutions:
Generate wiki links earlier
Wiki names could be expanded before the HTML code is generated. The text should be parsed line
by line to exclude lines beginning with the ReStructuredText marker for external links (..).
Wiki links would be replaced by a ReStructuredText external link such as:
A WikiName_ here.
.. _WikiName: WikiName
The ReStructuredText parser would generate the right HTML references to Wiki pages.
Normally wiki names inside external link names should not be replaced either. That requires
a smarter parser. For example, in the following code, an extra question mark is appended to
the link because ReStructuredText is considered as a wiki name although it shouldn't be.
A `link to ReStructuredText`_
.. _link to ReStructuredText: rst.html
However there is a workaround in this case:
A `link to !ReStructuredText`_
.. _link to !ReStructuredText: rst.html
Use a HTML parser
If the HTML code is generated first as today, wiki names should be expanded with a HTML
parser such as the standard parser in python. Attributes and text inside tag <a> would
not be considered for wiki link replacement.
This solution is a little bit more complicated but it ensures that the HTML code is always
valid.