@@ -5601,13 +5601,23 @@ foo
56015601
56025602## Entity and numeric character references
56035603
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.
56115621
56125622[Entity references](@) consist of `&` + any of the valid
56135623HTML5 entity names + `;`. The
@@ -5745,6 +5755,51 @@ text in code spans and code blocks:
57455755````````````````````````````````
57465756
57475757
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+
57485803## Code spans
57495804
57505805A [backtick string](@)
@@ -7464,6 +7519,15 @@ bar>)
74647519bar>)</p>
74657520````````````````````````````````
74667521
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+
74677531Pointy brackets that enclose links must be unescaped:
74687532
74697533```````````````````````````````` example
@@ -7472,6 +7536,18 @@ Pointy brackets that enclose links must be unescaped:
74727536<p>[link](<foo>)</p>
74737537````````````````````````````````
74747538
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+ ````````````````````````````````
74757551
74767552Parentheses inside the link destination may be escaped:
74777553
0 commit comments