a.rst
.. _`__init__`:
|__init__|
.. |__init__| replace:: `some.__init__ <some.pdf#some.__init__>`__
with
rst2html a.rst
produces
Unknown target name: "a.html#__init_".</div>
Unknown target name: "a.html#__init_".</div>
Note, that the last _ of __init__ has been dropped.
I also filed this for pandoc:
https://github.com/jgm/pandoc/issues/5763
The problem is in the embedded link in
some.__init__ <some.pdf#some.__init__>__In an embedded link,
-- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases
You may either escape the last underscore:
or write the target as a recognized URI:
For documents meant to be read in source form, the use of independent block-level hyperlink targets is strongly recommended: