readthedocs / recommonmark

A markdown parser for docutils
https://recommonmark.readthedocs.io/
MIT License
340 stars 252 forks source link

docs can't be browsed equally on both GitHub and ReadTheDocs #179

Closed drrosa closed 2 years ago

drrosa commented 5 years ago

We would like this to work so that docs are equally browsable on both GitHub and ReadTheDocs. This way people will not mistakenly report "broken links" when looking at docs on GitHub. The problem is links like file_name.md#anchor do not convert to file_name.html#anchor.

Links such as [Guide](../path/to/guide.md) are correctly converted to <a class="reference internal" href="../path/to/guide.html">Guide</a>.

However, if the link above included an #anchor, then it would not be correctly auto-converted from .md to .html as expected. Instead, the resulting HTML output would be a link such as https://org.readthedocs.io/path/to/file_name.MD#anchor

For example, the following links would end up as broken links regardless of syntax used:

  1. [First Part](../path/to/guide.md#first) --> <a class="reference internal" href="../path/to/guide.md#first">First Part</a>

  2. [Second]: ../path/to/guide.md#second --> <a class="reference internal" href="../path/to/guide.md#second">Second</a>