mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-02 13:45:49 +00:00
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.
44 lines
688 B
Markdown
44 lines
688 B
Markdown
```
|
|
% 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>
|
|
```
|
|
|