fix: update to commonmark specs 0.31 (#3176)
BREAKING CHANGE: - Update HTML block tags: add search, remove source - Update punctuation to include unicode punctuation and symbol categories - Update HTML comment to include <!--> and <!--->
This commit is contained in:
parent
365e720585
commit
3d9017bb8e
@ -146,7 +146,7 @@ We actively support the features of the following [Markdown flavors](https://git
|
|||||||
| Flavor | Version | Status |
|
| Flavor | Version | Status |
|
||||||
| :--------------------------------------------------------- | :------ | :----------------------------------------------------------------- |
|
| :--------------------------------------------------------- | :------ | :----------------------------------------------------------------- |
|
||||||
| The original markdown.pl | -- | |
|
| The original markdown.pl | -- | |
|
||||||
| [CommonMark](http://spec.commonmark.org/0.30/) | 0.30 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
|
| [CommonMark](http://spec.commonmark.org/0.31.2/) | 0.31 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
|
||||||
| [GitHub Flavored Markdown](https://github.github.com/gfm/) | 0.29 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
|
| [GitHub Flavored Markdown](https://github.github.com/gfm/) | 0.29 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
|
||||||
|
|
||||||
By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.
|
By supporting the above Markdown flavors, it's possible that Marked can help you use other flavors as well; however, these are not actively supported by the community.
|
||||||
|
40
package-lock.json
generated
40
package-lock.json
generated
@ -24,7 +24,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^6.19.1",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"commonmark": "0.30.0",
|
"commonmark": "0.31.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dts-bundle-generator": "^9.2.5",
|
"dts-bundle-generator": "^9.2.5",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
@ -2337,15 +2337,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/commonmark": {
|
"node_modules/commonmark": {
|
||||||
"version": "0.30.0",
|
"version": "0.31.0",
|
||||||
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/commonmark/-/commonmark-0.31.0.tgz",
|
||||||
"integrity": "sha512-j1yoUo4gxPND1JWV9xj5ELih0yMv1iCWDG6eEQIPLSWLxzCXiFoyS7kvB+WwU+tZMf4snwJMMtaubV0laFpiBA==",
|
"integrity": "sha512-nuDsQ34gjmgAqjyIz6mbRWBW/XPE9wsBempAMBk2V/AA88ekztjTM46oi07J6c6Y/2Y8TdYCZi9L0pIBt/oMZw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"entities": "~2.0",
|
"entities": "~3.0.1",
|
||||||
"mdurl": "~1.0.1",
|
"mdurl": "~1.0.1",
|
||||||
"minimist": ">=1.2.2",
|
"minimist": "~1.2.5",
|
||||||
"string.prototype.repeat": "^0.2.0"
|
"string.prototype.repeat": "^1.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"commonmark": "bin/commonmark"
|
"commonmark": "bin/commonmark"
|
||||||
@ -2801,10 +2801,16 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/entities": {
|
"node_modules/entities": {
|
||||||
"version": "2.0.3",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
|
||||||
"integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==",
|
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/env-ci": {
|
"node_modules/env-ci": {
|
||||||
"version": "11.0.0",
|
"version": "11.0.0",
|
||||||
@ -10315,10 +10321,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string.prototype.repeat": {
|
"node_modules/string.prototype.repeat": {
|
||||||
"version": "0.2.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz",
|
||||||
"integrity": "sha1-q6Nt4I3O5qWjN9SbLqHaGyj8Ds8=",
|
"integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"define-properties": "^1.1.3",
|
||||||
|
"es-abstract": "^1.17.5"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string.prototype.trim": {
|
"node_modules/string.prototype.trim": {
|
||||||
"version": "1.2.8",
|
"version": "1.2.8",
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^6.19.1",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"commonmark": "0.30.0",
|
"commonmark": "0.31.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dts-bundle-generator": "^9.2.5",
|
"dts-bundle-generator": "^9.2.5",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
|
@ -31,9 +31,9 @@ const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
|||||||
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
||||||
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
||||||
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
||||||
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
+ '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
|
||||||
+ '|track|ul';
|
+ '|tr|track|ul';
|
||||||
const _comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
||||||
const html = edit(
|
const html = edit(
|
||||||
'^ {0,3}(?:' // optional indentation
|
'^ {0,3}(?:' // optional indentation
|
||||||
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
||||||
@ -165,7 +165,7 @@ const br = /^( {2,}|\\)\n(?!\s*$)/;
|
|||||||
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
||||||
|
|
||||||
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
||||||
const _punctuation = '\\p{P}$+<=>`^|~';
|
const _punctuation = '\\p{P}\\p{S}';
|
||||||
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
|
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
|
||||||
.replace(/punctuation/g, _punctuation).getRegex();
|
.replace(/punctuation/g, _punctuation).getRegex();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@
|
|||||||
<h3>Example 10</h3>
|
<h3>Example 10</h3>
|
||||||
|
|
||||||
<!-- multi
|
<!-- multi
|
||||||
line
|
line
|
||||||
comment
|
comment
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -50,11 +50,11 @@ comment
|
|||||||
|
|
||||||
<h3>Example 12</h3>
|
<h3>Example 12</h3>
|
||||||
|
|
||||||
<p><!--> not a comment --></p>
|
<!--> a comment -->
|
||||||
|
|
||||||
<p><!---> not a comment --></p>
|
<!---> a comment -->
|
||||||
|
|
||||||
<!-- <!-- not a comment? --> -->
|
<!-- <!-- a comment? --> -->
|
||||||
|
|
||||||
<h3>Example 13</h3>
|
<h3>Example 13</h3>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
### Example 10
|
### Example 10
|
||||||
|
|
||||||
<!-- multi
|
<!-- multi
|
||||||
line
|
line
|
||||||
comment
|
comment
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ comment
|
|||||||
|
|
||||||
### Example 12
|
### Example 12
|
||||||
|
|
||||||
<!--> not a comment -->
|
<!--> a comment -->
|
||||||
|
|
||||||
<!---> not a comment -->
|
<!---> a comment -->
|
||||||
|
|
||||||
<!-- <!-- not a comment? --> -->
|
<!-- <!-- a comment? --> -->
|
||||||
|
|
||||||
### Example 13
|
### Example 13
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user