Files
John MacFarlane c8fda8f4d3 RST reader: Use a new one-pass parsing strategy.
Instead of having an initial pass where we collect reference
definitions, we create links with target `##SUBST##something`
or `##REF##something` or `##NOTE##something`, and resolve these
in a pass over the parsed AST.

This allows us to handle link references that are not at the
top level. Closes #10281.
2024-10-13 15:51:05 -06:00

688 B

% pandoc -f rst
`click here`__ or `click here`__

.. _link1: http://www.example.com/
.. _link2: http://johnmacfarlane.net/pandoc/

__ link1_
__ link2_
^D
<p><a href="http://www.example.com/">click here</a> or <a
href="http://johnmacfarlane.net/pandoc/">click here</a></p>

Multiple indirection:

% pandoc -f rst
`click here`__

.. _link1: link2_
.. _link2: http://johnmacfarlane.net/pandoc/

__ link1_
^D
<p><a href="http://johnmacfarlane.net/pandoc/">click here</a></p>

Loop detection:

% pandoc -f rst
`click here`__

.. _link1: link2_
.. _link2: link1_

__ link1_
^D
2> [WARNING] Circular reference 'link1' at line 8 column 1
<p><a href="">click here</a></p>