all repos — grayfriday @ cf01a94556f19b31205611c7aa5f92ddf2381081

blackfriday fork with a few changes

block_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 block parsing
  12//
  13
  14package blackfriday
  15
  16import (
  17	"testing"
  18)
  19
  20func runMarkdownBlock(input string, extensions int) string {
  21	htmlFlags := 0
  22	htmlFlags |= HTML_USE_XHTML
  23
  24	renderer := HtmlRenderer(htmlFlags, "", "")
  25
  26	return string(Markdown([]byte(input), renderer, extensions))
  27}
  28
  29func doTestsBlock(t *testing.T, tests []string, extensions int) {
  30	// catch and report panics
  31	var candidate string
  32	defer func() {
  33		if err := recover(); err != nil {
  34			t.Errorf("\npanic while processing [%#v]\n", candidate)
  35		}
  36	}()
  37
  38	for i := 0; i+1 < len(tests); i += 2 {
  39		input := tests[i]
  40		candidate = input
  41		expected := tests[i+1]
  42		actual := runMarkdownBlock(candidate, extensions)
  43		if actual != expected {
  44			t.Errorf("\nInput   [%#v]\nExpected[%#v]\nActual  [%#v]",
  45				candidate, expected, actual)
  46		}
  47
  48		// now test every substring to stress test bounds checking
  49		if !testing.Short() {
  50			for start := 0; start < len(input); start++ {
  51				for end := start + 1; end <= len(input); end++ {
  52					candidate = input[start:end]
  53					_ = runMarkdownBlock(candidate, extensions)
  54				}
  55			}
  56		}
  57	}
  58}
  59
  60func TestPrefixHeaderNoExtensions(t *testing.T) {
  61	var tests = []string{
  62		"# Header 1\n",
  63		"<h1>Header 1</h1>\n",
  64
  65		"## Header 2\n",
  66		"<h2>Header 2</h2>\n",
  67
  68		"### Header 3\n",
  69		"<h3>Header 3</h3>\n",
  70
  71		"#### Header 4\n",
  72		"<h4>Header 4</h4>\n",
  73
  74		"##### Header 5\n",
  75		"<h5>Header 5</h5>\n",
  76
  77		"###### Header 6\n",
  78		"<h6>Header 6</h6>\n",
  79
  80		"####### Header 7\n",
  81		"<h6># Header 7</h6>\n",
  82
  83		"#Header 1\n",
  84		"<h1>Header 1</h1>\n",
  85
  86		"##Header 2\n",
  87		"<h2>Header 2</h2>\n",
  88
  89		"###Header 3\n",
  90		"<h3>Header 3</h3>\n",
  91
  92		"####Header 4\n",
  93		"<h4>Header 4</h4>\n",
  94
  95		"#####Header 5\n",
  96		"<h5>Header 5</h5>\n",
  97
  98		"######Header 6\n",
  99		"<h6>Header 6</h6>\n",
 100
 101		"#######Header 7\n",
 102		"<h6>#Header 7</h6>\n",
 103
 104		"Hello\n# Header 1\nGoodbye\n",
 105		"<p>Hello</p>\n\n<h1>Header 1</h1>\n\n<p>Goodbye</p>\n",
 106
 107		"* List\n# Header\n* List\n",
 108		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n\n<li><p>List</p></li>\n</ul>\n",
 109
 110		"* List\n#Header\n* List\n",
 111		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n\n<li><p>List</p></li>\n</ul>\n",
 112
 113		"*   List\n    * Nested list\n    # Nested header\n",
 114		"<ul>\n<li><p>List</p>\n\n<ul>\n<li><p>Nested list</p>\n\n" +
 115			"<h1>Nested header</h1></li>\n</ul></li>\n</ul>\n",
 116	}
 117	doTestsBlock(t, tests, 0)
 118}
 119
 120func TestPrefixHeaderSpaceExtension(t *testing.T) {
 121	var tests = []string{
 122		"# Header 1\n",
 123		"<h1>Header 1</h1>\n",
 124
 125		"## Header 2\n",
 126		"<h2>Header 2</h2>\n",
 127
 128		"### Header 3\n",
 129		"<h3>Header 3</h3>\n",
 130
 131		"#### Header 4\n",
 132		"<h4>Header 4</h4>\n",
 133
 134		"##### Header 5\n",
 135		"<h5>Header 5</h5>\n",
 136
 137		"###### Header 6\n",
 138		"<h6>Header 6</h6>\n",
 139
 140		"####### Header 7\n",
 141		"<p>####### Header 7</p>\n",
 142
 143		"#Header 1\n",
 144		"<p>#Header 1</p>\n",
 145
 146		"##Header 2\n",
 147		"<p>##Header 2</p>\n",
 148
 149		"###Header 3\n",
 150		"<p>###Header 3</p>\n",
 151
 152		"####Header 4\n",
 153		"<p>####Header 4</p>\n",
 154
 155		"#####Header 5\n",
 156		"<p>#####Header 5</p>\n",
 157
 158		"######Header 6\n",
 159		"<p>######Header 6</p>\n",
 160
 161		"#######Header 7\n",
 162		"<p>#######Header 7</p>\n",
 163
 164		"Hello\n# Header 1\nGoodbye\n",
 165		"<p>Hello</p>\n\n<h1>Header 1</h1>\n\n<p>Goodbye</p>\n",
 166
 167		"* List\n# Header\n* List\n",
 168		"<ul>\n<li><p>List</p>\n\n<h1>Header</h1></li>\n\n<li><p>List</p></li>\n</ul>\n",
 169
 170		"* List\n#Header\n* List\n",
 171		"<ul>\n<li>List\n#Header</li>\n<li>List</li>\n</ul>\n",
 172
 173		"*   List\n    * Nested list\n    # Nested header\n",
 174		"<ul>\n<li><p>List</p>\n\n<ul>\n<li><p>Nested list</p>\n\n" +
 175			"<h1>Nested header</h1></li>\n</ul></li>\n</ul>\n",
 176	}
 177	doTestsBlock(t, tests, EXTENSION_SPACE_HEADERS)
 178}
 179
 180func TestPrefixHeaderIdExtension(t *testing.T) {
 181	var tests = []string{
 182		"# Header 1 {#someid}\n",
 183		"<h1 id=\"someid\">Header 1</h1>\n",
 184
 185		"# Header 1 {#someid}   \n",
 186		"<h1 id=\"someid\">Header 1</h1>\n",
 187
 188		"# Header 1         {#someid}\n",
 189		"<h1 id=\"someid\">Header 1</h1>\n",
 190
 191		"# Header 1 {#someid\n",
 192		"<h1>Header 1 {#someid</h1>\n",
 193
 194		"## Header 2 {#someid}\n",
 195		"<h2 id=\"someid\">Header 2</h2>\n",
 196
 197		"### Header 3 {#someid}\n",
 198		"<h3 id=\"someid\">Header 3</h3>\n",
 199
 200		"#### Header 4 {#someid}\n",
 201		"<h4 id=\"someid\">Header 4</h4>\n",
 202
 203		"##### Header 5 {#someid}\n",
 204		"<h5 id=\"someid\">Header 5</h5>\n",
 205
 206		"###### Header 6 {#someid}\n",
 207		"<h6 id=\"someid\">Header 6</h6>\n",
 208
 209		"####### Header 7 {#someid}\n",
 210		"<h6 id=\"someid\"># Header 7</h6>\n",
 211
 212		"Hello\n# Header 1\nGoodbye\n",
 213		"<p>Hello</p>\n\n<h1>Header 1</h1>\n\n<p>Goodbye</p>\n",
 214
 215		"* List\n# Header {#someid}\n* List\n",
 216		"<ul>\n<li><p>List</p>\n\n<h1 id=\"someid\">Header</h1></li>\n\n<li><p>List</p></li>\n</ul>\n",
 217
 218		"* List\n#Header {#someid}\n* List\n",
 219		"<ul>\n<li><p>List</p>\n\n<h1 id=\"someid\">Header</h1></li>\n\n<li><p>List</p></li>\n</ul>\n",
 220
 221		"*   List\n    * Nested list\n    # Nested header {#someid}\n",
 222		"<ul>\n<li><p>List</p>\n\n<ul>\n<li><p>Nested list</p>\n\n" +
 223			"<h1 id=\"someid\">Nested header</h1></li>\n</ul></li>\n</ul>\n",
 224	}
 225	doTestsBlock(t, tests, EXTENSION_HEADER_IDS)
 226}
 227
 228func TestUnderlineHeaders(t *testing.T) {
 229	var tests = []string{
 230		"Header 1\n========\n",
 231		"<h1>Header 1</h1>\n",
 232
 233		"Header 2\n--------\n",
 234		"<h2>Header 2</h2>\n",
 235
 236		"A\n=\n",
 237		"<h1>A</h1>\n",
 238
 239		"B\n-\n",
 240		"<h2>B</h2>\n",
 241
 242		"Paragraph\nHeader\n=\n",
 243		"<p>Paragraph</p>\n\n<h1>Header</h1>\n",
 244
 245		"Header\n===\nParagraph\n",
 246		"<h1>Header</h1>\n\n<p>Paragraph</p>\n",
 247
 248		"Header\n===\nAnother header\n---\n",
 249		"<h1>Header</h1>\n\n<h2>Another header</h2>\n",
 250
 251		"   Header\n======\n",
 252		"<h1>Header</h1>\n",
 253
 254		"    Code\n========\n",
 255		"<pre><code>Code\n</code></pre>\n\n<p>========</p>\n",
 256
 257		"Header with *inline*\n=====\n",
 258		"<h1>Header with <em>inline</em></h1>\n",
 259
 260		"*   List\n    * Sublist\n    Not a header\n    ------\n",
 261		"<ul>\n<li>List\n\n<ul>\n<li>Sublist\nNot a header\n------</li>\n</ul></li>\n</ul>\n",
 262
 263		"Paragraph\n\n\n\n\nHeader\n===\n",
 264		"<p>Paragraph</p>\n\n<h1>Header</h1>\n",
 265
 266		"Trailing space \n====        \n\n",
 267		"<h1>Trailing space</h1>\n",
 268
 269		"Trailing spaces\n====        \n\n",
 270		"<h1>Trailing spaces</h1>\n",
 271
 272		"Double underline\n=====\n=====\n",
 273		"<h1>Double underline</h1>\n\n<p>=====</p>\n",
 274	}
 275	doTestsBlock(t, tests, 0)
 276}
 277
 278func TestHorizontalRule(t *testing.T) {
 279	var tests = []string{
 280		"-\n",
 281		"<p>-</p>\n",
 282
 283		"--\n",
 284		"<p>--</p>\n",
 285
 286		"---\n",
 287		"<hr />\n",
 288
 289		"----\n",
 290		"<hr />\n",
 291
 292		"*\n",
 293		"<p>*</p>\n",
 294
 295		"**\n",
 296		"<p>**</p>\n",
 297
 298		"***\n",
 299		"<hr />\n",
 300
 301		"****\n",
 302		"<hr />\n",
 303
 304		"_\n",
 305		"<p>_</p>\n",
 306
 307		"__\n",
 308		"<p>__</p>\n",
 309
 310		"___\n",
 311		"<hr />\n",
 312
 313		"____\n",
 314		"<hr />\n",
 315
 316		"-*-\n",
 317		"<p>-*-</p>\n",
 318
 319		"- - -\n",
 320		"<hr />\n",
 321
 322		"* * *\n",
 323		"<hr />\n",
 324
 325		"_ _ _\n",
 326		"<hr />\n",
 327
 328		"-----*\n",
 329		"<p>-----*</p>\n",
 330
 331		"   ------   \n",
 332		"<hr />\n",
 333
 334		"Hello\n***\n",
 335		"<p>Hello</p>\n\n<hr />\n",
 336
 337		"---\n***\n___\n",
 338		"<hr />\n\n<hr />\n\n<hr />\n",
 339	}
 340	doTestsBlock(t, tests, 0)
 341}
 342
 343func TestUnorderedList(t *testing.T) {
 344	var tests = []string{
 345		"* Hello\n",
 346		"<ul>\n<li>Hello</li>\n</ul>\n",
 347
 348		"* Yin\n* Yang\n",
 349		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 350
 351		"* Ting\n* Bong\n* Goo\n",
 352		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 353
 354		"* Yin\n\n* Yang\n",
 355		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 356
 357		"* Ting\n\n* Bong\n* Goo\n",
 358		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 359
 360		"+ Hello\n",
 361		"<ul>\n<li>Hello</li>\n</ul>\n",
 362
 363		"+ Yin\n+ Yang\n",
 364		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 365
 366		"+ Ting\n+ Bong\n+ Goo\n",
 367		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 368
 369		"+ Yin\n\n+ Yang\n",
 370		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 371
 372		"+ Ting\n\n+ Bong\n+ Goo\n",
 373		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 374
 375		"- Hello\n",
 376		"<ul>\n<li>Hello</li>\n</ul>\n",
 377
 378		"- Yin\n- Yang\n",
 379		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 380
 381		"- Ting\n- Bong\n- Goo\n",
 382		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 383
 384		"- Yin\n\n- Yang\n",
 385		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 386
 387		"- Ting\n\n- Bong\n- Goo\n",
 388		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 389
 390		"*Hello\n",
 391		"<p>*Hello</p>\n",
 392
 393		"*   Hello \n",
 394		"<ul>\n<li>Hello</li>\n</ul>\n",
 395
 396		"*   Hello \n    Next line \n",
 397		"<ul>\n<li>Hello\nNext line</li>\n</ul>\n",
 398
 399		"Paragraph\n* No linebreak\n",
 400		"<p>Paragraph\n* No linebreak</p>\n",
 401
 402		"Paragraph\n\n* Linebreak\n",
 403		"<p>Paragraph</p>\n\n<ul>\n<li>Linebreak</li>\n</ul>\n",
 404
 405		"*   List\n    * Nested list\n",
 406		"<ul>\n<li>List\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
 407
 408		"*   List\n\n    * Nested list\n",
 409		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
 410
 411		"*   List\n    Second line\n\n    + Nested\n",
 412		"<ul>\n<li><p>List\nSecond line</p>\n\n<ul>\n<li>Nested</li>\n</ul></li>\n</ul>\n",
 413
 414		"*   List\n    + Nested\n\n    Continued\n",
 415		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested</li>\n</ul>\n\n<p>Continued</p></li>\n</ul>\n",
 416
 417		"*   List\n   * shallow indent\n",
 418		"<ul>\n<li>List\n\n<ul>\n<li>shallow indent</li>\n</ul></li>\n</ul>\n",
 419
 420		"* List\n" +
 421			" * shallow indent\n" +
 422			"  * part of second list\n" +
 423			"   * still second\n" +
 424			"    * almost there\n" +
 425			"     * third level\n",
 426		"<ul>\n" +
 427			"<li>List\n\n" +
 428			"<ul>\n" +
 429			"<li>shallow indent</li>\n" +
 430			"<li>part of second list</li>\n" +
 431			"<li>still second</li>\n" +
 432			"<li>almost there\n\n" +
 433			"<ul>\n" +
 434			"<li>third level</li>\n" +
 435			"</ul></li>\n" +
 436			"</ul></li>\n" +
 437			"</ul>\n",
 438
 439		"* List\n        extra indent, same paragraph\n",
 440		"<ul>\n<li>List\n    extra indent, same paragraph</li>\n</ul>\n",
 441
 442		"* List\n\n        code block\n",
 443		"<ul>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ul>\n",
 444
 445		"* List\n\n          code block with spaces\n",
 446		"<ul>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ul>\n",
 447
 448		"* List\n\n    * sublist\n\n    normal text\n\n    * another sublist\n",
 449		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>sublist</li>\n</ul>\n\n<p>normal text</p>\n\n<ul>\n<li>another sublist</li>\n</ul></li>\n</ul>\n",
 450	}
 451	doTestsBlock(t, tests, 0)
 452}
 453
 454func TestOrderedList(t *testing.T) {
 455	var tests = []string{
 456		"1. Hello\n",
 457		"<ol>\n<li>Hello</li>\n</ol>\n",
 458
 459		"1. Yin\n2. Yang\n",
 460		"<ol>\n<li>Yin</li>\n<li>Yang</li>\n</ol>\n",
 461
 462		"1. Ting\n2. Bong\n3. Goo\n",
 463		"<ol>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ol>\n",
 464
 465		"1. Yin\n\n2. Yang\n",
 466		"<ol>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ol>\n",
 467
 468		"1. Ting\n\n2. Bong\n3. Goo\n",
 469		"<ol>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ol>\n",
 470
 471		"1 Hello\n",
 472		"<p>1 Hello</p>\n",
 473
 474		"1.Hello\n",
 475		"<p>1.Hello</p>\n",
 476
 477		"1.  Hello \n",
 478		"<ol>\n<li>Hello</li>\n</ol>\n",
 479
 480		"1.  Hello \n    Next line \n",
 481		"<ol>\n<li>Hello\nNext line</li>\n</ol>\n",
 482
 483		"Paragraph\n1. No linebreak\n",
 484		"<p>Paragraph\n1. No linebreak</p>\n",
 485
 486		"Paragraph\n\n1. Linebreak\n",
 487		"<p>Paragraph</p>\n\n<ol>\n<li>Linebreak</li>\n</ol>\n",
 488
 489		"1.  List\n    1. Nested list\n",
 490		"<ol>\n<li>List\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
 491
 492		"1.  List\n\n    1. Nested list\n",
 493		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
 494
 495		"1.  List\n    Second line\n\n    1. Nested\n",
 496		"<ol>\n<li><p>List\nSecond line</p>\n\n<ol>\n<li>Nested</li>\n</ol></li>\n</ol>\n",
 497
 498		"1.  List\n    1. Nested\n\n    Continued\n",
 499		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested</li>\n</ol>\n\n<p>Continued</p></li>\n</ol>\n",
 500
 501		"1.  List\n   1. shallow indent\n",
 502		"<ol>\n<li>List\n\n<ol>\n<li>shallow indent</li>\n</ol></li>\n</ol>\n",
 503
 504		"1. List\n" +
 505			" 1. shallow indent\n" +
 506			"  2. part of second list\n" +
 507			"   3. still second\n" +
 508			"    4. almost there\n" +
 509			"     1. third level\n",
 510		"<ol>\n" +
 511			"<li>List\n\n" +
 512			"<ol>\n" +
 513			"<li>shallow indent</li>\n" +
 514			"<li>part of second list</li>\n" +
 515			"<li>still second</li>\n" +
 516			"<li>almost there\n\n" +
 517			"<ol>\n" +
 518			"<li>third level</li>\n" +
 519			"</ol></li>\n" +
 520			"</ol></li>\n" +
 521			"</ol>\n",
 522
 523		"1. List\n        extra indent, same paragraph\n",
 524		"<ol>\n<li>List\n    extra indent, same paragraph</li>\n</ol>\n",
 525
 526		"1. List\n\n        code block\n",
 527		"<ol>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ol>\n",
 528
 529		"1. List\n\n          code block with spaces\n",
 530		"<ol>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ol>\n",
 531
 532		"1. List\n    * Mixted list\n",
 533		"<ol>\n<li>List\n\n<ul>\n<li>Mixted list</li>\n</ul></li>\n</ol>\n",
 534
 535		"1. List\n * Mixed list\n",
 536		"<ol>\n<li>List\n\n<ul>\n<li>Mixed list</li>\n</ul></li>\n</ol>\n",
 537
 538		"* Start with unordered\n 1. Ordered\n",
 539		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
 540
 541		"* Start with unordered\n    1. Ordered\n",
 542		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
 543
 544		"1. numbers\n1. are ignored\n",
 545		"<ol>\n<li>numbers</li>\n<li>are ignored</li>\n</ol>\n",
 546	}
 547	doTestsBlock(t, tests, 0)
 548}
 549
 550func TestPreformattedHtml(t *testing.T) {
 551	var tests = []string{
 552		"<div></div>\n",
 553		"<div></div>\n",
 554
 555		"<div>\n</div>\n",
 556		"<div>\n</div>\n",
 557
 558		"<div>\n</div>\nParagraph\n",
 559		"<p><div>\n</div>\nParagraph</p>\n",
 560
 561		"<div class=\"foo\">\n</div>\n",
 562		"<div class=\"foo\">\n</div>\n",
 563
 564		"<div>\nAnything here\n</div>\n",
 565		"<div>\nAnything here\n</div>\n",
 566
 567		"<div>\n  Anything here\n</div>\n",
 568		"<div>\n  Anything here\n</div>\n",
 569
 570		"<div>\nAnything here\n  </div>\n",
 571		"<div>\nAnything here\n  </div>\n",
 572
 573		"<div>\nThis is *not* &proceessed\n</div>\n",
 574		"<div>\nThis is *not* &proceessed\n</div>\n",
 575
 576		"<faketag>\n  Something\n</faketag>\n",
 577		"<p><faketag>\n  Something\n</faketag></p>\n",
 578
 579		"<div>\n  Something here\n</divv>\n",
 580		"<p><div>\n  Something here\n</divv></p>\n",
 581
 582		"Paragraph\n<div>\nHere? >&<\n</div>\n",
 583		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div></p>\n",
 584
 585		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n",
 586		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n",
 587
 588		"Paragraph\n<div>\nHere? >&<\n</div>\nAnd here?\n",
 589		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div>\nAnd here?</p>\n",
 590
 591		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\nAnd here?\n",
 592		"<p>Paragraph</p>\n\n<p><div>\nHow about here? &gt;&amp;&lt;\n</div>\nAnd here?</p>\n",
 593
 594		"Paragraph\n<div>\nHere? >&<\n</div>\n\nAnd here?\n",
 595		"<p>Paragraph\n<div>\nHere? &gt;&amp;&lt;\n</div></p>\n\n<p>And here?</p>\n",
 596
 597		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n\nAnd here?\n",
 598		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
 599	}
 600	doTestsBlock(t, tests, 0)
 601}
 602
 603func TestPreformattedHtmlLax(t *testing.T) {
 604	var tests = []string{
 605		"Paragraph\n<div>\nHere? >&<\n</div>\n",
 606		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n",
 607
 608		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n",
 609		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n",
 610
 611		"Paragraph\n<div>\nHere? >&<\n</div>\nAnd here?\n",
 612		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n\n<p>And here?</p>\n",
 613
 614		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\nAnd here?\n",
 615		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
 616
 617		"Paragraph\n<div>\nHere? >&<\n</div>\n\nAnd here?\n",
 618		"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n\n<p>And here?</p>\n",
 619
 620		"Paragraph\n\n<div>\nHow about here? >&<\n</div>\n\nAnd here?\n",
 621		"<p>Paragraph</p>\n\n<div>\nHow about here? >&<\n</div>\n\n<p>And here?</p>\n",
 622	}
 623	doTestsBlock(t, tests, EXTENSION_LAX_HTML_BLOCKS)
 624}
 625
 626func TestFencedCodeBlock(t *testing.T) {
 627	var tests = []string{
 628		"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
 629		"<pre><code class=\"go\">func foo() bool {\n    return true;\n}\n</code></pre>\n",
 630
 631		"``` c\n/* special & char < > \" escaping */\n```\n",
 632		"<pre><code class=\"c\">/* special &amp; char &lt; &gt; &quot; escaping */\n</code></pre>\n",
 633
 634		"``` c\nno *inline* processing ~~of text~~\n```\n",
 635		"<pre><code class=\"c\">no *inline* processing ~~of text~~\n</code></pre>\n",
 636
 637		"```\nNo language\n```\n",
 638		"<pre><code>No language\n</code></pre>\n",
 639
 640		"``` {ocaml}\nlanguage in braces\n```\n",
 641		"<pre><code class=\"ocaml\">language in braces\n</code></pre>\n",
 642
 643		"```    {ocaml}      \nwith extra whitespace\n```\n",
 644		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
 645
 646		"```{   ocaml   }\nwith extra whitespace\n```\n",
 647		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
 648
 649		"~ ~~ java\nWith whitespace\n~~~\n",
 650		"<p>~ ~~ java\nWith whitespace\n~~~</p>\n",
 651
 652		"~~\nonly two\n~~\n",
 653		"<p>~~\nonly two\n~~</p>\n",
 654
 655		"```` python\nextra\n````\n",
 656		"<pre><code class=\"python\">extra\n</code></pre>\n",
 657
 658		"~~~ perl\nthree to start, four to end\n~~~~\n",
 659		"<p>~~~ perl\nthree to start, four to end\n~~~~</p>\n",
 660
 661		"~~~~ perl\nfour to start, three to end\n~~~\n",
 662		"<p>~~~~ perl\nfour to start, three to end\n~~~</p>\n",
 663
 664		"~~~ bash\ntildes\n~~~\n",
 665		"<pre><code class=\"bash\">tildes\n</code></pre>\n",
 666
 667		"``` lisp\nno ending\n",
 668		"<p>``` lisp\nno ending</p>\n",
 669
 670		"~~~ lisp\nend with language\n~~~ lisp\n",
 671		"<p>~~~ lisp\nend with language\n~~~ lisp</p>\n",
 672
 673		"```\nmismatched begin and end\n~~~\n",
 674		"<p>```\nmismatched begin and end\n~~~</p>\n",
 675
 676		"~~~\nmismatched begin and end\n```\n",
 677		"<p>~~~\nmismatched begin and end\n```</p>\n",
 678
 679		"   ``` oz\nleading spaces\n```\n",
 680		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
 681
 682		"  ``` oz\nleading spaces\n ```\n",
 683		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
 684
 685		" ``` oz\nleading spaces\n  ```\n",
 686		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
 687
 688		"``` oz\nleading spaces\n   ```\n",
 689		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
 690
 691		"    ``` oz\nleading spaces\n    ```\n",
 692		"<pre><code>``` oz\n</code></pre>\n\n<p>leading spaces\n    ```</p>\n",
 693	}
 694	doTestsBlock(t, tests, EXTENSION_FENCED_CODE)
 695}
 696
 697func TestTable(t *testing.T) {
 698	var tests = []string{
 699		"a | b\n---|---\nc | d\n",
 700		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n\n" +
 701			"<tbody>\n<tr>\n<td>c</td>\n<td>d</td>\n</tr>\n</tbody>\n</table>\n",
 702
 703		"a | b\n---|--\nc | d\n",
 704		"<p>a | b\n---|--\nc | d</p>\n",
 705
 706		"|a|b|c|d|\n|----|----|----|---|\n|e|f|g|h|\n",
 707		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n<th>d</th>\n</tr>\n</thead>\n\n" +
 708			"<tbody>\n<tr>\n<td>e</td>\n<td>f</td>\n<td>g</td>\n<td>h</td>\n</tr>\n</tbody>\n</table>\n",
 709
 710		"*a*|__b__|[c](C)|d\n---|---|---|---\ne|f|g|h\n",
 711		"<table>\n<thead>\n<tr>\n<th><em>a</em></th>\n<th><strong>b</strong></th>\n<th><a href=\"C\">c</a></th>\n<th>d</th>\n</tr>\n</thead>\n\n" +
 712			"<tbody>\n<tr>\n<td>e</td>\n<td>f</td>\n<td>g</td>\n<td>h</td>\n</tr>\n</tbody>\n</table>\n",
 713
 714		"a|b|c\n---|---|---\nd|e|f\ng|h\ni|j|k|l|m\nn|o|p\n",
 715		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n</tr>\n</thead>\n\n" +
 716			"<tbody>\n<tr>\n<td>d</td>\n<td>e</td>\n<td>f</td>\n</tr>\n\n" +
 717			"<tr>\n<td>g</td>\n<td>h</td>\n<td></td>\n</tr>\n\n" +
 718			"<tr>\n<td>i</td>\n<td>j</td>\n<td>k</td>\n</tr>\n\n" +
 719			"<tr>\n<td>n</td>\n<td>o</td>\n<td>p</td>\n</tr>\n</tbody>\n</table>\n",
 720
 721		"a|b|c\n---|---|---\n*d*|__e__|f\n",
 722		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n</tr>\n</thead>\n\n" +
 723			"<tbody>\n<tr>\n<td><em>d</em></td>\n<td><strong>e</strong></td>\n<td>f</td>\n</tr>\n</tbody>\n</table>\n",
 724
 725		"a|b|c|d\n:--|--:|:-:|---\ne|f|g|h\n",
 726		"<table>\n<thead>\n<tr>\n<th align=\"left\">a</th>\n<th align=\"right\">b</th>\n" +
 727			"<th align=\"center\">c</th>\n<th>d</th>\n</tr>\n</thead>\n\n" +
 728			"<tbody>\n<tr>\n<td align=\"left\">e</td>\n<td align=\"right\">f</td>\n" +
 729			"<td align=\"center\">g</td>\n<td>h</td>\n</tr>\n</tbody>\n</table>\n",
 730
 731		"a|b|c\n---|---|---\n",
 732		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n</tr>\n</thead>\n\n<tbody>\n</tbody>\n</table>\n",
 733
 734		"a| b|c | d | e\n---|---|---|---|---\nf| g|h | i |j\n",
 735		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n<th>d</th>\n<th>e</th>\n</tr>\n</thead>\n\n" +
 736			"<tbody>\n<tr>\n<td>f</td>\n<td>g</td>\n<td>h</td>\n<td>i</td>\n<td>j</td>\n</tr>\n</tbody>\n</table>\n",
 737
 738		"a|b\\|c|d\n---|---|---\nf|g\\|h|i\n",
 739		"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b|c</th>\n<th>d</th>\n</tr>\n</thead>\n\n<tbody>\n<tr>\n<td>f</td>\n<td>g|h</td>\n<td>i</td>\n</tr>\n</tbody>\n</table>\n",
 740	}
 741	doTestsBlock(t, tests, EXTENSION_TABLES)
 742}
 743
 744func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
 745	var tests = []string{
 746		"* Hello\n",
 747		"<ul>\n<li>Hello</li>\n</ul>\n",
 748
 749		"* Yin\n* Yang\n",
 750		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 751
 752		"* Ting\n* Bong\n* Goo\n",
 753		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 754
 755		"* Yin\n\n* Yang\n",
 756		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 757
 758		"* Ting\n\n* Bong\n* Goo\n",
 759		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 760
 761		"+ Hello\n",
 762		"<ul>\n<li>Hello</li>\n</ul>\n",
 763
 764		"+ Yin\n+ Yang\n",
 765		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 766
 767		"+ Ting\n+ Bong\n+ Goo\n",
 768		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 769
 770		"+ Yin\n\n+ Yang\n",
 771		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 772
 773		"+ Ting\n\n+ Bong\n+ Goo\n",
 774		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 775
 776		"- Hello\n",
 777		"<ul>\n<li>Hello</li>\n</ul>\n",
 778
 779		"- Yin\n- Yang\n",
 780		"<ul>\n<li>Yin</li>\n<li>Yang</li>\n</ul>\n",
 781
 782		"- Ting\n- Bong\n- Goo\n",
 783		"<ul>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ul>\n",
 784
 785		"- Yin\n\n- Yang\n",
 786		"<ul>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ul>\n",
 787
 788		"- Ting\n\n- Bong\n- Goo\n",
 789		"<ul>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ul>\n",
 790
 791		"*Hello\n",
 792		"<p>*Hello</p>\n",
 793
 794		"*   Hello \n",
 795		"<ul>\n<li>Hello</li>\n</ul>\n",
 796
 797		"*   Hello \n    Next line \n",
 798		"<ul>\n<li>Hello\nNext line</li>\n</ul>\n",
 799
 800		"Paragraph\n* No linebreak\n",
 801		"<p>Paragraph</p>\n\n<ul>\n<li>No linebreak</li>\n</ul>\n",
 802
 803		"Paragraph\n\n* Linebreak\n",
 804		"<p>Paragraph</p>\n\n<ul>\n<li>Linebreak</li>\n</ul>\n",
 805
 806		"*   List\n    * Nested list\n",
 807		"<ul>\n<li>List\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
 808
 809		"*   List\n\n    * Nested list\n",
 810		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested list</li>\n</ul></li>\n</ul>\n",
 811
 812		"*   List\n    Second line\n\n    + Nested\n",
 813		"<ul>\n<li><p>List\nSecond line</p>\n\n<ul>\n<li>Nested</li>\n</ul></li>\n</ul>\n",
 814
 815		"*   List\n    + Nested\n\n    Continued\n",
 816		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>Nested</li>\n</ul>\n\n<p>Continued</p></li>\n</ul>\n",
 817
 818		"*   List\n   * shallow indent\n",
 819		"<ul>\n<li>List\n\n<ul>\n<li>shallow indent</li>\n</ul></li>\n</ul>\n",
 820
 821		"* List\n" +
 822			" * shallow indent\n" +
 823			"  * part of second list\n" +
 824			"   * still second\n" +
 825			"    * almost there\n" +
 826			"     * third level\n",
 827		"<ul>\n" +
 828			"<li>List\n\n" +
 829			"<ul>\n" +
 830			"<li>shallow indent</li>\n" +
 831			"<li>part of second list</li>\n" +
 832			"<li>still second</li>\n" +
 833			"<li>almost there\n\n" +
 834			"<ul>\n" +
 835			"<li>third level</li>\n" +
 836			"</ul></li>\n" +
 837			"</ul></li>\n" +
 838			"</ul>\n",
 839
 840		"* List\n        extra indent, same paragraph\n",
 841		"<ul>\n<li>List\n    extra indent, same paragraph</li>\n</ul>\n",
 842
 843		"* List\n\n        code block\n",
 844		"<ul>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ul>\n",
 845
 846		"* List\n\n          code block with spaces\n",
 847		"<ul>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ul>\n",
 848
 849		"* List\n\n    * sublist\n\n    normal text\n\n    * another sublist\n",
 850		"<ul>\n<li><p>List</p>\n\n<ul>\n<li>sublist</li>\n</ul>\n\n<p>normal text</p>\n\n<ul>\n<li>another sublist</li>\n</ul></li>\n</ul>\n",
 851	}
 852	doTestsBlock(t, tests, EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
 853}
 854
 855func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
 856	var tests = []string{
 857		"1. Hello\n",
 858		"<ol>\n<li>Hello</li>\n</ol>\n",
 859
 860		"1. Yin\n2. Yang\n",
 861		"<ol>\n<li>Yin</li>\n<li>Yang</li>\n</ol>\n",
 862
 863		"1. Ting\n2. Bong\n3. Goo\n",
 864		"<ol>\n<li>Ting</li>\n<li>Bong</li>\n<li>Goo</li>\n</ol>\n",
 865
 866		"1. Yin\n\n2. Yang\n",
 867		"<ol>\n<li><p>Yin</p></li>\n\n<li><p>Yang</p></li>\n</ol>\n",
 868
 869		"1. Ting\n\n2. Bong\n3. Goo\n",
 870		"<ol>\n<li><p>Ting</p></li>\n\n<li><p>Bong</p></li>\n\n<li><p>Goo</p></li>\n</ol>\n",
 871
 872		"1 Hello\n",
 873		"<p>1 Hello</p>\n",
 874
 875		"1.Hello\n",
 876		"<p>1.Hello</p>\n",
 877
 878		"1.  Hello \n",
 879		"<ol>\n<li>Hello</li>\n</ol>\n",
 880
 881		"1.  Hello \n    Next line \n",
 882		"<ol>\n<li>Hello\nNext line</li>\n</ol>\n",
 883
 884		"Paragraph\n1. No linebreak\n",
 885		"<p>Paragraph</p>\n\n<ol>\n<li>No linebreak</li>\n</ol>\n",
 886
 887		"Paragraph\n\n1. Linebreak\n",
 888		"<p>Paragraph</p>\n\n<ol>\n<li>Linebreak</li>\n</ol>\n",
 889
 890		"1.  List\n    1. Nested list\n",
 891		"<ol>\n<li>List\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
 892
 893		"1.  List\n\n    1. Nested list\n",
 894		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested list</li>\n</ol></li>\n</ol>\n",
 895
 896		"1.  List\n    Second line\n\n    1. Nested\n",
 897		"<ol>\n<li><p>List\nSecond line</p>\n\n<ol>\n<li>Nested</li>\n</ol></li>\n</ol>\n",
 898
 899		"1.  List\n    1. Nested\n\n    Continued\n",
 900		"<ol>\n<li><p>List</p>\n\n<ol>\n<li>Nested</li>\n</ol>\n\n<p>Continued</p></li>\n</ol>\n",
 901
 902		"1.  List\n   1. shallow indent\n",
 903		"<ol>\n<li>List\n\n<ol>\n<li>shallow indent</li>\n</ol></li>\n</ol>\n",
 904
 905		"1. List\n" +
 906			" 1. shallow indent\n" +
 907			"  2. part of second list\n" +
 908			"   3. still second\n" +
 909			"    4. almost there\n" +
 910			"     1. third level\n",
 911		"<ol>\n" +
 912			"<li>List\n\n" +
 913			"<ol>\n" +
 914			"<li>shallow indent</li>\n" +
 915			"<li>part of second list</li>\n" +
 916			"<li>still second</li>\n" +
 917			"<li>almost there\n\n" +
 918			"<ol>\n" +
 919			"<li>third level</li>\n" +
 920			"</ol></li>\n" +
 921			"</ol></li>\n" +
 922			"</ol>\n",
 923
 924		"1. List\n        extra indent, same paragraph\n",
 925		"<ol>\n<li>List\n    extra indent, same paragraph</li>\n</ol>\n",
 926
 927		"1. List\n\n        code block\n",
 928		"<ol>\n<li><p>List</p>\n\n<pre><code>code block\n</code></pre></li>\n</ol>\n",
 929
 930		"1. List\n\n          code block with spaces\n",
 931		"<ol>\n<li><p>List</p>\n\n<pre><code>  code block with spaces\n</code></pre></li>\n</ol>\n",
 932
 933		"1. List\n    * Mixted list\n",
 934		"<ol>\n<li>List\n\n<ul>\n<li>Mixted list</li>\n</ul></li>\n</ol>\n",
 935
 936		"1. List\n * Mixed list\n",
 937		"<ol>\n<li>List\n\n<ul>\n<li>Mixed list</li>\n</ul></li>\n</ol>\n",
 938
 939		"* Start with unordered\n 1. Ordered\n",
 940		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
 941
 942		"* Start with unordered\n    1. Ordered\n",
 943		"<ul>\n<li>Start with unordered\n\n<ol>\n<li>Ordered</li>\n</ol></li>\n</ul>\n",
 944
 945		"1. numbers\n1. are ignored\n",
 946		"<ol>\n<li>numbers</li>\n<li>are ignored</li>\n</ol>\n",
 947	}
 948	doTestsBlock(t, tests, EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
 949}
 950
 951func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
 952	var tests = []string{
 953		"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
 954		"<pre><code class=\"go\">func foo() bool {\n    return true;\n}\n</code></pre>\n",
 955
 956		"``` c\n/* special & char < > \" escaping */\n```\n",
 957		"<pre><code class=\"c\">/* special &amp; char &lt; &gt; &quot; escaping */\n</code></pre>\n",
 958
 959		"``` c\nno *inline* processing ~~of text~~\n```\n",
 960		"<pre><code class=\"c\">no *inline* processing ~~of text~~\n</code></pre>\n",
 961
 962		"```\nNo language\n```\n",
 963		"<pre><code>No language\n</code></pre>\n",
 964
 965		"``` {ocaml}\nlanguage in braces\n```\n",
 966		"<pre><code class=\"ocaml\">language in braces\n</code></pre>\n",
 967
 968		"```    {ocaml}      \nwith extra whitespace\n```\n",
 969		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
 970
 971		"```{   ocaml   }\nwith extra whitespace\n```\n",
 972		"<pre><code class=\"ocaml\">with extra whitespace\n</code></pre>\n",
 973
 974		"~ ~~ java\nWith whitespace\n~~~\n",
 975		"<p>~ ~~ java\nWith whitespace\n~~~</p>\n",
 976
 977		"~~\nonly two\n~~\n",
 978		"<p>~~\nonly two\n~~</p>\n",
 979
 980		"```` python\nextra\n````\n",
 981		"<pre><code class=\"python\">extra\n</code></pre>\n",
 982
 983		"~~~ perl\nthree to start, four to end\n~~~~\n",
 984		"<p>~~~ perl\nthree to start, four to end\n~~~~</p>\n",
 985
 986		"~~~~ perl\nfour to start, three to end\n~~~\n",
 987		"<p>~~~~ perl\nfour to start, three to end\n~~~</p>\n",
 988
 989		"~~~ bash\ntildes\n~~~\n",
 990		"<pre><code class=\"bash\">tildes\n</code></pre>\n",
 991
 992		"``` lisp\nno ending\n",
 993		"<p>``` lisp\nno ending</p>\n",
 994
 995		"~~~ lisp\nend with language\n~~~ lisp\n",
 996		"<p>~~~ lisp\nend with language\n~~~ lisp</p>\n",
 997
 998		"```\nmismatched begin and end\n~~~\n",
 999		"<p>```\nmismatched begin and end\n~~~</p>\n",
1000
1001		"~~~\nmismatched begin and end\n```\n",
1002		"<p>~~~\nmismatched begin and end\n```</p>\n",
1003
1004		"   ``` oz\nleading spaces\n```\n",
1005		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
1006
1007		"  ``` oz\nleading spaces\n ```\n",
1008		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
1009
1010		" ``` oz\nleading spaces\n  ```\n",
1011		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
1012
1013		"``` oz\nleading spaces\n   ```\n",
1014		"<pre><code class=\"oz\">leading spaces\n</code></pre>\n",
1015
1016		"    ``` oz\nleading spaces\n    ```\n",
1017		"<pre><code>``` oz\n</code></pre>\n\n<p>leading spaces</p>\n\n<pre><code>```\n</code></pre>\n",
1018	}
1019	doTestsBlock(t, tests, EXTENSION_FENCED_CODE|EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK)
1020}