Fossil SCM

fossil-scm / test / markdown-test3.md
1
2
Markdown Footnotes Test Document
3
================================
4
5
**This document** should help with testing of footnotes support that
6
is introduced by the ["`markdown-footnotes`"][branch] branch.
7
It **might look pretty misformatted unless rendered by the proper Fossil
8
executable** that incorporates the abovementioned branch.[^1]
9
That is also a humble attempt to explore the robustness of the Markdown parser.
10
So please excuse for the mess in the [source code of this document][src].
11
By no means the normal use of footnotes should look that scarry.
12
13
Developers are invited to add test cases here[^here].
14
It is suggested that the more simple is a test case the earlier it should
15
appear in this document.[^ if glitch occurs ]
16
17
18
[^lost3]: This note was defined at the begining of the document.
19
20
[^duplicate]: This came from the begining of the document.
21
22
A footnote's label should be case insensitive[^ case INSENSITIVE ],
23
it is whitespace-savvy and can even contain newlines.[^ a
24
multiline
25
label]
26
27
A labeled footnote may be [referenced several times][^many-refs].
28
29
A footnote's text should support Markdown [markup][^].
30
Markup within [a [text fragment](https://en.wikipedia.org/wiki/Lorem_ipsum)
31
of a *span-bounded footnote*][^markup] should also be rendered.
32
33
Another reference[^many-refs] to the preveously used footnote.
34
35
[^lost2]: This note was defined in the middle of the document.
36
It references [its previous][^lost3]
37
and [the forthcoming][^lost1] siblings.
38
39
[^i am strayed]:
40
This should be presented **verbatim** (without any [markup][^])
41
in the end of the footnotes.
42
43
Default skin renders label in red font and the main text in gray.
44
Other styling may also apply.
45
46
Inline footnotes are supported.(^These may be usefull for adding
47
<s>small</s> comments.)
48
49
This is a corner case that is rendered as [an empty footnote](^ [] ()).
50
51
If [undefined label is used][^] then red "`misref`" is emited instead of
52
a numeric marker.[^ see it yourself ]
53
This can be overridden by the skin though.
54
55
The refenrence at the end of this sentence is the sole reason of
56
rendering of <s>`lost1` and</s> [lost2][^].
57
58
If several labeled footnote definitions have the same equal label then texts
59
from all these definitions are joined.[^duplicate]
60
61
Several references should be recognized as several distinct numbers.
62
(^There should be an interval between numbers.) [^many-refs]
63
64
If markup is ambigous between a span-bounded footnote and
65
a "free-standing" footnote followed by another footnote
66
then interpret as the later case.
67
This facilitates the usage in the usual case
68
when several footnotes are refenrenced at the end
69
of a phrase.[^scipub][^many-refs](^All these four should
70
be parsed as "free-standing" footnotes)[^Coelurosauria]
71
72
An ambiguity between a link to an image and a *free-standing referenced
73
footnote* should be resolved as a footnote![^not-image]
74
75
A footnote may not be empty(^)
76
or consist just of blank characters.(^
77
)
78
79
The same holds for labeled footnotes. If definition of a labeled footnote
80
is blank then it is not accepted by the first pass of the parser and
81
is recognized during the second pass as misreference.
82
[^ This definition consists of just blanks ]:
83
84
85
<style>
86
li.fn-upc-example span.fn-upc {
87
border: solid 2px lightgreen;
88
border-radius: 0.25em;
89
padding-left: 2px;
90
padding-right: 2px;
91
margin-bottom: 0.2em;
92
}
93
li.fn-upc-example span.fn-upcDot:first-child {
94
font-weight: bold;
95
}
96
sup.noteref.fn-upc-example,
97
span.notescope.fn-upc-example sup.noteref {
98
border: solid 2px lightgreen;
99
[^duplicate]:
100
Labeled footnote definition may appear anywhere.
101
That part came from inside of an inline style definition.
102
border-radius: 0.4em;
103
padding: 2px;
104
}
105
sup.noteref.fn-upc-example::after,
106
span.notescope.fn-upc-example sup.noteref::after {
107
content: " ⛄";
108
}
109
sup.noteref.fn-upc-example:hover::after,
110
span.notescope.fn-upc-example sup.noteref:hover::after {
111
content: " 👻";
112
}
113
li.fn-upc-l span.fn-upc {
114
font-size: 60%;
115
color: orange;
116
}
117
li.fn-upc-l span.fn-upc span.fn-upcDot {
118
display: none;
119
}
120
</style>
121
122
It is possible to provide a list of classes for a particular footnote and
123
all its references. This is achieved by prepending a footnote's text with
124
a special token that starts with dot and ends with colon.
125
(^
126
.alpha-Numeric123.EXAMPLE:
127
This token defines a dot-separated list of CSS classes
128
which are added to that particular footnote and also to the
129
corresponding reference(s). Hypens ('-') are also allowed.
130
Classes from the token are tranformed to lowercase and are prepended
131
with `"fn-upc-"` to avoid collisions.
132
)
133
This feature is "*opt-in*": there is nothing wrong in starting a footnote's
134
text with a token of that form while not defining any corresponding classes
135
in the stylesheet.[^nostyle]
136
If a footnote consists just of a valid userclass token then this token
137
is not interpreted as such, instead it is emitted as plain text.
138
(^
139
.bare.classlist.inside.inline.footnote:
140
)[^bare1]
141
[^bare2]
142
143
[^duplicate]: .with.UPC.token:
144
When duplicates are joined their UPC tokens are treated as plain-text.
145
Blank characters between token and main text must be preserved.
146
147
<html>
148
Click
149
<a href="?a=B&quote='&nonASCII=😂&script=<script>alert('Broken!');</script>">
150
here</a> and
151
<a href='?a=B&quote="&nonASCII=😂&script=<script>alert("Broken!");</script>'>
152
here</a>
153
to test escaping of REQUEST_URI in the generated footnote markers.
154
</html>
155
156
A depth of nesting must be limited.
157
(^
158
.L.1: A long chain of nested inline footnotes...
159
(^
160
.L.2: is a rather unusual thing...
161
(^
162
.L.3: and requires extra CPU cycles for processing.
163
(^
164
.L.4: Theoretically speaking O(n<sup>2</sup>).
165
(^
166
.L.5: Thus it is worth dismissing those footnotes...
167
(^
168
.L.6: that are nested deeper than on a certain level.
169
(^
170
.L.7: A particular value for that limit...
171
(^
172
is hard-coded in src/markdown.c ...
173
(^
174
in function `markdown()` ...
175
(^
176
in variable named `maxDepth`.
177
(^
178
For the time being, its value is **5**
179
)
180
)
181
)
182
)
183
)
184
)
185
)
186
)
187
)
188
)
189
)
190
191
## Footnotes
192
193
[branch]: /timeline?r=markdown-footnotes&nowiki
194
195
[^ 1]: Footnotes is a Fossil extension of
196
Markdown. Your other tools may have limited support for these.
197
198
[^here]: [History of test/markdown-test3.md](/finfo/test/markdown-test3.md)
199
200
[src]: /file/test/markdown-test3.md?ci=markdown-footnotes&txt&ln
201
202
[^if glitch occurs]:
203
So that simple cases are processed even if
204
a glitch happens for more tricky cases.
205
206
[^ CASE insensitive ]: And also tolerate whitespaces.
207
208
[^ a multiline label ]: But at a footnote's definition it should still
209
be written within square brackets
210
on a single line.
211
212
[^duplicate]: And that came from the end of the document.
213
214
[^many-refs]:
215
Each letter on the left is a back-reference to the place of use.
216
Highlighted back-reference indicates a place from which navigation
217
occurred[^lost1].
218
219
[^lost1]: This note was defined at the end of the document.
220
It defines an inline note.
221
222
(^This is inline note defined inside of [a labeled note][^lost1].)
223
224
[^markup]: E.g. *emphasis*, and [so on](/md_rules).
225
BTW, this note may not have a backreference to the "stray".
226
227
[^undefined label is used]: For example due to a typo.
228
229
[^not-image]: The rationale is that URLs do not start with **^**
230
while a footnote may follow *immediately* after an exclamation mark
231
at the end of a sentence.
232
233
[^another stray]: Just to verify the correctness of ordering and styling.
234
235
[^scipub]: Which is common in the scientific publications.
236
237
[^bare1]: .at.the.1st.line.of.labeled.footnote.definition:
238
239
240
[^bare2]:
241
.at.the.2nd.line.of.labeled.footnote.definition:
242
243
[^stray with UPC]: .UPC-token:
244
A token of user-provided classes must be rendered within strays.
245
Aslo: this and the previous line may not have extra indentation.
246
247
[^nostyle]:
248
.unused.classes:
249
In that case text of the footnote just looks like as if
250
no special processing occured.
251
252
253
[^ <script>alert("You have been pwned!");</script> ]: Labels are escaped
254
255
[^ <textarea>"Last words here...' ]:
256
<textarea>Content is also escaped</textarea>
257

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button