mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-01 13:15:51 +00:00
Once upon a time the only metadata element for links in Pandoc's AST was a title, and it was hijacked to track certain links as having originated in the wikilink syntax. Now we have Attrs and we can use a class to handle wikilinks instead. Requires coordinated changes to commonmark-hs.
85 lines
1.9 KiB
Markdown
85 lines
1.9 KiB
Markdown
# CommonMark
|
|
|
|
## Reader
|
|
|
|
```
|
|
% pandoc -f commonmark+wikilinks_title_before_pipe -t html --columns 90
|
|
[[https://example.org]]
|
|
|
|
[[title|https://example.org]]
|
|
|
|
[[Name of page]]
|
|
|
|
[[Title|Name of page]]
|
|
^D
|
|
<p><a href="https://example.org" class="wikilink">https://example.org</a></p>
|
|
<p><a href="https://example.org" class="wikilink">title</a></p>
|
|
<p><a href="Name of page" class="wikilink">Name of page</a></p>
|
|
<p><a href="Name of page" class="wikilink">Title</a></p>
|
|
```
|
|
|
|
## Writer
|
|
|
|
```
|
|
% pandoc -t commonmark_x+wikilinks_title_before_pipe -f html
|
|
<p><a href="https://example.org" class="wikilink">https://example.org</a></p>
|
|
<p><a href="https://example.org" class="wikilink">title</a></p>
|
|
<p><a href="Home" class="wikilink">Home</a></p>
|
|
<p><a href="Name of page" class="wikilink">Title</a></p>
|
|
^D
|
|
[[https://example.org]]
|
|
|
|
[[title|https://example.org]]
|
|
|
|
[[Home]]
|
|
|
|
[[Title|Name%20of%20page]]
|
|
```
|
|
|
|
## Regular links should still work
|
|
|
|
```
|
|
% pandoc -f commonmark+wikilinks_title_before_pipe -t html
|
|
[Title](Name%20of%20page)
|
|
^D
|
|
<p><a href="Name%20of%20page">Title</a></p>
|
|
```
|
|
|
|
# Markdown
|
|
|
|
## Reader
|
|
|
|
```
|
|
% pandoc -f markdown+wikilinks_title_before_pipe -t html --columns 90
|
|
[[https://example.org]]
|
|
|
|
[[title|https://example.org]]
|
|
|
|
[[Name of page]]
|
|
|
|
[[Title|Name of page]]
|
|
^D
|
|
<p><a href="https://example.org" class="wikilink">https://example.org</a></p>
|
|
<p><a href="https://example.org" class="wikilink">title</a></p>
|
|
<p><a href="Name of page" class="wikilink">Name of page</a></p>
|
|
<p><a href="Name of page" class="wikilink">Title</a></p>
|
|
```
|
|
|
|
## Writer
|
|
|
|
```
|
|
% pandoc -t markdown+wikilinks_title_before_pipe -f html
|
|
<p><a href="https://example.org" class="wikilink">https://example.org</a></p>
|
|
<p><a href="https://example.org" class="wikilink">title</a></p>
|
|
<p><a href="Home" class="wikilink">Home</a></p>
|
|
<p><a href="Name of page" class="wikilink">Title</a></p>
|
|
^D
|
|
[[https://example.org]]
|
|
|
|
[[title|https://example.org]]
|
|
|
|
[[Home]]
|
|
|
|
[[Title|Name%20of%20page]]
|
|
```
|