Switch to Commonmark fork

This commit is contained in:
Harrison Healey
2022-05-02 09:43:10 -04:00
parent 70d5cb068c
commit 4a5da8d625
4 changed files with 71 additions and 52 deletions

View File

@@ -312,7 +312,7 @@ export function parseTaskLists(ast: Node) {
const match = (/^ {0,3}\[( |x)\]\s/).exec(literal);
if (match) {
const checkbox = new Node('checkbox');
checkbox._isChecked = match[1] === 'x';
checkbox.isChecked = match[1] === 'x';
paragraphNode.prependChild(checkbox);

81
package-lock.json generated
View File

@@ -33,8 +33,8 @@
"@sentry/react-native": "3.4.0",
"@stream-io/flat-list-mvcp": "0.10.1",
"base-64": "1.0.0",
"commonmark": "github:mattermost/commonmark.js#d4496c37933846a8270b49ae79a154738843a48a",
"commonmark-react-renderer": "github:mattermost/commonmark-react-renderer#4e52e1725c0ef5b1e2ecfe9883220ec36c2eb67d",
"commonmark": "npm:@mattermost/commonmark@0.30.1-0",
"commonmark-react-renderer": "github:mattermost/commonmark-react-renderer#2c660491041f7595f6ce5a05f6dc2e30ca769d3a",
"deep-equal": "2.0.5",
"deepmerge": "4.2.2",
"emoji-regex": "10.1.0",
@@ -3009,6 +3009,37 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@mattermost/commonmark": {
"version": "0.30.1-0",
"resolved": "https://registry.npmjs.org/@mattermost/commonmark/-/commonmark-0.30.1-0.tgz",
"integrity": "sha512-0+qW22COfd/BA81TQ05nQMfhmnuRAkv/vwCbs3iFVTEj7mTunYRwWUyb5M8K849V2VXdLdrS8htsBtIHDb2H7g==",
"peer": true,
"dependencies": {
"entities": "~3.0.1",
"mdurl": "~1.0.1",
"minimist": "~1.2.5",
"string.prototype.repeat": "^1.0.0",
"xregexp": "5.1.0"
},
"bin": {
"commonmark": "bin/commonmark"
},
"engines": {
"node": "*"
}
},
"node_modules/@mattermost/commonmark/node_modules/entities": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
"peer": true,
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@mattermost/compass-icons": {
"version": "0.1.22",
"resolved": "https://registry.npmjs.org/@mattermost/compass-icons/-/compass-icons-0.1.22.tgz",
@@ -8519,10 +8550,10 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
},
"node_modules/commonmark": {
"version": "0.30.0",
"resolved": "git+ssh://git@github.com/mattermost/commonmark.js.git#d4496c37933846a8270b49ae79a154738843a48a",
"integrity": "sha512-52SQWTLzqKZDkjM63ukOTR1aN2sp68ux1Yl/tXtI+1WC+dfj6dEemofmjCQXY1rKlLjbLj4rNkm0ENuctUGfGg==",
"license": "BSD-2-Clause",
"name": "@mattermost/commonmark",
"version": "0.30.1-0",
"resolved": "https://registry.npmjs.org/@mattermost/commonmark/-/commonmark-0.30.1-0.tgz",
"integrity": "sha512-0+qW22COfd/BA81TQ05nQMfhmnuRAkv/vwCbs3iFVTEj7mTunYRwWUyb5M8K849V2VXdLdrS8htsBtIHDb2H7g==",
"dependencies": {
"entities": "~3.0.1",
"mdurl": "~1.0.1",
@@ -8539,7 +8570,9 @@
},
"node_modules/commonmark-react-renderer": {
"version": "4.3.5",
"resolved": "git+ssh://git@github.com/mattermost/commonmark-react-renderer.git#4e52e1725c0ef5b1e2ecfe9883220ec36c2eb67d",
"resolved": "git+ssh://git@github.com/mattermost/commonmark-react-renderer.git#2c660491041f7595f6ce5a05f6dc2e30ca769d3a",
"integrity": "sha512-D++d6UFNLyu4fAAZg6blRb3rkiG+bFWKJ8fSLOJwzBit3Hm/sPZbx2QQeKfx+IHoMg7cCvHlesAT1+kB/+kBLQ==",
"license": "MIT",
"dependencies": {
"lodash.assign": "^4.2.0",
"lodash.isplainobject": "^4.0.6",
@@ -8547,7 +8580,7 @@
"xss-filters": "^1.2.6"
},
"peerDependencies": {
"commonmark": "^0.30.0",
"@mattermost/commonmark": "*",
"react": ">=0.14.0"
}
},
@@ -25686,6 +25719,27 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"@mattermost/commonmark": {
"version": "0.30.1-0",
"resolved": "https://registry.npmjs.org/@mattermost/commonmark/-/commonmark-0.30.1-0.tgz",
"integrity": "sha512-0+qW22COfd/BA81TQ05nQMfhmnuRAkv/vwCbs3iFVTEj7mTunYRwWUyb5M8K849V2VXdLdrS8htsBtIHDb2H7g==",
"peer": true,
"requires": {
"entities": "~3.0.1",
"mdurl": "~1.0.1",
"minimist": "~1.2.5",
"string.prototype.repeat": "^1.0.0",
"xregexp": "5.1.0"
},
"dependencies": {
"entities": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
"peer": true
}
}
},
"@mattermost/compass-icons": {
"version": "0.1.22",
"resolved": "https://registry.npmjs.org/@mattermost/compass-icons/-/compass-icons-0.1.22.tgz",
@@ -29935,9 +29989,9 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
},
"commonmark": {
"version": "git+ssh://git@github.com/mattermost/commonmark.js.git#d4496c37933846a8270b49ae79a154738843a48a",
"integrity": "sha512-52SQWTLzqKZDkjM63ukOTR1aN2sp68ux1Yl/tXtI+1WC+dfj6dEemofmjCQXY1rKlLjbLj4rNkm0ENuctUGfGg==",
"from": "commonmark@github:mattermost/commonmark.js#d4496c37933846a8270b49ae79a154738843a48a",
"version": "npm:@mattermost/commonmark@0.30.1-0",
"resolved": "https://registry.npmjs.org/@mattermost/commonmark/-/commonmark-0.30.1-0.tgz",
"integrity": "sha512-0+qW22COfd/BA81TQ05nQMfhmnuRAkv/vwCbs3iFVTEj7mTunYRwWUyb5M8K849V2VXdLdrS8htsBtIHDb2H7g==",
"requires": {
"entities": "~3.0.1",
"mdurl": "~1.0.1",
@@ -29954,8 +30008,9 @@
}
},
"commonmark-react-renderer": {
"version": "git+ssh://git@github.com/mattermost/commonmark-react-renderer.git#4e52e1725c0ef5b1e2ecfe9883220ec36c2eb67d",
"from": "commonmark-react-renderer@github:mattermost/commonmark-react-renderer#4e52e1725c0ef5b1e2ecfe9883220ec36c2eb67d",
"version": "git+ssh://git@github.com/mattermost/commonmark-react-renderer.git#2c660491041f7595f6ce5a05f6dc2e30ca769d3a",
"integrity": "sha512-D++d6UFNLyu4fAAZg6blRb3rkiG+bFWKJ8fSLOJwzBit3Hm/sPZbx2QQeKfx+IHoMg7cCvHlesAT1+kB/+kBLQ==",
"from": "commonmark-react-renderer@github:mattermost/commonmark-react-renderer#2c660491041f7595f6ce5a05f6dc2e30ca769d3a",
"requires": {
"lodash.assign": "^4.2.0",
"lodash.isplainobject": "^4.0.6",

View File

@@ -31,8 +31,8 @@
"@sentry/react-native": "3.4.0",
"@stream-io/flat-list-mvcp": "0.10.1",
"base-64": "1.0.0",
"commonmark": "github:mattermost/commonmark.js#d4496c37933846a8270b49ae79a154738843a48a",
"commonmark-react-renderer": "github:mattermost/commonmark-react-renderer#4e52e1725c0ef5b1e2ecfe9883220ec36c2eb67d",
"commonmark": "npm:@mattermost/commonmark@0.30.1-0",
"commonmark-react-renderer": "github:mattermost/commonmark-react-renderer#2c660491041f7595f6ce5a05f6dc2e30ca769d3a",
"deep-equal": "2.0.5",
"deepmerge": "4.2.2",
"emoji-regex": "10.1.0",

View File

@@ -1,36 +0,0 @@
diff --git a/node_modules/@types/commonmark/index.d.ts b/node_modules/@types/commonmark/index.d.ts
index 35e9ed6..3bc0eba 100755
--- a/node_modules/@types/commonmark/index.d.ts
+++ b/node_modules/@types/commonmark/index.d.ts
@@ -5,8 +5,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type NodeType =
- 'text' |'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' |
- 'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block';
+ 'text' |'softbreak' | 'linebreak' | 'emph' | 'strong' | 'html_inline' | 'link' | 'image' | 'code' | 'document' | 'paragraph' | 'mention_highlight' | 'search_highlight' | 'at_mention' |
+ 'block_quote' | 'item' | 'list' | 'heading' | 'code_block' | 'html_block' | 'thematic_break' | 'custom_inline' | 'custom_block' | 'table' | 'edited_indicator' | 'checkbox';
export class Node {
constructor(nodeType: NodeType, sourcepos?: Position);
@@ -125,6 +125,11 @@ export class Node {
* https://github.com/jgm/commonmark.js/issues/74
*/
_listData: ListData;
+
+ mentionName?: string;
+
+ _isChecked: boolean;
+ isChecked: boolean;
}
/**
@@ -200,6 +205,8 @@ export interface ParserOptions {
*/
smart?: boolean | undefined;
time?: boolean | undefined;
+ urlFilter?: (url: string) => boolean;
+ minimumHashtagLength?: number;
}
export interface HtmlRenderingOptions extends XmlRenderingOptions {