Skip to content

Commit

Permalink
Update to spec 0.31.2
Browse files Browse the repository at this point in the history
The spec update changes these things:

* It simplifies the HTML regex so that `<!-- a -- b -->` is an HTML
  comment. HTML5 reports this as an error, but still parses it.
* It changes the set of known HTML block elements to match HTML5, adding
  `search` and removing `source`.
* It adds Unicode Symbols to the set of punctuation characters that are
  used to evaluate flankingness.

This commit also changes the declaration HTML regex to match lowercase,
even though that change was technically made in spec version 0.30.
  • Loading branch information
notriddle committed Feb 24, 2024
1 parent d07d585 commit d07b330
Show file tree
Hide file tree
Showing 6 changed files with 771 additions and 760 deletions.
2 changes: 1 addition & 1 deletion lib/common/html_blocks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export default [
'option',
'p',
'param',
'search',
'section',
'source',
'summary',
'table',
'tbody',
Expand Down
4 changes: 2 additions & 2 deletions lib/common/html_re.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)'
const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'

const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'
const comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'
const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->'
const processing = '<[?][\\s\\S]*?[?]>'
const declaration = '<![A-Z]+\\s+[^>]*>'
const declaration = '<![A-Za-z][^>]*>'
const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'

const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/commonmark/bad.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src line: 6346

.
*$*alpha.

*£*bravo.

*€*charlie.
.
<p>*$*alpha.</p>
<p>*£*bravo.</p>
<p>*€*charlie.</p>
.

error:

<p>*$*alpha.</p>
<p><em>£</em>bravo.</p>
<p><em>€</em>charlie.</p>

0 comments on commit d07b330

Please sign in to comment.