File: implicit_heading_references.md

package info (click to toggle)
haskell-commonmark-extensions 0.2.5.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 368 kB
  • sloc: haskell: 2,574; makefile: 9
file content (69 lines) | stat: -rw-r--r-- 1,527 bytes parent folder | download | duplicates (2)
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
## Implicit heading references (extension)

The `implicit_heading_references` causes headings to create
reference links to themselves.  One can use this
with the `auto_identifiers` extension, which should be
put first in the list of extensions, or one can
define identifiers for the headings manually by
putting an attribute block before the heading.

```````````````````````````````` example
# Heading

See the [Heading] above.
.
<h1 id="heading">Heading</h1>
<p>See the <a href="#heading">Heading</a> above.</p>
````````````````````````````````

```````````````````````````````` example
{#foo}
# Heading

See the [Heading] above.
.
<h1 id="foo">Heading</h1>
<p>See the <a href="#foo">Heading</a> above.</p>
````````````````````````````````

Explicitly defined references take precedence:

```````````````````````````````` example
# Heading

See the [Heading] above.

[Heading]: foo
.
<h1 id="heading">Heading</h1>
<p>See the <a href="foo">Heading</a> above.</p>
````````````````````````````````

When there are two headings with the same text,
the first takes precedence:

```````````````````````````````` example
# Heading

# Heading

See the [Heading] above.
.
<h1 id="heading">Heading</h1>
<h1 id="heading-1">Heading</h1>
<p>See the <a href="#heading">Heading</a> above.</p>
````````````````````````````````

Empty headings don't create implicit references:

```````````````````````````````` example
#

##   

See [] and [   ].
.
<h1 id=""></h1>
<h2 id="-1"></h2>
<p>See [] and [   ].</p>
````````````````````````````````