commonmarker 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of commonmarker might be problematic. Click here for more details.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/ext/commonmarker/cmark/CMakeLists.txt +10 -2
  3. data/ext/commonmarker/cmark/Makefile +11 -13
  4. data/ext/commonmarker/cmark/README.md +1 -1
  5. data/ext/commonmarker/cmark/api_test/main.c +18 -14
  6. data/ext/commonmarker/cmark/build/CMakeCache.txt +8 -8
  7. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CMakeCCompiler.cmake +0 -0
  8. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CMakeCXXCompiler.cmake +0 -0
  9. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CMakeDetermineCompilerABI_C.bin +0 -0
  10. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CMakeDetermineCompilerABI_CXX.bin +0 -0
  11. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CMakeSystem.cmake +0 -0
  12. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CompilerIdC/CMakeCCompilerId.c +26 -9
  13. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CompilerIdC/a.out +0 -0
  14. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CompilerIdCXX/CMakeCXXCompilerId.cpp +3 -3
  15. data/ext/commonmarker/cmark/build/CMakeFiles/{3.5.2 → 3.6.0}/CompilerIdCXX/a.out +0 -0
  16. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  17. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +6 -6
  18. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +143 -143
  19. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +108 -107
  20. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +3 -3
  21. data/ext/commonmarker/cmark/build/Makefile +10 -10
  22. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  23. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +4 -4
  24. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +1 -1
  25. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -1
  26. data/ext/commonmarker/cmark/build/api_test/Makefile +10 -10
  27. data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  28. data/ext/commonmarker/cmark/build/man/Makefile +10 -10
  29. data/ext/commonmarker/cmark/build/man/cmake_install.cmake +2 -2
  30. data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  31. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark-release.cmake +38 -0
  32. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +92 -0
  33. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +3 -3
  34. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/flags.make +1 -1
  35. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +1 -1
  36. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +26 -26
  37. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +1 -1
  38. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/flags.make +1 -1
  39. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
  40. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +0 -4
  41. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
  42. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +3 -3
  43. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
  44. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +1 -1
  45. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +1 -1
  46. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +1 -1
  47. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
  48. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/node.c.o +0 -0
  49. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/references.c.o +0 -0
  50. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
  51. data/ext/commonmarker/cmark/build/src/Makefile +10 -10
  52. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +26 -7
  53. data/ext/commonmarker/cmark/build/src/cmark_export.h +4 -3
  54. data/ext/commonmarker/cmark/build/src/cmark_version.h +2 -2
  55. data/ext/commonmarker/cmark/build/src/config.h +0 -8
  56. data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
  57. data/ext/commonmarker/cmark/build/src/libcmark.pc +1 -1
  58. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  59. data/ext/commonmarker/cmark/build/testdir/Makefile +10 -10
  60. data/ext/commonmarker/cmark/changelog.txt +111 -0
  61. data/ext/commonmarker/cmark/man/man3/cmark.3 +26 -26
  62. data/ext/commonmarker/cmark/src/CMakeLists.txt +3 -0
  63. data/ext/commonmarker/cmark/src/blocks.c +50 -37
  64. data/ext/commonmarker/cmark/src/buffer.c +5 -5
  65. data/ext/commonmarker/cmark/src/buffer.h +4 -2
  66. data/ext/commonmarker/cmark/src/chunk.h +8 -5
  67. data/ext/commonmarker/cmark/src/cmark.c +5 -3
  68. data/ext/commonmarker/cmark/src/cmark.h +7 -6
  69. data/ext/commonmarker/cmark/src/commonmark.c +8 -10
  70. data/ext/commonmarker/cmark/src/config.h.in +0 -8
  71. data/ext/commonmarker/cmark/src/inlines.c +93 -45
  72. data/ext/commonmarker/cmark/src/inlines.h +2 -2
  73. data/ext/commonmarker/cmark/src/node.c +0 -3
  74. data/ext/commonmarker/cmark/src/references.c +3 -2
  75. data/ext/commonmarker/cmark/src/render.c +6 -5
  76. data/ext/commonmarker/cmark/src/scanners.c +1050 -1053
  77. data/ext/commonmarker/cmark/src/scanners.re +4 -4
  78. data/ext/commonmarker/cmark/test/pathological_tests.py +1 -1
  79. data/ext/commonmarker/cmark/test/spec.txt +179 -196
  80. data/lib/commonmarker/version.rb +1 -1
  81. data/test/test_attributes.rb +1 -1
  82. metadata +13 -11
@@ -252,7 +252,7 @@ bufsize_t _scan_atx_heading_start(const unsigned char *p)
252
252
  const unsigned char *marker = NULL;
253
253
  const unsigned char *start = p;
254
254
  /*!re2c
255
- [#]{1,6} ([ ]+|[\r\n]) { return (bufsize_t)(p - start); }
255
+ [#]{1,6} ([ \t]+|[\r\n]) { return (bufsize_t)(p - start); }
256
256
  .? { return 0; }
257
257
  */
258
258
  }
@@ -277,9 +277,9 @@ bufsize_t _scan_thematic_break(const unsigned char *p)
277
277
  const unsigned char *marker = NULL;
278
278
  const unsigned char *start = p;
279
279
  /*!re2c
280
- ([*][ ]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
281
- ([_][ ]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
282
- ([-][ ]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
280
+ ([*][ \t]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
281
+ ([_][ \t]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
282
+ ([-][ \t]*){3,} [ \t]* [\r\n] { return (bufsize_t)(p - start); }
283
283
  .? { return 0; }
284
284
  */
285
285
  }
@@ -43,7 +43,7 @@ pathological = {
43
43
  re.compile("(\[ a_){50000}")),
44
44
  "hard link/emph case":
45
45
  ("**x [a*b**c*](d)",
46
- re.compile("\\*\\*x <a href=\"d\">a<em>b</em><em>c</em></a>")),
46
+ re.compile("\\*\\*x <a href=\"d\">a<em>b\\*\\*c</em></a>")),
47
47
  "nested brackets":
48
48
  (("[" * 50000) + "a" + ("]" * 50000),
49
49
  re.compile("\[{50000}a\]{50000}")),
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: CommonMark Spec
3
3
  author: John MacFarlane
4
- version: 0.25
5
- date: '2016-03-24'
4
+ version: 0.26
5
+ date: '2016-07-15'
6
6
  license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'
7
7
  ...
8
8
 
@@ -336,9 +336,14 @@ the Unicode classes `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`.
336
336
  ## Tabs
337
337
 
338
338
  Tabs in lines are not expanded to [spaces]. However,
339
- in contexts where indentation is significant for the
340
- document's structure, tabs behave as if they were replaced
341
- by spaces with a tab stop of 4 characters.
339
+ in contexts where whitespace helps to define block structure,
340
+ tabs behave as if they were replaced by spaces with a tab stop
341
+ of 4 characters.
342
+
343
+ Thus, for example, a tab can be used instead of four spaces
344
+ in an indented code block. (Note, however, that internal
345
+ tabs are passed through as literal tabs, not expanded to
346
+ spaces.)
342
347
 
343
348
  ```````````````````````````````` example
344
349
  →foo→baz→→bim
@@ -347,7 +352,6 @@ by spaces with a tab stop of 4 characters.
347
352
  </code></pre>
348
353
  ````````````````````````````````
349
354
 
350
-
351
355
  ```````````````````````````````` example
352
356
  →foo→baz→→bim
353
357
  .
@@ -355,7 +359,6 @@ by spaces with a tab stop of 4 characters.
355
359
  </code></pre>
356
360
  ````````````````````````````````
357
361
 
358
-
359
362
  ```````````````````````````````` example
360
363
  a→a
361
364
  ὐ→a
@@ -365,6 +368,9 @@ by spaces with a tab stop of 4 characters.
365
368
  </code></pre>
366
369
  ````````````````````````````````
367
370
 
371
+ In the following example, a continuation paragraph of a list
372
+ item is indented with a tab; this has exactly the same effect
373
+ as indentation with four spaces would:
368
374
 
369
375
  ```````````````````````````````` example
370
376
  - foo
@@ -393,6 +399,15 @@ by spaces with a tab stop of 4 characters.
393
399
  </ul>
394
400
  ````````````````````````````````
395
401
 
402
+ Normally the `>` that begins a block quote may be followed
403
+ optionally by a space, which is not considered part of the
404
+ content. In the following case `>` is followed by a tab,
405
+ which is treated as if it were expanded into spaces.
406
+ Since one of theses spaces is considered part of the
407
+ delimiter, `foo` is considered to be indented six spaces
408
+ inside the block quote context, so we get an indented
409
+ code block starting with two spaces.
410
+
396
411
  ```````````````````````````````` example
397
412
  >→→foo
398
413
  .
@@ -441,6 +456,17 @@ bar
441
456
  </ul>
442
457
  ````````````````````````````````
443
458
 
459
+ ```````````````````````````````` example
460
+ #→Foo
461
+ .
462
+ <h1>Foo</h1>
463
+ ````````````````````````````````
464
+
465
+ ```````````````````````````````` example
466
+ *→*→*→
467
+ .
468
+ <hr />
469
+ ````````````````````````````````
444
470
 
445
471
 
446
472
  ## Insecure characters
@@ -779,15 +805,6 @@ headings:
779
805
  ````````````````````````````````
780
806
 
781
807
 
782
- A tab will not work:
783
-
784
- ```````````````````````````````` example
785
- #→foo
786
- .
787
- <p>#→foo</p>
788
- ````````````````````````````````
789
-
790
-
791
808
  This is not a heading, because the first `#` is escaped:
792
809
 
793
810
  ```````````````````````````````` example
@@ -1968,7 +1985,7 @@ by their start and end conditions. The block begins with a line that
1968
1985
  meets a [start condition](@) (after up to three spaces
1969
1986
  optional indentation). It ends with the first subsequent line that
1970
1987
  meets a matching [end condition](@), or the last line of
1971
- the document, if no line is encountered that meets the
1988
+ the document or other [container block](@), if no line is encountered that meets the
1972
1989
  [end condition]. If the first line meets both the [start condition]
1973
1990
  and the [end condition], the block will contain just that line.
1974
1991
 
@@ -2302,6 +2319,7 @@ import Text.HTML.TagSoup
2302
2319
  main :: IO ()
2303
2320
  main = print $ parseTags tags
2304
2321
  </code></pre>
2322
+ okay
2305
2323
  .
2306
2324
  <pre language="haskell"><code>
2307
2325
  import Text.HTML.TagSoup
@@ -2309,6 +2327,7 @@ import Text.HTML.TagSoup
2309
2327
  main :: IO ()
2310
2328
  main = print $ parseTags tags
2311
2329
  </code></pre>
2330
+ <p>okay</p>
2312
2331
  ````````````````````````````````
2313
2332
 
2314
2333
 
@@ -2320,12 +2339,14 @@ A script tag (type 1):
2320
2339
 
2321
2340
  document.getElementById("demo").innerHTML = "Hello JavaScript!";
2322
2341
  </script>
2342
+ okay
2323
2343
  .
2324
2344
  <script type="text/javascript">
2325
2345
  // JavaScript example
2326
2346
 
2327
2347
  document.getElementById("demo").innerHTML = "Hello JavaScript!";
2328
2348
  </script>
2349
+ <p>okay</p>
2329
2350
  ````````````````````````````````
2330
2351
 
2331
2352
 
@@ -2338,6 +2359,7 @@ h1 {color:red;}
2338
2359
 
2339
2360
  p {color:blue;}
2340
2361
  </style>
2362
+ okay
2341
2363
  .
2342
2364
  <style
2343
2365
  type="text/css">
@@ -2345,6 +2367,7 @@ h1 {color:red;}
2345
2367
 
2346
2368
  p {color:blue;}
2347
2369
  </style>
2370
+ <p>okay</p>
2348
2371
  ````````````````````````````````
2349
2372
 
2350
2373
 
@@ -2433,11 +2456,13 @@ A comment (type 2):
2433
2456
 
2434
2457
  bar
2435
2458
  baz -->
2459
+ okay
2436
2460
  .
2437
2461
  <!-- Foo
2438
2462
 
2439
2463
  bar
2440
2464
  baz -->
2465
+ <p>okay</p>
2441
2466
  ````````````````````````````````
2442
2467
 
2443
2468
 
@@ -2450,12 +2475,14 @@ A processing instruction (type 3):
2450
2475
  echo '>';
2451
2476
 
2452
2477
  ?>
2478
+ okay
2453
2479
  .
2454
2480
  <?php
2455
2481
 
2456
2482
  echo '>';
2457
2483
 
2458
2484
  ?>
2485
+ <p>okay</p>
2459
2486
  ````````````````````````````````
2460
2487
 
2461
2488
 
@@ -2483,6 +2510,7 @@ function matchwo(a,b)
2483
2510
  }
2484
2511
  }
2485
2512
  ]]>
2513
+ okay
2486
2514
  .
2487
2515
  <![CDATA[
2488
2516
  function matchwo(a,b)
@@ -2496,6 +2524,7 @@ function matchwo(a,b)
2496
2524
  }
2497
2525
  }
2498
2526
  ]]>
2527
+ <p>okay</p>
2499
2528
  ````````````````````````````````
2500
2529
 
2501
2530
 
@@ -3240,8 +3269,8 @@ Four spaces gives us a code block:
3240
3269
  ````````````````````````````````
3241
3270
 
3242
3271
 
3243
- The Laziness clause allows us to omit the `>` before a
3244
- paragraph continuation line:
3272
+ The Laziness clause allows us to omit the `>` before
3273
+ [paragraph continuation text]:
3245
3274
 
3246
3275
  ```````````````````````````````` example
3247
3276
  > # Foo
@@ -3347,8 +3376,8 @@ foo
3347
3376
  ````````````````````````````````
3348
3377
 
3349
3378
 
3350
- Note that in the following case, we have a paragraph
3351
- continuation line:
3379
+ Note that in the following case, we have a [lazy
3380
+ continuation line]:
3352
3381
 
3353
3382
  ```````````````````````````````` example
3354
3383
  > foo
@@ -3370,7 +3399,7 @@ To see why, note that in
3370
3399
 
3371
3400
  the `- bar` is indented too far to start a list, and can't
3372
3401
  be an indented code block because indented code blocks cannot
3373
- interrupt paragraphs, so it is a [paragraph continuation line].
3402
+ interrupt paragraphs, so it is [paragraph continuation text].
3374
3403
 
3375
3404
  A block quote can be empty:
3376
3405
 
@@ -3599,7 +3628,7 @@ The following rules define [list items]:
3599
3628
  1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of
3600
3629
  blocks *Bs* starting with a [non-whitespace character] and not separated
3601
3630
  from each other by more than one blank line, and *M* is a list
3602
- marker of width *W* followed by 0 < *N* < 5 spaces, then the result
3631
+ marker of width *W* followed by 1 *N* 4 spaces, then the result
3603
3632
  of prepending *M* and the following spaces to the first line of
3604
3633
  *Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a
3605
3634
  list item with *Bs* as its contents. The type of the list item
@@ -3607,6 +3636,12 @@ The following rules define [list items]:
3607
3636
  If the list item is ordered, then it is also assigned a start
3608
3637
  number, based on the ordered list marker.
3609
3638
 
3639
+ Exceptions: When the list item interrupts a paragraph---that
3640
+ is, when it starts on a line that would otherwise count as
3641
+ [paragraph continuation text]---then (a) the lines *Ls* must
3642
+ not begin with a blank line, and (b) if the list item is
3643
+ ordered, the start number must be 1.
3644
+
3610
3645
  For example, let *Ls* be the lines
3611
3646
 
3612
3647
  ```````````````````````````````` example
@@ -3781,66 +3816,20 @@ any following content, so these are not list items:
3781
3816
  ````````````````````````````````
3782
3817
 
3783
3818
 
3784
- A list item may not contain blocks that are separated by more than
3785
- one blank line. Thus, two blank lines will end a list, unless the
3786
- two blanks are contained in a [fenced code block].
3819
+ A list item may contain blocks that are separated by more than
3820
+ one blank line.
3787
3821
 
3788
3822
  ```````````````````````````````` example
3789
- - foo
3790
-
3791
- bar
3792
-
3793
3823
  - foo
3794
3824
 
3795
3825
 
3796
3826
  bar
3797
-
3798
- - ```
3799
- foo
3800
-
3801
-
3802
- bar
3803
- ```
3804
-
3805
- - baz
3806
-
3807
- + ```
3808
- foo
3809
-
3810
-
3811
- bar
3812
- ```
3813
3827
  .
3814
3828
  <ul>
3815
3829
  <li>
3816
3830
  <p>foo</p>
3817
3831
  <p>bar</p>
3818
3832
  </li>
3819
- <li>
3820
- <p>foo</p>
3821
- </li>
3822
- </ul>
3823
- <p>bar</p>
3824
- <ul>
3825
- <li>
3826
- <pre><code>foo
3827
-
3828
-
3829
- bar
3830
- </code></pre>
3831
- </li>
3832
- <li>
3833
- <p>baz</p>
3834
- <ul>
3835
- <li>
3836
- <pre><code>foo
3837
-
3838
-
3839
- bar
3840
- </code></pre>
3841
- </li>
3842
- </ul>
3843
- </li>
3844
3833
  </ul>
3845
3834
  ````````````````````````````````
3846
3835
 
@@ -3873,15 +3862,14 @@ A list item may contain any kind of block:
3873
3862
 
3874
3863
 
3875
3864
  A list item that contains an indented code block will preserve
3876
- empty lines within the code block verbatim, unless there are two
3877
- or more empty lines in a row (since as described above, two
3878
- blank lines end the list):
3865
+ empty lines within the code block verbatim.
3879
3866
 
3880
3867
  ```````````````````````````````` example
3881
3868
  - Foo
3882
3869
 
3883
3870
  bar
3884
3871
 
3872
+
3885
3873
  baz
3886
3874
  .
3887
3875
  <ul>
@@ -3889,33 +3877,13 @@ blank lines end the list):
3889
3877
  <p>Foo</p>
3890
3878
  <pre><code>bar
3891
3879
 
3892
- baz
3893
- </code></pre>
3894
- </li>
3895
- </ul>
3896
- ````````````````````````````````
3897
-
3898
-
3899
- ```````````````````````````````` example
3900
- - Foo
3901
3880
 
3902
- bar
3903
-
3904
-
3905
- baz
3906
- .
3907
- <ul>
3908
- <li>
3909
- <p>Foo</p>
3910
- <pre><code>bar
3881
+ baz
3911
3882
  </code></pre>
3912
3883
  </li>
3913
3884
  </ul>
3914
- <pre><code> baz
3915
- </code></pre>
3916
3885
  ````````````````````````````````
3917
3886
 
3918
-
3919
3887
  Note that ordered list start numbers must be nine digits or less:
3920
3888
 
3921
3889
  ```````````````````````````````` example
@@ -4242,6 +4210,20 @@ A list may start or end with an empty list item:
4242
4210
  </ul>
4243
4211
  ````````````````````````````````
4244
4212
 
4213
+ However, an empty list item cannot interrupt a paragraph:
4214
+
4215
+ ```````````````````````````````` example
4216
+ foo
4217
+ *
4218
+
4219
+ foo
4220
+ 1.
4221
+ .
4222
+ <p>foo
4223
+ *</p>
4224
+ <p>foo
4225
+ 1.</p>
4226
+ ````````````````````````````````
4245
4227
 
4246
4228
 
4247
4229
  4. **Indentation.** If a sequence of lines *Ls* constitutes a list item
@@ -4439,13 +4421,18 @@ So, in this case we need two spaces indent:
4439
4421
  - foo
4440
4422
  - bar
4441
4423
  - baz
4424
+ - boo
4442
4425
  .
4443
4426
  <ul>
4444
4427
  <li>foo
4445
4428
  <ul>
4446
4429
  <li>bar
4447
4430
  <ul>
4448
- <li>baz</li>
4431
+ <li>baz
4432
+ <ul>
4433
+ <li>boo</li>
4434
+ </ul>
4435
+ </li>
4449
4436
  </ul>
4450
4437
  </li>
4451
4438
  </ul>
@@ -4460,11 +4447,13 @@ One is not enough:
4460
4447
  - foo
4461
4448
  - bar
4462
4449
  - baz
4450
+ - boo
4463
4451
  .
4464
4452
  <ul>
4465
4453
  <li>foo</li>
4466
4454
  <li>bar</li>
4467
4455
  <li>baz</li>
4456
+ <li>boo</li>
4468
4457
  </ul>
4469
4458
  ````````````````````````````````
4470
4459
 
@@ -4817,28 +4806,20 @@ Foo
4817
4806
  </ul>
4818
4807
  ````````````````````````````````
4819
4808
 
4820
-
4821
4809
  `Markdown.pl` does not allow this, through fear of triggering a list
4822
4810
  via a numeral in a hard-wrapped line:
4823
4811
 
4824
- ```````````````````````````````` example
4812
+ ```````````````````````````````` markdown
4825
4813
  The number of windows in my house is
4826
4814
  14. The number of doors is 6.
4827
- .
4828
- <p>The number of windows in my house is</p>
4829
- <ol start="14">
4830
- <li>The number of doors is 6.</li>
4831
- </ol>
4832
4815
  ````````````````````````````````
4816
+ Oddly, though, `Markdown.pl` *does* allow a blockquote to
4817
+ interrupt a paragraph, even though the same considerations might
4818
+ apply.
4833
4819
 
4834
-
4835
- Oddly, `Markdown.pl` *does* allow a blockquote to interrupt a paragraph,
4836
- even though the same considerations might apply. We think that the two
4837
- cases should be treated the same. Here are two reasons for allowing
4838
- lists to interrupt paragraphs:
4839
-
4840
- First, it is natural and not uncommon for people to start lists without
4841
- blank lines:
4820
+ In CommonMark, we do allow lists to interrupt paragraphs, for
4821
+ two reasons. First, it is natural and not uncommon for people
4822
+ to start lists without blank lines:
4842
4823
 
4843
4824
  I need to buy
4844
4825
  - new shoes
@@ -4872,20 +4853,40 @@ then
4872
4853
 
4873
4854
  by itself should be a paragraph followed by a nested sublist.
4874
4855
 
4875
- Our adherence to the [principle of uniformity]
4876
- thus inclines us to think that there are two coherent packages:
4856
+ Since it is well established Markdown practice to allow lists to
4857
+ interrupt paragraphs inside list items, the [principle of
4858
+ uniformity] requires us to allow this outside list items as
4859
+ well. ([reStructuredText](http://docutils.sourceforge.net/rst.html)
4860
+ takes a different approach, requiring blank lines before lists
4861
+ even inside other list items.)
4877
4862
 
4878
- 1. Require blank lines before *all* lists and blockquotes,
4879
- including lists that occur as sublists inside other list items.
4863
+ In order to solve of unwanted lists in paragraphs with
4864
+ hard-wrapped numerals, we allow only lists starting with `1` to
4865
+ interrupt paragraphs. Thus,
4880
4866
 
4881
- 2. Require blank lines in none of these places.
4867
+ ```````````````````````````````` example
4868
+ The number of windows in my house is
4869
+ 14. The number of doors is 6.
4870
+ .
4871
+ <p>The number of windows in my house is
4872
+ 14. The number of doors is 6.</p>
4873
+ ````````````````````````````````
4882
4874
 
4883
- [reStructuredText](http://docutils.sourceforge.net/rst.html) takes
4884
- the first approach, for which there is much to be said. But the second
4885
- seems more consistent with established practice with Markdown.
4875
+ We may still get an unintended result in cases like
4886
4876
 
4887
- There can be blank lines between items, but two blank lines end
4888
- a list:
4877
+ ```````````````````````````````` example
4878
+ The number of windows in my house is
4879
+ 1. The number of doors is 6.
4880
+ .
4881
+ <p>The number of windows in my house is</p>
4882
+ <ol>
4883
+ <li>The number of doors is 6.</li>
4884
+ </ol>
4885
+ ````````````````````````````````
4886
+
4887
+ but this rule should prevent most spurious list captures.
4888
+
4889
+ There can be any number of blank lines between items:
4889
4890
 
4890
4891
  ```````````````````````````````` example
4891
4892
  - foo
@@ -4902,36 +4903,12 @@ a list:
4902
4903
  <li>
4903
4904
  <p>bar</p>
4904
4905
  </li>
4905
- </ul>
4906
- <ul>
4907
- <li>baz</li>
4908
- </ul>
4909
- ````````````````````````````````
4910
-
4911
-
4912
- As illustrated above in the section on [list items],
4913
- two blank lines between blocks *within* a list item will also end a
4914
- list:
4915
-
4916
- ```````````````````````````````` example
4917
- - foo
4918
-
4919
-
4920
- bar
4921
- - baz
4922
- .
4923
- <ul>
4924
- <li>foo</li>
4925
- </ul>
4926
- <p>bar</p>
4927
- <ul>
4928
- <li>baz</li>
4906
+ <li>
4907
+ <p>baz</p>
4908
+ </li>
4929
4909
  </ul>
4930
4910
  ````````````````````````````````
4931
4911
 
4932
-
4933
- Indeed, two blank lines will end *all* containing lists:
4934
-
4935
4912
  ```````````````````````````````` example
4936
4913
  - foo
4937
4914
  - bar
@@ -4945,26 +4922,28 @@ Indeed, two blank lines will end *all* containing lists:
4945
4922
  <ul>
4946
4923
  <li>bar
4947
4924
  <ul>
4948
- <li>baz</li>
4925
+ <li>
4926
+ <p>baz</p>
4927
+ <p>bim</p>
4928
+ </li>
4949
4929
  </ul>
4950
4930
  </li>
4951
4931
  </ul>
4952
4932
  </li>
4953
4933
  </ul>
4954
- <pre><code> bim
4955
- </code></pre>
4956
4934
  ````````````````````````````````
4957
4935
 
4958
4936
 
4959
- Thus, two blank lines can be used to separate consecutive lists of
4960
- the same type, or to separate a list from an indented code block
4961
- that would otherwise be parsed as a subparagraph of the final list
4962
- item:
4937
+ To separate consecutive lists of the same type, or to separate a
4938
+ list from an indented code block that would otherwise be parsed
4939
+ as a subparagraph of the final list item, you can insert a blank HTML
4940
+ comment:
4963
4941
 
4964
4942
  ```````````````````````````````` example
4965
4943
  - foo
4966
4944
  - bar
4967
4945
 
4946
+ <!-- -->
4968
4947
 
4969
4948
  - baz
4970
4949
  - bim
@@ -4973,6 +4952,7 @@ item:
4973
4952
  <li>foo</li>
4974
4953
  <li>bar</li>
4975
4954
  </ul>
4955
+ <!-- -->
4976
4956
  <ul>
4977
4957
  <li>baz</li>
4978
4958
  <li>bim</li>
@@ -4987,6 +4967,7 @@ item:
4987
4967
 
4988
4968
  - foo
4989
4969
 
4970
+ <!-- -->
4990
4971
 
4991
4972
  code
4992
4973
  .
@@ -4999,6 +4980,7 @@ item:
4999
4980
  <p>foo</p>
5000
4981
  </li>
5001
4982
  </ul>
4983
+ <!-- -->
5002
4984
  <pre><code>code
5003
4985
  </code></pre>
5004
4986
  ````````````````````````````````
@@ -5945,18 +5927,22 @@ The following rules define emphasis and strong emphasis:
5945
5927
 
5946
5928
  9. Emphasis begins with a delimiter that [can open emphasis] and ends
5947
5929
  with a delimiter that [can close emphasis], and that uses the same
5948
- character (`_` or `*`) as the opening delimiter. There must
5949
- be a nonempty sequence of inlines between the open delimiter
5950
- and the closing delimiter; these form the contents of the emphasis
5951
- inline.
5930
+ character (`_` or `*`) as the opening delimiter. The
5931
+ opening and closing delimiters must belong to separate
5932
+ [delimiter runs]. If one of the delimiters can both
5933
+ open and close emphasis, then the sum of the lengths of the
5934
+ delimiter runs containing the opening and closing delimiters
5935
+ must not be a multiple of 3.
5952
5936
 
5953
5937
  10. Strong emphasis begins with a delimiter that
5954
5938
  [can open strong emphasis] and ends with a delimiter that
5955
5939
  [can close strong emphasis], and that uses the same character
5956
- (`_` or `*`) as the opening delimiter.
5957
- There must be a nonempty sequence of inlines between the open
5958
- delimiter and the closing delimiter; these form the contents of
5959
- the strong emphasis inline.
5940
+ (`_` or `*`) as the opening delimiter. The
5941
+ opening and closing delimiters must belong to separate
5942
+ [delimiter runs]. If one of the delimiters can both open
5943
+ and close strong emphasis, then the sum of the lengths of
5944
+ the delimiter runs containing the opening and closing
5945
+ delimiters must not be a multiple of 3.
5960
5946
 
5961
5947
  11. A literal `*` character cannot occur at the beginning or end of
5962
5948
  `*`-delimited emphasis or `**`-delimited strong emphasis, unless it
@@ -5980,9 +5966,7 @@ the following principles resolve ambiguity:
5980
5966
  so that the second begins before the first ends and ends after
5981
5967
  the first ends, the first takes precedence. Thus, for example,
5982
5968
  `*foo _bar* baz_` is parsed as `<em>foo _bar</em> baz_` rather
5983
- than `*foo <em>bar* baz</em>`. For the same reason,
5984
- `**foo*bar**` is parsed as `<em><em>foo</em>bar</em>*`
5985
- rather than `<strong>foo*bar</strong>`.
5969
+ than `*foo <em>bar* baz</em>`.
5986
5970
 
5987
5971
  16. When there are two potential emphasis or strong emphasis spans
5988
5972
  with the same closing delimiter, the shorter one (the one that
@@ -6155,10 +6139,8 @@ A newline also counts as whitespace:
6155
6139
  *foo bar
6156
6140
  *
6157
6141
  .
6158
- <p>*foo bar</p>
6159
- <ul>
6160
- <li></li>
6161
- </ul>
6142
+ <p>*foo bar
6143
+ *</p>
6162
6144
  ````````````````````````````````
6163
6145
 
6164
6146
 
@@ -6562,18 +6544,30 @@ __foo_ bar_
6562
6544
  <p><em>foo <strong>bar</strong> baz</em></p>
6563
6545
  ````````````````````````````````
6564
6546
 
6565
-
6566
- But note:
6567
-
6568
6547
  ```````````````````````````````` example
6569
6548
  *foo**bar**baz*
6570
6549
  .
6571
- <p><em>foo</em><em>bar</em><em>baz</em></p>
6550
+ <p><em>foo<strong>bar</strong>baz</em></p>
6572
6551
  ````````````````````````````````
6573
6552
 
6553
+ Note that in the preceding case, the interpretation
6554
+
6555
+ ``` markdown
6556
+ <p><em>foo</em><em>bar<em></em>baz</em></p>
6557
+ ```
6558
+
6559
+
6560
+ is precluded by the condition that a delimiter that
6561
+ can both open and close (like the `*` after `foo`
6562
+ cannot form emphasis if the sum of the lengths of
6563
+ the delimiter runs containing the opening and
6564
+ closing delimiters is a multiple of 3.
6565
+
6566
+ The same condition ensures that the following
6567
+ cases are all strong emphasis nested inside
6568
+ emphasis, even when the interior spaces are
6569
+ omitted:
6574
6570
 
6575
- The difference is that in the preceding case, the internal delimiters
6576
- [can close emphasis], while in the cases with spaces, they cannot.
6577
6571
 
6578
6572
  ```````````````````````````````` example
6579
6573
  ***foo** bar*
@@ -6589,17 +6583,18 @@ The difference is that in the preceding case, the internal delimiters
6589
6583
  ````````````````````````````````
6590
6584
 
6591
6585
 
6592
- Note, however, that in the following case we get no strong
6593
- emphasis, because the opening delimiter is closed by the first
6594
- `*` before `bar`:
6595
-
6596
6586
  ```````````````````````````````` example
6597
6587
  *foo**bar***
6598
6588
  .
6599
- <p><em>foo</em><em>bar</em>**</p>
6589
+ <p><em>foo<strong>bar</strong></em></p>
6600
6590
  ````````````````````````````````
6601
6591
 
6602
6592
 
6593
+ ```````````````````````````````` example
6594
+ *foo**bar***
6595
+ .
6596
+ <p><em>foo<strong>bar</strong></em></p>
6597
+ ````````````````````````````````
6603
6598
 
6604
6599
  Indefinite levels of nesting are possible:
6605
6600
 
@@ -6693,18 +6688,13 @@ ____foo__ bar__
6693
6688
  ````````````````````````````````
6694
6689
 
6695
6690
 
6696
- But note:
6697
-
6698
6691
  ```````````````````````````````` example
6699
6692
  **foo*bar*baz**
6700
6693
  .
6701
- <p><em><em>foo</em>bar</em>baz**</p>
6694
+ <p><strong>foo<em>bar</em>baz</strong></p>
6702
6695
  ````````````````````````````````
6703
6696
 
6704
6697
 
6705
- The difference is that in the preceding case, the internal delimiters
6706
- [can close emphasis], while in the cases with spaces, they cannot.
6707
-
6708
6698
  ```````````````````````````````` example
6709
6699
  ***foo* bar**
6710
6700
  .
@@ -7019,13 +7009,6 @@ Rule 15:
7019
7009
  ````````````````````````````````
7020
7010
 
7021
7011
 
7022
- ```````````````````````````````` example
7023
- **foo*bar**
7024
- .
7025
- <p><em><em>foo</em>bar</em>*</p>
7026
- ````````````````````````````````
7027
-
7028
-
7029
7012
  ```````````````````````````````` example
7030
7013
  *foo __bar *baz bim__ bam*
7031
7014
  .
@@ -7956,7 +7939,7 @@ consists of a [link label] that [matches] a
7956
7939
  [link reference definition] elsewhere in the
7957
7940
  document and is not followed by `[]` or a link label.
7958
7941
  The contents of the first link label are parsed as inlines,
7959
- which are used as the link's text. the link's URI and title
7942
+ which are used as the link's text. The link's URI and title
7960
7943
  are provided by the matching link reference definition.
7961
7944
  Thus, `[foo]` is equivalent to `[foo][]`.
7962
7945
 
@@ -8931,7 +8914,7 @@ foo
8931
8914
 
8932
8915
  A regular line break (not in a code span or HTML tag) that is not
8933
8916
  preceded by two or more spaces or a backslash is parsed as a
8934
- softbreak. (A softbreak may be rendered in HTML either as a
8917
+ [softbreak](@). (A softbreak may be rendered in HTML either as a
8935
8918
  [line ending] or as a space. The result will be the same in
8936
8919
  browsers. In the examples here, a [line ending] will be used.)
8937
8920