Skip to content

Commit 3d9017b

Browse files
authored
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 <!--->
1 parent 365e720 commit 3d9017b

File tree

8 files changed

+3157
-3151
lines changed

8 files changed

+3157
-3151
lines changed

docs/INDEX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ We actively support the features of the following [Markdown flavors](https://git
146146
| Flavor | Version | Status |
147147
| :--------------------------------------------------------- | :------ | :----------------------------------------------------------------- |
148148
| The original markdown.pl | -- | |
149-
| [CommonMark](http://spec.commonmark.org/0.30/) | 0.30 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
149+
| [CommonMark](http://spec.commonmark.org/0.31.2/) | 0.31 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
150150
| [GitHub Flavored Markdown](https://github.github.com/gfm/) | 0.29 | [Work in progress](https://github.com/markedjs/marked/issues/1202) |
151151

152152
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.

package-lock.json

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@typescript-eslint/eslint-plugin": "^6.19.1",
6363
"@typescript-eslint/parser": "^6.19.1",
6464
"cheerio": "^1.0.0-rc.12",
65-
"commonmark": "0.30.0",
65+
"commonmark": "0.31.0",
6666
"cross-env": "^7.0.3",
6767
"dts-bundle-generator": "^9.2.5",
6868
"eslint": "^8.56.0",

src/rules.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
3131
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
3232
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
3333
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
34-
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
35-
+ '|track|ul';
36-
const _comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
34+
+ '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
35+
+ '|tr|track|ul';
36+
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
3737
const html = edit(
3838
'^ {0,3}(?:' // optional indentation
3939
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
@@ -165,7 +165,7 @@ const br = /^( {2,}|\\)\n(?!\s*$)/;
165165
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
166166

167167
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
168-
const _punctuation = '\\p{P}$+<=>`^|~';
168+
const _punctuation = '\\p{P}\\p{S}';
169169
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
170170
.replace(/punctuation/g, _punctuation).getRegex();
171171

0 commit comments

Comments
 (0)