@adobe/helix-markdown-support 6.3.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +1 -1
- package/CHANGELOG.md +12 -0
- package/package.json +29 -29
- package/src/matter/from-markdown.js +2 -1
- package/src/matter/syntax.js +1 -2
- package/src/mdast-sanitize-links.js +1 -1
- package/src/mdast-util-gfm-nolink.js +26 -35
- package/src/micromark-extension-gfm-nolink.js +24 -49
package/.circleci/config.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [7.0.0](https://github.com/adobe/helix-markdown-support/compare/v6.3.1...v7.0.0) (2023-09-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update micromark to 4.x ([f651a31](https://github.com/adobe/helix-markdown-support/commit/f651a3176c0458af230f8145cc3caa21a5e282f7))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **deps:** micromark 4.x required
|
|
12
|
+
|
|
1
13
|
## [6.3.1](https://github.com/adobe/helix-markdown-support/compare/v6.3.0...v6.3.1) (2023-08-24)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-markdown-support",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Helix Markdown Support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"./matter": "./src/matter/index.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"hast-util-to-html": "
|
|
28
|
+
"hast-util-to-html": "9.0.0",
|
|
29
29
|
"js-yaml": "4.1.0",
|
|
30
|
-
"mdast-util-gfm-footnote": "
|
|
31
|
-
"mdast-util-gfm-strikethrough": "
|
|
32
|
-
"mdast-util-gfm-table": "
|
|
33
|
-
"mdast-util-gfm-task-list-item": "
|
|
34
|
-
"mdast-util-phrasing": "
|
|
35
|
-
"mdast-util-to-hast": "
|
|
36
|
-
"micromark-extension-gfm-footnote": "
|
|
37
|
-
"micromark-extension-gfm-strikethrough": "
|
|
38
|
-
"micromark-extension-gfm-table": "
|
|
39
|
-
"micromark-extension-gfm-tagfilter": "
|
|
40
|
-
"micromark-extension-gfm-task-list-item": "
|
|
41
|
-
"micromark-util-character": "
|
|
42
|
-
"micromark-util-combine-extensions": "
|
|
43
|
-
"micromark-util-symbol": "
|
|
44
|
-
"unist-util-find": "
|
|
45
|
-
"unist-util-visit": "
|
|
30
|
+
"mdast-util-gfm-footnote": "2.0.0",
|
|
31
|
+
"mdast-util-gfm-strikethrough": "2.0.0",
|
|
32
|
+
"mdast-util-gfm-table": "2.0.0",
|
|
33
|
+
"mdast-util-gfm-task-list-item": "2.0.0",
|
|
34
|
+
"mdast-util-phrasing": "4.0.0",
|
|
35
|
+
"mdast-util-to-hast": "13.0.2",
|
|
36
|
+
"micromark-extension-gfm-footnote": "2.0.0",
|
|
37
|
+
"micromark-extension-gfm-strikethrough": "2.0.0",
|
|
38
|
+
"micromark-extension-gfm-table": "2.0.0",
|
|
39
|
+
"micromark-extension-gfm-tagfilter": "2.0.0",
|
|
40
|
+
"micromark-extension-gfm-task-list-item": "2.0.1",
|
|
41
|
+
"micromark-util-character": "2.0.1",
|
|
42
|
+
"micromark-util-combine-extensions": "2.0.0",
|
|
43
|
+
"micromark-util-symbol": "2.0.0",
|
|
44
|
+
"unist-util-find": "2.0.0",
|
|
45
|
+
"unist-util-visit": "5.0.0"
|
|
46
46
|
},
|
|
47
47
|
"mocha": {
|
|
48
48
|
"spec": "test/**/*.test.js",
|
|
@@ -52,33 +52,33 @@
|
|
|
52
52
|
"node-option": "conditions=development"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"unified": "
|
|
55
|
+
"unified": "11.x"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=14"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@adobe/eslint-config-helix": "2.0.3",
|
|
62
|
-
"@adobe/remark-gridtables": "
|
|
62
|
+
"@adobe/remark-gridtables": "2.0.0",
|
|
63
63
|
"@semantic-release/changelog": "6.0.3",
|
|
64
64
|
"@semantic-release/git": "10.0.1",
|
|
65
65
|
"c8": "8.0.1",
|
|
66
|
-
"eslint": "8.
|
|
66
|
+
"eslint": "8.50.0",
|
|
67
67
|
"husky": "8.0.3",
|
|
68
68
|
"junit-report-builder": "3.0.1",
|
|
69
69
|
"lint-staged": "13.3.0",
|
|
70
70
|
"mdast-builder": "1.1.1",
|
|
71
71
|
"mocha": "10.2.0",
|
|
72
72
|
"mocha-multi-reporters": "1.5.1",
|
|
73
|
-
"rehype-format": "
|
|
74
|
-
"rehype-stringify": "
|
|
73
|
+
"rehype-format": "5.0.0",
|
|
74
|
+
"rehype-stringify": "10.0.0",
|
|
75
75
|
"remark-gfm": "3.0.1",
|
|
76
|
-
"remark-parse": "
|
|
77
|
-
"remark-rehype": "
|
|
78
|
-
"remark-stringify": "
|
|
79
|
-
"semantic-release": "
|
|
80
|
-
"unified": "
|
|
81
|
-
"unist-util-inspect": "
|
|
76
|
+
"remark-parse": "11.0.0",
|
|
77
|
+
"remark-rehype": "11.0.0",
|
|
78
|
+
"remark-stringify": "11.0.0",
|
|
79
|
+
"semantic-release": "22.0.5",
|
|
80
|
+
"unified": "11.0.3",
|
|
81
|
+
"unist-util-inspect": "8.0.0"
|
|
82
82
|
},
|
|
83
83
|
"lint-staged": {
|
|
84
84
|
"*.js": "eslint"
|
|
@@ -20,7 +20,7 @@ function open(token) {
|
|
|
20
20
|
function createClose(options) {
|
|
21
21
|
function close(token) {
|
|
22
22
|
const data = this.resume();
|
|
23
|
-
const node = this.
|
|
23
|
+
const node = this.stack[this.stack.length - 1];
|
|
24
24
|
// todo: avoid double parsing
|
|
25
25
|
node.payload = jsYaml.load(data);
|
|
26
26
|
if (options.yamlDump) {
|
|
@@ -28,6 +28,7 @@ function createClose(options) {
|
|
|
28
28
|
} else {
|
|
29
29
|
delete node.value;
|
|
30
30
|
}
|
|
31
|
+
this.exit(token);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
return close;
|
package/src/matter/syntax.js
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/* eslint-disable no-use-before-define */
|
|
13
13
|
import jsYaml from 'js-yaml';
|
|
14
|
-
import { codes } from 'micromark-util-symbol
|
|
15
|
-
import { types } from 'micromark-util-symbol/types.js';
|
|
14
|
+
import { codes, types } from 'micromark-util-symbol';
|
|
16
15
|
import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
|
|
17
16
|
import { TYPE_YAML } from './types.js';
|
|
18
17
|
|
|
@@ -12,37 +12,17 @@
|
|
|
12
12
|
|
|
13
13
|
/*
|
|
14
14
|
copied from
|
|
15
|
-
https://github.com/
|
|
16
|
-
|
|
17
|
-
(The MIT License)
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
22
|
-
a copy of this software and associated documentation files (the
|
|
23
|
-
'Software'), to deal in the Software without restriction, including
|
|
24
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
25
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
26
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
27
|
-
the following conditions:
|
|
28
|
-
|
|
29
|
-
The above copyright notice and this permission notice shall be
|
|
30
|
-
included in all copies or substantial portions of the Software.
|
|
31
|
-
|
|
32
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
33
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
34
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
35
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
36
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
37
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
38
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
39
|
-
*/
|
|
15
|
+
https://github.com/syntax-tree/mdast-util-gfm/blob/main/lib/index.js
|
|
16
|
+
*/
|
|
40
17
|
|
|
41
18
|
/**
|
|
42
19
|
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
|
43
20
|
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
|
44
|
-
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
45
24
|
* @typedef {import('mdast-util-gfm-table').Options} Options
|
|
25
|
+
* Configuration.
|
|
46
26
|
*/
|
|
47
27
|
|
|
48
28
|
// import {
|
|
@@ -64,30 +44,41 @@ import {
|
|
|
64
44
|
} from 'mdast-util-gfm-task-list-item';
|
|
65
45
|
|
|
66
46
|
/**
|
|
67
|
-
*
|
|
47
|
+
* Create an extension for `mdast-util-from-markdown` to enable GFM (autolink
|
|
48
|
+
* literals, footnotes, strikethrough, tables, tasklists).
|
|
49
|
+
*
|
|
50
|
+
* @returns {Array<FromMarkdownExtension>}
|
|
51
|
+
* Extension for `mdast-util-from-markdown` to enable GFM (autolink literals,
|
|
52
|
+
* footnotes, strikethrough, tables, tasklists).
|
|
68
53
|
*/
|
|
69
54
|
export function gfmFromMarkdown() {
|
|
70
55
|
return [
|
|
56
|
+
// gfmAutolinkLiteralFromMarkdown(),
|
|
71
57
|
gfmFootnoteFromMarkdown(),
|
|
72
|
-
gfmStrikethroughFromMarkdown,
|
|
73
|
-
gfmTableFromMarkdown,
|
|
74
|
-
|
|
75
|
-
gfmTaskListItemFromMarkdown,
|
|
58
|
+
gfmStrikethroughFromMarkdown(),
|
|
59
|
+
gfmTableFromMarkdown(),
|
|
60
|
+
gfmTaskListItemFromMarkdown(),
|
|
76
61
|
];
|
|
77
62
|
}
|
|
78
63
|
|
|
79
64
|
/**
|
|
80
|
-
*
|
|
65
|
+
* Create an extension for `mdast-util-to-markdown` to enable GFM (autolink
|
|
66
|
+
* literals, footnotes, strikethrough, tables, tasklists).
|
|
67
|
+
*
|
|
68
|
+
* @param {Options | null | undefined} [options]
|
|
69
|
+
* Configuration.
|
|
81
70
|
* @returns {ToMarkdownExtension}
|
|
71
|
+
* Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,
|
|
72
|
+
* footnotes, strikethrough, tables, tasklists).
|
|
82
73
|
*/
|
|
83
74
|
export function gfmToMarkdown(options) {
|
|
84
75
|
return {
|
|
85
76
|
extensions: [
|
|
86
|
-
// gfmAutolinkLiteralToMarkdown,
|
|
77
|
+
// gfmAutolinkLiteralToMarkdown(),
|
|
87
78
|
gfmFootnoteToMarkdown(),
|
|
88
|
-
gfmStrikethroughToMarkdown,
|
|
79
|
+
gfmStrikethroughToMarkdown(),
|
|
89
80
|
gfmTableToMarkdown(options),
|
|
90
|
-
gfmTaskListItemToMarkdown,
|
|
81
|
+
gfmTaskListItemToMarkdown(),
|
|
91
82
|
],
|
|
92
83
|
};
|
|
93
84
|
}
|
|
@@ -12,37 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
/*
|
|
14
14
|
copied from
|
|
15
|
-
https://github.com/micromark/micromark-extension-gfm/blob/
|
|
16
|
-
|
|
17
|
-
(The MIT License)
|
|
18
|
-
|
|
19
|
-
Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>
|
|
20
|
-
|
|
21
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
22
|
-
a copy of this software and associated documentation files (the
|
|
23
|
-
'Software'), to deal in the Software without restriction, including
|
|
24
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
25
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
26
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
27
|
-
the following conditions:
|
|
28
|
-
|
|
29
|
-
The above copyright notice and this permission notice shall be
|
|
30
|
-
included in all copies or substantial portions of the Software.
|
|
31
|
-
|
|
32
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
33
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
34
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
35
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
36
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
37
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
38
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
39
|
-
*/
|
|
15
|
+
https://github.com/micromark/micromark-extension-gfm/blob/main/index.js
|
|
16
|
+
*/
|
|
40
17
|
|
|
41
18
|
/**
|
|
19
|
+
* @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions
|
|
20
|
+
* @typedef {import('micromark-extension-gfm-strikethrough').Options} Options
|
|
42
21
|
* @typedef {import('micromark-util-types').Extension} Extension
|
|
43
22
|
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
|
|
44
|
-
* @typedef {import('micromark-extension-gfm-strikethrough').Options} Options
|
|
45
|
-
* @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions
|
|
46
23
|
*/
|
|
47
24
|
|
|
48
25
|
import {
|
|
@@ -51,8 +28,8 @@ import {
|
|
|
51
28
|
} from 'micromark-util-combine-extensions';
|
|
52
29
|
// import {
|
|
53
30
|
// gfmAutolinkLiteral,
|
|
54
|
-
// gfmAutolinkLiteralHtml
|
|
55
|
-
// } from 'micromark-extension-gfm-autolink-literal'
|
|
31
|
+
// gfmAutolinkLiteralHtml
|
|
32
|
+
// } from 'micromark-extension-gfm-autolink-literal'
|
|
56
33
|
import { gfmFootnote, gfmFootnoteHtml } from 'micromark-extension-gfm-footnote';
|
|
57
34
|
import {
|
|
58
35
|
gfmStrikethrough,
|
|
@@ -66,47 +43,45 @@ import {
|
|
|
66
43
|
} from 'micromark-extension-gfm-task-list-item';
|
|
67
44
|
|
|
68
45
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* Function that can be called to get a syntax extension for micromark (passed
|
|
72
|
-
* in `extensions`).
|
|
46
|
+
* Create an extension for `micromark` to enable GFM syntax.
|
|
73
47
|
*
|
|
74
|
-
* @param {Options} [options]
|
|
48
|
+
* @param {Options | null | undefined} [options]
|
|
75
49
|
* Configuration (optional).
|
|
50
|
+
*
|
|
76
51
|
* Passed to `micromark-extens-gfm-strikethrough`.
|
|
77
52
|
* @returns {Extension}
|
|
78
|
-
*
|
|
53
|
+
* Extension for `micromark` that can be passed in `extensions` to enable GFM
|
|
54
|
+
* syntax.
|
|
79
55
|
*/
|
|
80
56
|
export function gfm(options) {
|
|
81
57
|
return combineExtensions([
|
|
82
|
-
// gfmAutolinkLiteral,
|
|
58
|
+
// gfmAutolinkLiteral(),
|
|
83
59
|
gfmFootnote(),
|
|
84
60
|
gfmStrikethrough(options),
|
|
85
|
-
gfmTable,
|
|
86
|
-
gfmTaskListItem,
|
|
61
|
+
gfmTable(),
|
|
62
|
+
gfmTaskListItem(),
|
|
87
63
|
]);
|
|
88
64
|
}
|
|
89
65
|
|
|
90
66
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* Function that can be called to get an HTML extension for micromark (passed
|
|
94
|
-
* in `htmlExtensions`).
|
|
67
|
+
* Create an extension for `micromark` to support GFM when serializing to HTML.
|
|
95
68
|
*
|
|
96
|
-
* @param {HtmlOptions} [options]
|
|
69
|
+
* @param {HtmlOptions | null | undefined} [options]
|
|
97
70
|
* Configuration (optional).
|
|
71
|
+
*
|
|
98
72
|
* Passed to `micromark-extens-gfm-footnote`.
|
|
99
73
|
* @returns {HtmlExtension}
|
|
100
|
-
*
|
|
74
|
+
* Extension for `micromark` that can be passed in `htmlExtensions` to
|
|
75
|
+
* support GFM when serializing to HTML.
|
|
101
76
|
*/
|
|
102
77
|
/* c8 ignore next 10 */
|
|
103
78
|
export function gfmHtml(options) {
|
|
104
79
|
return combineHtmlExtensions([
|
|
105
|
-
// gfmAutolinkLiteralHtml,
|
|
80
|
+
// gfmAutolinkLiteralHtml(),
|
|
106
81
|
gfmFootnoteHtml(options),
|
|
107
|
-
gfmStrikethroughHtml,
|
|
108
|
-
gfmTableHtml,
|
|
109
|
-
gfmTagfilterHtml,
|
|
110
|
-
gfmTaskListItemHtml,
|
|
82
|
+
gfmStrikethroughHtml(),
|
|
83
|
+
gfmTableHtml(),
|
|
84
|
+
gfmTagfilterHtml(),
|
|
85
|
+
gfmTaskListItemHtml(),
|
|
111
86
|
]);
|
|
112
87
|
}
|