Hash :
a715b884
Author :
Date :
2024-01-16T15:29:35
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
# Wiki Links
With the flag `MD_FLAG_WIKILINKS`, MD4C recognizes wiki links.
The simple wiki-link is a wiki-link destination enclosed in `[[` followed with
`]]`.
```````````````````````````````` example
[[foo]]
.
<p><x-wikilink data-target="foo">foo</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
However wiki-link may contain an explicit label, delimited from the destination
with `|`.
```````````````````````````````` example
[[foo|bar]]
.
<p><x-wikilink data-target="foo">bar</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
A wiki-link destination cannot be empty.
```````````````````````````````` example
[[]]
.
<p>[[]]</p>
.
--fwiki-links
````````````````````````````````
```````````````````````````````` example
[[|foo]]
.
<p>[[|foo]]</p>
.
--fwiki-links
````````````````````````````````
The wiki-link destination cannot contain a new line.
```````````````````````````````` example
[[foo
bar]]
.
<p>[[foo
bar]]</p>
.
--fwiki-links
````````````````````````````````
```````````````````````````````` example
[[foo
bar|baz]]
.
<p>[[foo
bar|baz]]</p>
.
--fwiki-links
````````````````````````````````
The wiki-link destination is rendered verbatim; inline markup in it is not
recognized.
```````````````````````````````` example
[[*foo*]]
.
<p><x-wikilink data-target="*foo*">*foo*</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
```````````````````````````````` example
[[foo|![bar](bar.jpg)]]
.
<p><x-wikilink data-target="foo"><img src="bar.jpg" alt="bar"></x-wikilink></p>
.
--fwiki-links
````````````````````````````````
With multiple `|` delimiters, only the first one is recognized and the other
ones are part of the label.
```````````````````````````````` example
[[foo|bar|baz]]
.
<p><x-wikilink data-target="foo">bar|baz</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
However the delimiter `|` can be escaped with `/`.
```````````````````````````````` example
[[foo\|bar|baz]]
.
<p><x-wikilink data-target="foo|bar">baz</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
The label can contain inline elements.
```````````````````````````````` example
[[foo|*bar*]]
.
<p><x-wikilink data-target="foo"><em>bar</em></x-wikilink></p>
.
--fwiki-links
````````````````````````````````
Empty explicit label is the same as using the implicit label; i.e. the verbatim
destination string is used as the label.
```````````````````````````````` example
[[foo|]]
.
<p><x-wikilink data-target="foo">foo</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
The label can span multiple lines.
```````````````````````````````` example
[[foo|foo
bar
baz]]
.
<p><x-wikilink data-target="foo">foo
bar
baz</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
Wiki-links have higher priority than links.
```````````````````````````````` example
[[foo]](foo.jpg)
.
<p><x-wikilink data-target="foo">foo</x-wikilink>(foo.jpg)</p>
.
--fwiki-links
````````````````````````````````
```````````````````````````````` example
[foo]: /url
[[foo]]
.
<p><x-wikilink data-target="foo">foo</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
Wiki links can be inlined in tables.
```````````````````````````````` example
| A | B |
|------------------|-----|
| [[foo|*bar*]] | baz |
.
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td><x-wikilink data-target="foo"><em>bar</em></x-wikilink></td>
<td>baz</td>
</tr>
</tbody>
</table>
.
--fwiki-links --ftables
````````````````````````````````
Wiki-links are not prioritized over images.
```````````````````````````````` example
![[foo]](foo.jpg)
.
<p><img src="foo.jpg" alt="[foo]"></p>
.
--fwiki-links
````````````````````````````````
Something that may look like a wiki-link at first, but turns out not to be,
is recognized as a normal link.
```````````````````````````````` example
[[foo]
[foo]: /url
.
<p>[<a href="/url">foo</a></p>
.
--fwiki-links
````````````````````````````````
Escaping the opening `[` escapes only that one character, not the whole `[[`
opener:
```````````````````````````````` example
\[[foo]]
[foo]: /url
.
<p>[<a href="/url">foo</a>]</p>
.
--fwiki-links
````````````````````````````````
Like with other inline links, the innermost wiki-link is preferred.
```````````````````````````````` example
[[foo[[bar]]]]
.
<p>[[foo<x-wikilink data-target="bar">bar</x-wikilink>]]</p>
.
--fwiki-links
````````````````````````````````
There is limit of 100 characters for the wiki-link destination.
```````````````````````````````` example
[[12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901]]
[[12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901|foo]]
.
<p>[[12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901]]
[[12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901|foo]]</p>
.
--fwiki-links
````````````````````````````````
100 characters inside a wiki link target works.
```````````````````````````````` example
[[1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890]]
[[1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890|foo]]
.
<p><x-wikilink data-target="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890">1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890</x-wikilink>
<x-wikilink data-target="1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890">foo</x-wikilink></p>
.
--fwiki-links
````````````````````````````````
The limit on link content does not include any characters belonging to a block
quote, if the label spans multiple lines contained in a block quote.
```````````````````````````````` example
> [[12345678901234567890123456789012345678901234567890|1234567890
> 1234567890
> 1234567890
> 1234567890
> 123456789]]
.
<blockquote>
<p><x-wikilink data-target="12345678901234567890123456789012345678901234567890">1234567890
1234567890
1234567890
1234567890
123456789</x-wikilink></p>
</blockquote>
.
--fwiki-links
````````````````````````````````