@@ -5601,13 +5601,23 @@ foo
5601
5601
5602
5602
## Entity and numeric character references
5603
5603
5604
- All valid HTML entity references and numeric character
5605
- references, except those occurring in code blocks and code spans,
5606
- are recognized as such and treated as equivalent to the
5607
- corresponding Unicode characters. Conforming CommonMark parsers
5608
- need not store information about whether a particular character
5609
- was represented in the source using a Unicode character or
5610
- an entity reference.
5604
+ Valid HTML entity references and numeric character references
5605
+ can be used in place of the corresponding Unicode character,
5606
+ with the following exceptions:
5607
+
5608
+ - Entity and character references are not recognized in code
5609
+ blocks and code spans.
5610
+
5611
+ - Entity and character references cannot stand in place of
5612
+ special characters that define structural elements in
5613
+ CommonMark. For example, although `*` can be used
5614
+ in place of a literal `*` character, `*` cannot replace
5615
+ `*` in emphasis delimiters, bullet list markers, or thematic
5616
+ breaks.
5617
+
5618
+ Conforming CommonMark parsers need not store information about
5619
+ whether a particular character was represented in the source
5620
+ using a Unicode character or an entity reference.
5611
5621
5612
5622
[Entity references](@) consist of `&` + any of the valid
5613
5623
HTML5 entity names + `;`. The
@@ -5745,6 +5755,51 @@ text in code spans and code blocks:
5745
5755
````````````````````````````````
5746
5756
5747
5757
5758
+ Entity and numeric character references cannot be used
5759
+ in place of symbols indicating structure in CommonMark
5760
+ documents.
5761
+
5762
+ ```````````````````````````````` example
5763
+ *foo*
5764
+ *foo*
5765
+ .
5766
+ <p>*foo*
5767
+ <em>foo</em></p>
5768
+ ````````````````````````````````
5769
+
5770
+ ```````````````````````````````` example
5771
+ * foo
5772
+
5773
+ * foo
5774
+ .
5775
+ <p>* foo</p>
5776
+ <ul>
5777
+ <li>foo</li>
5778
+ </ul>
5779
+ ````````````````````````````````
5780
+
5781
+ ```````````````````````````````` example
5782
+ foo bar
5783
+ .
5784
+ <p>foo
5785
+
5786
+ bar</p>
5787
+ ````````````````````````````````
5788
+
5789
+ ```````````````````````````````` example
5790
+ 	foo
5791
+ .
5792
+ <p>→foo</p>
5793
+ ````````````````````````````````
5794
+
5795
+
5796
+ ```````````````````````````````` example
5797
+ [a](url "tit")
5798
+ .
5799
+ <p>[a](url "tit")</p>
5800
+ ````````````````````````````````
5801
+
5802
+
5748
5803
## Code spans
5749
5804
5750
5805
A [backtick string](@)
@@ -7464,6 +7519,15 @@ bar>)
7464
7519
bar>)</p>
7465
7520
````````````````````````````````
7466
7521
7522
+ The destination can contain `)` if it is enclosed
7523
+ in pointy brackets:
7524
+
7525
+ ```````````````````````````````` example
7526
+ [a](<b)c>)
7527
+ .
7528
+ <p><a href="b)c">a</a></p>
7529
+ ````````````````````````````````
7530
+
7467
7531
Pointy brackets that enclose links must be unescaped:
7468
7532
7469
7533
```````````````````````````````` example
@@ -7472,6 +7536,18 @@ Pointy brackets that enclose links must be unescaped:
7472
7536
<p>[link](<foo>)</p>
7473
7537
````````````````````````````````
7474
7538
7539
+ These are not links, because the opening pointy bracket
7540
+ is not matched properly:
7541
+
7542
+ ```````````````````````````````` example
7543
+ [a](<b)c
7544
+ [a](<b)c>
7545
+ [a](<b>c)
7546
+ .
7547
+ <p>[a](<b)c
7548
+ [a](<b)c>
7549
+ [a](<b>c)</p>
7550
+ ````````````````````````````````
7475
7551
7476
7552
Parentheses inside the link destination may be escaped:
7477
7553
0 commit comments