@adobe/helix-html-pipeline 3.11.17 → 3.11.19
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/CHANGELOG.md +14 -0
- package/package.json +12 -23
- package/src/PipelineState.d.ts +0 -1
- package/src/PipelineState.js +0 -2
- package/src/json-pipe.js +2 -3
- package/src/options-pipe.js +37 -13
- package/src/steps/parse-markdown.js +3 -4
- package/src/utils/mdast-util-gfm-nolink.js +0 -93
- package/src/utils/remark-gfm-nolink.js +0 -128
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.11.19](https://github.com/adobe/helix-html-pipeline/compare/v3.11.18...v3.11.19) (2023-07-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** use gfm from markdown-support ([3b27b20](https://github.com/adobe/helix-html-pipeline/commit/3b27b20fbe76eaeb6c1a8089a02440f43d614783))
|
|
7
|
+
|
|
8
|
+
## [3.11.18](https://github.com/adobe/helix-html-pipeline/compare/v3.11.17...v3.11.18) (2023-07-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* ensure contentBusId is loaded properly ([#342](https://github.com/adobe/helix-html-pipeline/issues/342)) ([80e4552](https://github.com/adobe/helix-html-pipeline/commit/80e4552223124ba73cef41829f40bd64ade392c9))
|
|
14
|
+
|
|
1
15
|
## [3.11.17](https://github.com/adobe/helix-html-pipeline/compare/v3.11.16...v3.11.17) (2023-06-28)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.19",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@adobe/helix-markdown-support": "6.1.3",
|
|
43
43
|
"@adobe/helix-shared-utils": "3.0.0",
|
|
44
|
-
"@adobe/mdast-util-gridtables": "
|
|
44
|
+
"@adobe/mdast-util-gridtables": "2.0.0",
|
|
45
45
|
"@adobe/remark-gridtables": "1.0.4",
|
|
46
46
|
"cookie": "0.5.0",
|
|
47
47
|
"github-slugger": "2.0.0",
|
|
@@ -51,30 +51,20 @@
|
|
|
51
51
|
"hast-util-to-string": "2.0.0",
|
|
52
52
|
"hastscript": "7.2.0",
|
|
53
53
|
"jose": "4.14.4",
|
|
54
|
-
"mdast-util-gfm-footnote": "1.0.2",
|
|
55
|
-
"mdast-util-gfm-strikethrough": "1.0.3",
|
|
56
|
-
"mdast-util-gfm-table": "1.0.7",
|
|
57
|
-
"mdast-util-gfm-task-list-item": "1.0.2",
|
|
58
54
|
"mdast-util-to-hast": "12.3.0",
|
|
59
|
-
"mdast-util-to-string": "
|
|
60
|
-
"micromark-extension-gfm-footnote": "1.1.2",
|
|
61
|
-
"micromark-extension-gfm-strikethrough": "1.0.7",
|
|
62
|
-
"micromark-extension-gfm-table": "1.0.7",
|
|
63
|
-
"micromark-extension-gfm-tagfilter": "1.0.2",
|
|
64
|
-
"micromark-extension-gfm-task-list-item": "1.0.5",
|
|
65
|
-
"micromark-util-combine-extensions": "1.1.0",
|
|
55
|
+
"mdast-util-to-string": "4.0.0",
|
|
66
56
|
"mime": "3.0.0",
|
|
67
57
|
"rehype-format": "4.0.1",
|
|
68
58
|
"rehype-parse": "8.0.4",
|
|
69
59
|
"remark-parse": "10.0.2",
|
|
70
60
|
"strip-markdown": "5.0.1",
|
|
71
61
|
"unified": "10.1.2",
|
|
72
|
-
"unist-util-map": "
|
|
73
|
-
"unist-util-remove": "
|
|
74
|
-
"unist-util-remove-position": "
|
|
75
|
-
"unist-util-select": "
|
|
76
|
-
"unist-util-visit": "
|
|
77
|
-
"unist-util-visit-parents": "
|
|
62
|
+
"unist-util-map": "4.0.0",
|
|
63
|
+
"unist-util-remove": "4.0.0",
|
|
64
|
+
"unist-util-remove-position": "5.0.0",
|
|
65
|
+
"unist-util-select": "5.0.0",
|
|
66
|
+
"unist-util-visit": "5.0.0",
|
|
67
|
+
"unist-util-visit-parents": "6.0.1"
|
|
78
68
|
},
|
|
79
69
|
"devDependencies": {
|
|
80
70
|
"@adobe/eslint-config-helix": "2.0.2",
|
|
@@ -83,7 +73,7 @@
|
|
|
83
73
|
"@semantic-release/git": "10.0.1",
|
|
84
74
|
"@semantic-release/npm": "10.0.4",
|
|
85
75
|
"c8": "8.0.0",
|
|
86
|
-
"eslint": "8.
|
|
76
|
+
"eslint": "8.44.0",
|
|
87
77
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
88
78
|
"eslint-plugin-header": "3.1.1",
|
|
89
79
|
"eslint-plugin-import": "2.27.5",
|
|
@@ -92,11 +82,10 @@
|
|
|
92
82
|
"js-yaml": "4.1.0",
|
|
93
83
|
"jsdom": "22.1.0",
|
|
94
84
|
"junit-report-builder": "3.0.1",
|
|
95
|
-
"lint-staged": "13.2.
|
|
85
|
+
"lint-staged": "13.2.3",
|
|
96
86
|
"mocha": "10.2.0",
|
|
97
87
|
"mocha-multi-reporters": "1.5.1",
|
|
98
|
-
"
|
|
99
|
-
"semantic-release": "21.0.5"
|
|
88
|
+
"semantic-release": "21.0.7"
|
|
100
89
|
},
|
|
101
90
|
"lint-staged": {
|
|
102
91
|
"*.js": "eslint",
|
package/src/PipelineState.d.ts
CHANGED
package/src/PipelineState.js
CHANGED
package/src/json-pipe.js
CHANGED
|
@@ -98,7 +98,6 @@ async function computeSurrogateKeys(path, contentBusId) {
|
|
|
98
98
|
export async function jsonPipe(state, req) {
|
|
99
99
|
const { log } = state;
|
|
100
100
|
state.type = 'json';
|
|
101
|
-
const { contentBusId } = state;
|
|
102
101
|
const { extension } = state.info;
|
|
103
102
|
const { searchParams } = req.url;
|
|
104
103
|
const params = Object.fromEntries(searchParams.entries());
|
|
@@ -174,7 +173,7 @@ export async function jsonPipe(state, req) {
|
|
|
174
173
|
});
|
|
175
174
|
|
|
176
175
|
// set surrogate keys
|
|
177
|
-
const keys = await computeSurrogateKeys(state.info.path, contentBusId);
|
|
176
|
+
const keys = await computeSurrogateKeys(state.info.path, state.contentBusId);
|
|
178
177
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
179
178
|
|
|
180
179
|
await setCustomResponseHeaders(state, req, res);
|
|
@@ -191,7 +190,7 @@ export async function jsonPipe(state, req) {
|
|
|
191
190
|
await setCustomResponseHeaders(state, req, res);
|
|
192
191
|
}
|
|
193
192
|
if (res.status === 404) {
|
|
194
|
-
const keys = await computeSurrogateKeys(state.info.path, contentBusId);
|
|
193
|
+
const keys = await computeSurrogateKeys(state.info.path, state.contentBusId);
|
|
195
194
|
res.headers.set('x-surrogate-key', keys.join(' '));
|
|
196
195
|
}
|
|
197
196
|
return res;
|
package/src/options-pipe.js
CHANGED
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
+
import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
|
|
12
13
|
import { PipelineResponse } from './PipelineResponse.js';
|
|
13
14
|
import fetchConfigAll from './steps/fetch-config-all.js';
|
|
14
15
|
import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
|
|
16
|
+
import fetchConfig from './steps/fetch-config.js';
|
|
17
|
+
import { PipelineStatusError } from './PipelineStatusError.js';
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Handles options requests
|
|
@@ -20,18 +23,39 @@ import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
|
|
|
20
23
|
* @returns {Response} a response
|
|
21
24
|
*/
|
|
22
25
|
export async function optionsPipe(state, request) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
await fetchConfigAll(state, request, response);
|
|
34
|
-
await setCustomResponseHeaders(state, request, response);
|
|
26
|
+
try {
|
|
27
|
+
await fetchConfig(state, request);
|
|
28
|
+
if (!state.contentBusId) {
|
|
29
|
+
return new PipelineResponse('', {
|
|
30
|
+
status: 400,
|
|
31
|
+
headers: {
|
|
32
|
+
'x-error': 'contentBusId missing',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
// todo: improve
|
|
38
|
+
const res = new PipelineResponse('', {
|
|
39
|
+
status: 204,
|
|
40
|
+
headers: {
|
|
41
|
+
// Set preflight cache duration
|
|
42
|
+
'access-control-max-age': '86400',
|
|
43
|
+
// Allow content type header
|
|
44
|
+
'access-control-allow-headers': 'content-type',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
await fetchConfigAll(state, request, res);
|
|
48
|
+
await setCustomResponseHeaders(state, request, res);
|
|
49
|
+
|
|
50
|
+
return res;
|
|
51
|
+
} catch (e) {
|
|
52
|
+
const res = new PipelineResponse('', {
|
|
53
|
+
status: e instanceof PipelineStatusError ? e.code : 500,
|
|
54
|
+
});
|
|
55
|
+
const level = res.status >= 500 ? 'error' : 'info';
|
|
56
|
+
state.log[level](`pipeline status: ${res.status} ${e.message}`);
|
|
57
|
+
res.headers.set('x-error', cleanupHeaderValue(e.message));
|
|
58
|
+
res.headers.set('cache-control', 'no-store, private, must-revalidate');
|
|
59
|
+
return res;
|
|
60
|
+
}
|
|
37
61
|
}
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
import { unified } from 'unified';
|
|
13
13
|
import remarkParse from 'remark-parse';
|
|
14
14
|
import { removePosition } from 'unist-util-remove-position';
|
|
15
|
-
import { dereference } from '@adobe/helix-markdown-support';
|
|
15
|
+
import { dereference, remarkGfmNoLink } from '@adobe/helix-markdown-support';
|
|
16
16
|
import { remarkMatter } from '@adobe/helix-markdown-support/matter';
|
|
17
17
|
import remarkGridTable from '@adobe/remark-gridtables';
|
|
18
|
-
import remarkGfm from '../utils/remark-gfm-nolink.js';
|
|
19
18
|
|
|
20
19
|
export class FrontmatterParsingError extends Error {
|
|
21
20
|
}
|
|
@@ -32,7 +31,7 @@ export default function parseMarkdown(state) {
|
|
|
32
31
|
const converted = content.data.replace(/(\r\n|\n|\r)/gm, '\n');
|
|
33
32
|
content.mdast = unified()
|
|
34
33
|
.use(remarkParse)
|
|
35
|
-
.use(
|
|
34
|
+
.use(remarkGfmNoLink)
|
|
36
35
|
.use(remarkMatter, {
|
|
37
36
|
errorHandler: (e) => {
|
|
38
37
|
log.warn(new FrontmatterParsingError(e));
|
|
@@ -41,6 +40,6 @@ export default function parseMarkdown(state) {
|
|
|
41
40
|
.use(remarkGridTable)
|
|
42
41
|
.parse(converted);
|
|
43
42
|
|
|
44
|
-
removePosition(content.mdast, true);
|
|
43
|
+
removePosition(content.mdast, { force: true });
|
|
45
44
|
dereference(content.mdast);
|
|
46
45
|
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
copied from
|
|
15
|
-
https://github.com/micromark/micromark-extension-gfm/blob/7bc6b6f3baf941f877d7b2111e9257b21b13b37e/index.js
|
|
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
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
|
43
|
-
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
|
44
|
-
*
|
|
45
|
-
* @typedef {import('mdast-util-gfm-table').Options} Options
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
// import {
|
|
49
|
-
// gfmAutolinkLiteralFromMarkdown,
|
|
50
|
-
// gfmAutolinkLiteralToMarkdown
|
|
51
|
-
// } from 'mdast-util-gfm-autolink-literal'
|
|
52
|
-
import {
|
|
53
|
-
gfmFootnoteFromMarkdown,
|
|
54
|
-
gfmFootnoteToMarkdown,
|
|
55
|
-
} from 'mdast-util-gfm-footnote';
|
|
56
|
-
import {
|
|
57
|
-
gfmStrikethroughFromMarkdown,
|
|
58
|
-
gfmStrikethroughToMarkdown,
|
|
59
|
-
} from 'mdast-util-gfm-strikethrough';
|
|
60
|
-
import { gfmTableFromMarkdown, gfmTableToMarkdown } from 'mdast-util-gfm-table';
|
|
61
|
-
import {
|
|
62
|
-
gfmTaskListItemFromMarkdown,
|
|
63
|
-
gfmTaskListItemToMarkdown,
|
|
64
|
-
} from 'mdast-util-gfm-task-list-item';
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @returns {Array.<FromMarkdownExtension>}
|
|
68
|
-
*/
|
|
69
|
-
export function gfmFromMarkdown() {
|
|
70
|
-
return [
|
|
71
|
-
gfmFootnoteFromMarkdown(),
|
|
72
|
-
gfmStrikethroughFromMarkdown,
|
|
73
|
-
gfmTableFromMarkdown,
|
|
74
|
-
// gfmAutolinkLiteralFromMarkdown,
|
|
75
|
-
gfmTaskListItemFromMarkdown,
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* @param {Options} [options]
|
|
81
|
-
* @returns {ToMarkdownExtension}
|
|
82
|
-
*/
|
|
83
|
-
export function gfmToMarkdown(options) {
|
|
84
|
-
return {
|
|
85
|
-
extensions: [
|
|
86
|
-
// gfmAutolinkLiteralToMarkdown,
|
|
87
|
-
gfmFootnoteToMarkdown(),
|
|
88
|
-
gfmStrikethroughToMarkdown,
|
|
89
|
-
gfmTableToMarkdown(options),
|
|
90
|
-
gfmTaskListItemToMarkdown,
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
copied from
|
|
15
|
-
https://github.com/syntax-tree/mdast-util-gfm/blob/544cc04ef9980fe152090bf68338444b1ed0e7a4/index.js
|
|
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
|
-
*/
|
|
40
|
-
|
|
41
|
-
/* eslint-disable no-unused-vars */
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {import('micromark-util-types').Extension} Extension
|
|
45
|
-
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
|
|
46
|
-
* @typedef {import('micromark-extension-gfm-strikethrough').Options} Options
|
|
47
|
-
* @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
import {
|
|
51
|
-
combineExtensions,
|
|
52
|
-
} from 'micromark-util-combine-extensions';
|
|
53
|
-
// import {
|
|
54
|
-
// gfmAutolinkLiteral,
|
|
55
|
-
// gfmAutolinkLiteralHtml
|
|
56
|
-
// } from 'micromark-extension-gfm-autolink-literal'
|
|
57
|
-
import { gfmFootnote, gfmFootnoteHtml } from 'micromark-extension-gfm-footnote';
|
|
58
|
-
import {
|
|
59
|
-
gfmStrikethrough,
|
|
60
|
-
gfmStrikethroughHtml,
|
|
61
|
-
} from 'micromark-extension-gfm-strikethrough';
|
|
62
|
-
import { gfmTable, gfmTableHtml } from 'micromark-extension-gfm-table';
|
|
63
|
-
import { gfmTagfilterHtml } from 'micromark-extension-gfm-tagfilter';
|
|
64
|
-
import {
|
|
65
|
-
gfmTaskListItem,
|
|
66
|
-
gfmTaskListItemHtml,
|
|
67
|
-
} from 'micromark-extension-gfm-task-list-item';
|
|
68
|
-
import { gfmFromMarkdown, gfmToMarkdown } from './mdast-util-gfm-nolink.js';
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Support GFM or markdown on github.com.
|
|
72
|
-
*
|
|
73
|
-
* @param {Options} [options]
|
|
74
|
-
* @returns {Extension}
|
|
75
|
-
*/
|
|
76
|
-
export function gfm(options) {
|
|
77
|
-
return combineExtensions([
|
|
78
|
-
// gfmAutolinkLiteral,
|
|
79
|
-
gfmFootnote(),
|
|
80
|
-
gfmStrikethrough(options),
|
|
81
|
-
gfmTable,
|
|
82
|
-
gfmTaskListItem,
|
|
83
|
-
]);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Support to compile GFM to HTML.
|
|
88
|
-
*
|
|
89
|
-
* @param {HtmlOptions} [options]
|
|
90
|
-
* @returns {HtmlExtension}
|
|
91
|
-
*/
|
|
92
|
-
// export function gfmHtml(options) {
|
|
93
|
-
// return combineHtmlExtensions([
|
|
94
|
-
// // gfmAutolinkLiteralHtml,
|
|
95
|
-
// gfmFootnoteHtml(options),
|
|
96
|
-
// gfmStrikethroughHtml,
|
|
97
|
-
// gfmTableHtml,
|
|
98
|
-
// gfmTagfilterHtml,
|
|
99
|
-
// gfmTaskListItemHtml,
|
|
100
|
-
// ]);
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Plugin to support GFM (autolink literals, footnotes, strikethrough, tables, tasklists).
|
|
105
|
-
*
|
|
106
|
-
* @type {import('unified').Plugin<[Options?]|void[], Root>}
|
|
107
|
-
*/
|
|
108
|
-
export default function remarkGfm(options = {}) {
|
|
109
|
-
const data = this.data();
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @param {string} field
|
|
113
|
-
* @param {unknown} value
|
|
114
|
-
*/
|
|
115
|
-
function add(field, value) {
|
|
116
|
-
const list = /** @type {unknown[]} */ (
|
|
117
|
-
// Other extensions
|
|
118
|
-
/* c8 ignore next 2 */
|
|
119
|
-
data[field] ? data[field] : (data[field] = [])
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
list.push(value);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
add('micromarkExtensions', gfm(options));
|
|
126
|
-
add('fromMarkdownExtensions', gfmFromMarkdown());
|
|
127
|
-
add('toMarkdownExtensions', gfmToMarkdown(options));
|
|
128
|
-
}
|