all repos — grayfriday @ e078bb8ec34db7cc285f347d24f367b95c909ece

blackfriday fork with a few changes

inline_test.go (view raw)

  1//
  2// Blackfriday Markdown Processor
  3// Available at http://github.com/russross/blackfriday
  4//
  5// Copyright © 2011 Russ Ross <russ@russross.com>.
  6// Distributed under the Simplified BSD License.
  7// See README.md for details.
  8//
  9
 10//
 11// Unit tests for inline parsing
 12//
 13
 14package blackfriday
 15
 16import (
 17	"testing"
 18)
 19
 20func runMarkdownInline(input string, extensions, htmlFlags int) string {
 21	extensions |= EXTENSION_AUTOLINK
 22	extensions |= EXTENSION_STRIKETHROUGH
 23
 24	htmlFlags |= HTML_USE_XHTML
 25
 26	renderer := HtmlRenderer(htmlFlags, "", "")
 27
 28	return string(Markdown([]byte(input), renderer, extensions))
 29}
 30
 31func doTestsInline(t *testing.T, tests []string) {
 32	doTestsInlineParam(t, tests, 0, 0)
 33}
 34
 35func doSafeTestsInline(t *testing.T, tests []string) {
 36	doTestsInlineParam(t, tests, 0, HTML_SAFELINK)
 37}
 38
 39func doTestsInlineParam(t *testing.T, tests []string, extensions, htmlFlags int) {
 40	// catch and report panics
 41	var candidate string
 42	/*
 43		defer func() {
 44			if err := recover(); err != nil {
 45				t.Errorf("\npanic while processing [%#v] (%v)\n", candidate, err)
 46			}
 47		}()
 48	*/
 49
 50	for i := 0; i+1 < len(tests); i += 2 {
 51		input := tests[i]
 52		candidate = input
 53		expected := tests[i+1]
 54		actual := runMarkdownInline(candidate, extensions, htmlFlags)
 55		if actual != expected {
 56			t.Errorf("\nInput   [%#v]\nExpected[%#v]\nActual  [%#v]",
 57				candidate, expected, actual)
 58		}
 59
 60		// now test every substring to stress test bounds checking
 61		if !testing.Short() {
 62			for start := 0; start < len(input); start++ {
 63				for end := start + 1; end <= len(input); end++ {
 64					candidate = input[start:end]
 65					_ = runMarkdownInline(candidate, extensions, htmlFlags)
 66				}
 67			}
 68		}
 69	}
 70}
 71
 72func TestRawHtmlTag(t *testing.T) {
 73	tests := []string{
 74		"zz <style>p {}</style>\n",
 75		"<p>zz p {}</p>\n",
 76
 77		"zz <STYLE>p {}</STYLE>\n",
 78		"<p>zz p {}</p>\n",
 79
 80		"<SCRIPT>alert()</SCRIPT>\n",
 81		"<p>alert()</p>\n",
 82
 83		"zz <SCRIPT>alert()</SCRIPT>\n",
 84		"<p>zz alert()</p>\n",
 85
 86		"zz <script>alert()</script>\n",
 87		"<p>zz alert()</p>\n",
 88
 89		" <script>alert()</script>\n",
 90		"<p>alert()</p>\n",
 91
 92		"<script>alert()</script>\n",
 93		"<p>alert()</p>\n",
 94
 95		"<script src='foo'></script>\n",
 96		"<p></p>\n",
 97
 98		"zz <script src='foo'></script>\n",
 99		"<p>zz </p>\n",
100
101		"zz <script src=foo></script>\n",
102		"<p>zz </p>\n",
103	}
104	doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE|HTML_SKIP_SCRIPT)
105}
106
107func TestEmphasis(t *testing.T) {
108	var tests = []string{
109		"nothing inline\n",
110		"<p>nothing inline</p>\n",
111
112		"simple *inline* test\n",
113		"<p>simple <em>inline</em> test</p>\n",
114
115		"*at the* beginning\n",
116		"<p><em>at the</em> beginning</p>\n",
117
118		"at the *end*\n",
119		"<p>at the <em>end</em></p>\n",
120
121		"*try two* in *one line*\n",
122		"<p><em>try two</em> in <em>one line</em></p>\n",
123
124		"over *two\nlines* test\n",
125		"<p>over <em>two\nlines</em> test</p>\n",
126
127		"odd *number of* markers* here\n",
128		"<p>odd <em>number of</em> markers* here</p>\n",
129
130		"odd *number\nof* markers* here\n",
131		"<p>odd <em>number\nof</em> markers* here</p>\n",
132
133		"simple _inline_ test\n",
134		"<p>simple <em>inline</em> test</p>\n",
135
136		"_at the_ beginning\n",
137		"<p><em>at the</em> beginning</p>\n",
138
139		"at the _end_\n",
140		"<p>at the <em>end</em></p>\n",
141
142		"_try two_ in _one line_\n",
143		"<p><em>try two</em> in <em>one line</em></p>\n",
144
145		"over _two\nlines_ test\n",
146		"<p>over <em>two\nlines</em> test</p>\n",
147
148		"odd _number of_ markers_ here\n",
149		"<p>odd <em>number of</em> markers_ here</p>\n",
150
151		"odd _number\nof_ markers_ here\n",
152		"<p>odd <em>number\nof</em> markers_ here</p>\n",
153
154		"mix of *markers_\n",
155		"<p>mix of *markers_</p>\n",
156	}
157	doTestsInline(t, tests)
158}
159
160func TestStrong(t *testing.T) {
161	var tests = []string{
162		"nothing inline\n",
163		"<p>nothing inline</p>\n",
164
165		"simple **inline** test\n",
166		"<p>simple <strong>inline</strong> test</p>\n",
167
168		"**at the** beginning\n",
169		"<p><strong>at the</strong> beginning</p>\n",
170
171		"at the **end**\n",
172		"<p>at the <strong>end</strong></p>\n",
173
174		"**try two** in **one line**\n",
175		"<p><strong>try two</strong> in <strong>one line</strong></p>\n",
176
177		"over **two\nlines** test\n",
178		"<p>over <strong>two\nlines</strong> test</p>\n",
179
180		"odd **number of** markers** here\n",
181		"<p>odd <strong>number of</strong> markers** here</p>\n",
182
183		"odd **number\nof** markers** here\n",
184		"<p>odd <strong>number\nof</strong> markers** here</p>\n",
185
186		"simple __inline__ test\n",
187		"<p>simple <strong>inline</strong> test</p>\n",
188
189		"__at the__ beginning\n",
190		"<p><strong>at the</strong> beginning</p>\n",
191
192		"at the __end__\n",
193		"<p>at the <strong>end</strong></p>\n",
194
195		"__try two__ in __one line__\n",
196		"<p><strong>try two</strong> in <strong>one line</strong></p>\n",
197
198		"over __two\nlines__ test\n",
199		"<p>over <strong>two\nlines</strong> test</p>\n",
200
201		"odd __number of__ markers__ here\n",
202		"<p>odd <strong>number of</strong> markers__ here</p>\n",
203
204		"odd __number\nof__ markers__ here\n",
205		"<p>odd <strong>number\nof</strong> markers__ here</p>\n",
206
207		"mix of **markers__\n",
208		"<p>mix of **markers__</p>\n",
209	}
210	doTestsInline(t, tests)
211}
212
213func TestEmphasisMix(t *testing.T) {
214	var tests = []string{
215		"***triple emphasis***\n",
216		"<p><strong><em>triple emphasis</em></strong></p>\n",
217
218		"***triple\nemphasis***\n",
219		"<p><strong><em>triple\nemphasis</em></strong></p>\n",
220
221		"___triple emphasis___\n",
222		"<p><strong><em>triple emphasis</em></strong></p>\n",
223
224		"***triple emphasis___\n",
225		"<p>***triple emphasis___</p>\n",
226
227		"*__triple emphasis__*\n",
228		"<p><em><strong>triple emphasis</strong></em></p>\n",
229
230		"__*triple emphasis*__\n",
231		"<p><strong><em>triple emphasis</em></strong></p>\n",
232
233		"**improper *nesting** is* bad\n",
234		"<p><strong>improper *nesting</strong> is* bad</p>\n",
235
236		"*improper **nesting* is** bad\n",
237		"<p><em>improper **nesting</em> is** bad</p>\n",
238	}
239	doTestsInline(t, tests)
240}
241
242func TestStrikeThrough(t *testing.T) {
243	var tests = []string{
244		"nothing inline\n",
245		"<p>nothing inline</p>\n",
246
247		"simple ~~inline~~ test\n",
248		"<p>simple <del>inline</del> test</p>\n",
249
250		"~~at the~~ beginning\n",
251		"<p><del>at the</del> beginning</p>\n",
252
253		"at the ~~end~~\n",
254		"<p>at the <del>end</del></p>\n",
255
256		"~~try two~~ in ~~one line~~\n",
257		"<p><del>try two</del> in <del>one line</del></p>\n",
258
259		"over ~~two\nlines~~ test\n",
260		"<p>over <del>two\nlines</del> test</p>\n",
261
262		"odd ~~number of~~ markers~~ here\n",
263		"<p>odd <del>number of</del> markers~~ here</p>\n",
264
265		"odd ~~number\nof~~ markers~~ here\n",
266		"<p>odd <del>number\nof</del> markers~~ here</p>\n",
267	}
268	doTestsInline(t, tests)
269}
270
271func TestCodeSpan(t *testing.T) {
272	var tests = []string{
273		"`source code`\n",
274		"<p><code>source code</code></p>\n",
275
276		"` source code with spaces `\n",
277		"<p><code>source code with spaces</code></p>\n",
278
279		"` source code with spaces `not here\n",
280		"<p><code>source code with spaces</code>not here</p>\n",
281
282		"a `single marker\n",
283		"<p>a `single marker</p>\n",
284
285		"a single multi-tick marker with ``` no text\n",
286		"<p>a single multi-tick marker with ``` no text</p>\n",
287
288		"markers with ` ` a space\n",
289		"<p>markers with  a space</p>\n",
290
291		"`source code` and a `stray\n",
292		"<p><code>source code</code> and a `stray</p>\n",
293
294		"`source *with* _awkward characters_ in it`\n",
295		"<p><code>source *with* _awkward characters_ in it</code></p>\n",
296
297		"`split over\ntwo lines`\n",
298		"<p><code>split over\ntwo lines</code></p>\n",
299
300		"```multiple ticks``` for the marker\n",
301		"<p><code>multiple ticks</code> for the marker</p>\n",
302
303		"```multiple ticks `with` ticks inside```\n",
304		"<p><code>multiple ticks `with` ticks inside</code></p>\n",
305	}
306	doTestsInline(t, tests)
307}
308
309func TestLineBreak(t *testing.T) {
310	var tests = []string{
311		"this line  \nhas a break\n",
312		"<p>this line<br />\nhas a break</p>\n",
313
314		"this line \ndoes not\n",
315		"<p>this line\ndoes not</p>\n",
316
317		"this has an   \nextra space\n",
318		"<p>this has an<br />\nextra space</p>\n",
319	}
320	doTestsInline(t, tests)
321}
322
323func TestInlineLink(t *testing.T) {
324	var tests = []string{
325		"[foo](/bar/)\n",
326		"<p><a href=\"/bar/\">foo</a></p>\n",
327
328		"[foo with a title](/bar/ \"title\")\n",
329		"<p><a href=\"/bar/\" title=\"title\">foo with a title</a></p>\n",
330
331		"[foo with a title](/bar/\t\"title\")\n",
332		"<p><a href=\"/bar/\" title=\"title\">foo with a title</a></p>\n",
333
334		"[foo with a title](/bar/ \"title\"  )\n",
335		"<p><a href=\"/bar/\" title=\"title\">foo with a title</a></p>\n",
336
337		"[foo with a title](/bar/ title with no quotes)\n",
338		"<p><a href=\"/bar/ title with no quotes\">foo with a title</a></p>\n",
339
340		"[foo]()\n",
341		"<p>[foo]()</p>\n",
342
343		"![foo](/bar/)\n",
344		"<p><img src=\"/bar/\" alt=\"foo\" />\n</p>\n",
345
346		"![foo with a title](/bar/ \"title\")\n",
347		"<p><img src=\"/bar/\" alt=\"foo with a title\" title=\"title\" />\n</p>\n",
348
349		"![foo with a title](/bar/\t\"title\")\n",
350		"<p><img src=\"/bar/\" alt=\"foo with a title\" title=\"title\" />\n</p>\n",
351
352		"![foo with a title](/bar/ \"title\"  )\n",
353		"<p><img src=\"/bar/\" alt=\"foo with a title\" title=\"title\" />\n</p>\n",
354
355		"![foo with a title](/bar/ title with no quotes)\n",
356		"<p><img src=\"/bar/ title with no quotes\" alt=\"foo with a title\" />\n</p>\n",
357
358		"![foo]()\n",
359		"<p>![foo]()</p>\n",
360
361		"[a link]\t(/with_a_tab/)\n",
362		"<p><a href=\"/with_a_tab/\">a link</a></p>\n",
363
364		"[a link]  (/with_spaces/)\n",
365		"<p><a href=\"/with_spaces/\">a link</a></p>\n",
366
367		"[text (with) [[nested] (brackets)]](/url/)\n",
368		"<p><a href=\"/url/\">text (with) [[nested] (brackets)]</a></p>\n",
369
370		"[text (with) [broken nested] (brackets)]](/url/)\n",
371		"<p>[text (with) <a href=\"brackets\">broken nested</a>]](/url/)</p>\n",
372
373		"[text\nwith a newline](/link/)\n",
374		"<p><a href=\"/link/\">text\nwith a newline</a></p>\n",
375
376		"[text in brackets] [followed](/by a link/)\n",
377		"<p>[text in brackets] <a href=\"/by a link/\">followed</a></p>\n",
378
379		"[link with\\] a closing bracket](/url/)\n",
380		"<p><a href=\"/url/\">link with] a closing bracket</a></p>\n",
381
382		"[link with\\[ an opening bracket](/url/)\n",
383		"<p><a href=\"/url/\">link with[ an opening bracket</a></p>\n",
384
385		"[link with\\) a closing paren](/url/)\n",
386		"<p><a href=\"/url/\">link with) a closing paren</a></p>\n",
387
388		"[link with\\( an opening paren](/url/)\n",
389		"<p><a href=\"/url/\">link with( an opening paren</a></p>\n",
390
391		"[link](  with whitespace)\n",
392		"<p><a href=\"with whitespace\">link</a></p>\n",
393
394		"[link](  with whitespace   )\n",
395		"<p><a href=\"with whitespace\">link</a></p>\n",
396
397		"[![image](someimage)](with image)\n",
398		"<p><a href=\"with image\"><img src=\"someimage\" alt=\"image\" />\n</a></p>\n",
399
400		"[link](url \"one quote)\n",
401		"<p><a href=\"url &quot;one quote\">link</a></p>\n",
402
403		"[link](url 'one quote)\n",
404		"<p><a href=\"url 'one quote\">link</a></p>\n",
405
406		"[link](<url>)\n",
407		"<p><a href=\"url\">link</a></p>\n",
408
409		"[link & ampersand](/url/)\n",
410		"<p><a href=\"/url/\">link &amp; ampersand</a></p>\n",
411
412		"[link &amp; ampersand](/url/)\n",
413		"<p><a href=\"/url/\">link &amp; ampersand</a></p>\n",
414
415		"[link](/url/&query)\n",
416		"<p><a href=\"/url/&amp;query\">link</a></p>\n",
417
418		"[[t]](/t)\n",
419		"<p><a href=\"/t\">[t]</a></p>\n",
420	}
421	doTestsInline(t, tests)
422}
423
424func TestNofollowLink(t *testing.T) {
425	var tests = []string{
426		"[foo](/bar/)\n",
427		"<p><a href=\"/bar/\" rel=\"nofollow\">foo</a></p>\n",
428	}
429	doTestsInlineParam(t, tests, 0, HTML_SAFELINK|HTML_NOFOLLOW_LINKS)
430}
431
432func TestSafeInlineLink(t *testing.T) {
433	var tests = []string{
434		"[foo](/bar/)\n",
435		"<p><a href=\"/bar/\">foo</a></p>\n",
436
437		"[foo](http://bar/)\n",
438		"<p><a href=\"http://bar/\">foo</a></p>\n",
439
440		"[foo](https://bar/)\n",
441		"<p><a href=\"https://bar/\">foo</a></p>\n",
442
443		"[foo](ftp://bar/)\n",
444		"<p><a href=\"ftp://bar/\">foo</a></p>\n",
445
446		"[foo](mailto://bar/)\n",
447		"<p><a href=\"mailto://bar/\">foo</a></p>\n",
448
449		// Not considered safe
450		"[foo](baz://bar/)\n",
451		"<p><tt>foo</tt></p>\n",
452	}
453	doSafeTestsInline(t, tests)
454}
455
456func TestReferenceLink(t *testing.T) {
457	var tests = []string{
458		"[link][ref]\n",
459		"<p>[link][ref]</p>\n",
460
461		"[link][ref]\n   [ref]: /url/ \"title\"\n",
462		"<p><a href=\"/url/\" title=\"title\">link</a></p>\n",
463
464		"[link][ref]\n   [ref]: /url/\n",
465		"<p><a href=\"/url/\">link</a></p>\n",
466
467		"   [ref]: /url/\n",
468		"",
469
470		"   [ref]: /url/\n[ref2]: /url/\n [ref3]: /url/\n",
471		"",
472
473		"   [ref]: /url/\n[ref2]: /url/\n [ref3]: /url/\n    [4spaces]: /url/\n",
474		"<pre><code>[4spaces]: /url/\n</code></pre>\n",
475
476		"[hmm](ref2)\n   [ref]: /url/\n[ref2]: /url/\n [ref3]: /url/\n",
477		"<p><a href=\"ref2\">hmm</a></p>\n",
478
479		"[ref]\n",
480		"<p>[ref]</p>\n",
481
482		"[ref]\n   [ref]: /url/ \"title\"\n",
483		"<p><a href=\"/url/\" title=\"title\">ref</a></p>\n",
484	}
485	doTestsInline(t, tests)
486}
487
488func TestTags(t *testing.T) {
489	var tests = []string{
490		"a <span>tag</span>\n",
491		"<p>a <span>tag</span></p>\n",
492
493		"<span>tag</span>\n",
494		"<p><span>tag</span></p>\n",
495
496		"<span>mismatch</spandex>\n",
497		"<p><span>mismatch</spandex></p>\n",
498
499		"a <singleton /> tag\n",
500		"<p>a <singleton /> tag</p>\n",
501	}
502	doTestsInline(t, tests)
503}
504
505func TestAutoLink(t *testing.T) {
506	var tests = []string{
507		"http://foo.com/\n",
508		"<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
509
510		"1 http://foo.com/\n",
511		"<p>1 <a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
512
513		"1http://foo.com/\n",
514		"<p>1<a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
515
516		"1.http://foo.com/\n",
517		"<p>1.<a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
518
519		"1. http://foo.com/\n",
520		"<ol>\n<li><a href=\"http://foo.com/\">http://foo.com/</a></li>\n</ol>\n",
521
522		"-http://foo.com/\n",
523		"<p>-<a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
524
525		"- http://foo.com/\n",
526		"<ul>\n<li><a href=\"http://foo.com/\">http://foo.com/</a></li>\n</ul>\n",
527
528		"_http://foo.com/\n",
529		"<p>_<a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
530
531		"令狐http://foo.com/\n",
532		"<p>令狐<a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
533
534		"令狐 http://foo.com/\n",
535		"<p>令狐 <a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
536
537		"ahttp://foo.com/\n",
538		"<p>ahttp://foo.com/</p>\n",
539
540		">http://foo.com/\n",
541		"<blockquote>\n<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n</blockquote>\n",
542
543		"> http://foo.com/\n",
544		"<blockquote>\n<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n</blockquote>\n",
545
546		"go to <http://foo.com/>\n",
547		"<p>go to <a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
548
549		"a secure <https://link.org>\n",
550		"<p>a secure <a href=\"https://link.org\">https://link.org</a></p>\n",
551
552		"an email <mailto:some@one.com>\n",
553		"<p>an email <a href=\"mailto:some@one.com\">some@one.com</a></p>\n",
554
555		"an email <mailto://some@one.com>\n",
556		"<p>an email <a href=\"mailto://some@one.com\">some@one.com</a></p>\n",
557
558		"an email <some@one.com>\n",
559		"<p>an email <a href=\"mailto:some@one.com\">some@one.com</a></p>\n",
560
561		"an ftp <ftp://old.com>\n",
562		"<p>an ftp <a href=\"ftp://old.com\">ftp://old.com</a></p>\n",
563
564		"an ftp <ftp:old.com>\n",
565		"<p>an ftp <a href=\"ftp:old.com\">ftp:old.com</a></p>\n",
566
567		"a link with <http://new.com?query=foo&bar>\n",
568		"<p>a link with <a href=\"http://new.com?query=foo&amp;bar\">" +
569			"http://new.com?query=foo&amp;bar</a></p>\n",
570
571		"quotes mean a tag <http://new.com?query=\"foo\"&bar>\n",
572		"<p>quotes mean a tag <http://new.com?query=\"foo\"&bar></p>\n",
573
574		"quotes mean a tag <http://new.com?query='foo'&bar>\n",
575		"<p>quotes mean a tag <http://new.com?query='foo'&bar></p>\n",
576
577		"unless escaped <http://new.com?query=\\\"foo\\\"&bar>\n",
578		"<p>unless escaped <a href=\"http://new.com?query=&quot;foo&quot;&amp;bar\">" +
579			"http://new.com?query=&quot;foo&quot;&amp;bar</a></p>\n",
580
581		"even a > can be escaped <http://new.com?q=\\>&etc>\n",
582		"<p>even a &gt; can be escaped <a href=\"http://new.com?q=&gt;&amp;etc\">" +
583			"http://new.com?q=&gt;&amp;etc</a></p>\n",
584	}
585	doTestsInline(t, tests)
586}
587
588func TestFootnotes(t *testing.T) {
589	tests := []string{
590		"testing footnotes.[^a]\n\n[^a]: This is the note\n",
591		`<p>testing footnotes.<sup class="footnote-ref" id="fnref:a"><a rel="footnote" href="#fn:a">1</a></sup></p>
592<div class="footnotes">
593
594<hr />
595
596<ol>
597<li id="fn:a">This is the note
598</li>
599</ol>
600</div>
601`,
602
603		`testing long[^b] notes.
604
605[^b]: Paragraph 1
606
607	Paragraph 2
608	
609	` + "```\n\tsome code\n\t```" + `
610	
611	Paragraph 3
612
613No longer in the footnote
614`,
615		`<p>testing long<sup class="footnote-ref" id="fnref:b"><a rel="footnote" href="#fn:b">1</a></sup> notes.</p>
616
617<p>No longer in the footnote</p>
618<div class="footnotes">
619
620<hr />
621
622<ol>
623<li id="fn:b"><p>Paragraph 1</p>
624
625<p>Paragraph 2</p>
626
627<p><code>
628some code
629</code></p>
630
631<p>Paragraph 3</p>
632</li>
633</ol>
634</div>
635`,
636
637		`testing[^c] multiple[^d] notes.
638
639[^c]: this is [note] c
640
641
642omg
643
644[^d]: this is note d
645
646what happens here
647
648[note]: /link/c
649
650`,
651		`<p>testing<sup class="footnote-ref" id="fnref:c"><a rel="footnote" href="#fn:c">1</a></sup> multiple<sup class="footnote-ref" id="fnref:d"><a rel="footnote" href="#fn:d">2</a></sup> notes.</p>
652
653<p>omg</p>
654
655<p>what happens here</p>
656<div class="footnotes">
657
658<hr />
659
660<ol>
661<li id="fn:c">this is <a href="/link/c">note</a> c
662</li>
663<li id="fn:d">this is note d
664</li>
665</ol>
666</div>
667`,
668
669		"testing inline^[this is the note] notes.\n",
670		`<p>testing inline<sup class="footnote-ref" id="fnref:this-is-the-note"><a rel="footnote" href="#fn:this-is-the-note">1</a></sup> notes.</p>
671<div class="footnotes">
672
673<hr />
674
675<ol>
676<li id="fn:this-is-the-note">this is the note</li>
677</ol>
678</div>
679`,
680
681		"testing multiple[^1] types^[inline note] of notes[^2]\n\n[^2]: the second deferred note\n[^1]: the first deferred note\n\n\twhich happens to be a block\n",
682		`<p>testing multiple<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup> types<sup class="footnote-ref" id="fnref:inline-note"><a rel="footnote" href="#fn:inline-note">2</a></sup> of notes<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">3</a></sup></p>
683<div class="footnotes">
684
685<hr />
686
687<ol>
688<li id="fn:1"><p>the first deferred note</p>
689
690<p>which happens to be a block</p>
691</li>
692<li id="fn:inline-note">inline note</li>
693<li id="fn:2">the second deferred note
694</li>
695</ol>
696</div>
697`,
698
699		`This is a footnote[^1]^[and this is an inline footnote]
700
701[^1]: the footnote text.
702
703    may be multiple paragraphs.
704`,
705		`<p>This is a footnote<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup><sup class="footnote-ref" id="fnref:and-this-is-an-i"><a rel="footnote" href="#fn:and-this-is-an-i">2</a></sup></p>
706<div class="footnotes">
707
708<hr />
709
710<ol>
711<li id="fn:1"><p>the footnote text.</p>
712
713<p>may be multiple paragraphs.</p>
714</li>
715<li id="fn:and-this-is-an-i">and this is an inline footnote</li>
716</ol>
717</div>
718`,
719
720		"empty footnote[^]\n\n[^]: fn text",
721		"<p>empty footnote<sup class=\"footnote-ref\" id=\"fnref:\"><a rel=\"footnote\" href=\"#fn:\">1</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:\">fn text\n</li>\n</ol>\n</div>\n",
722	}
723
724	doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0)
725}