|
4 | 4 | * @typedef {import('./plugin/recma-document.js').RecmaDocumentOptions} RecmaDocumentOptions
|
5 | 5 | * @typedef {import('./plugin/recma-stringify.js').RecmaStringifyOptions} RecmaStringifyOptions
|
6 | 6 | * @typedef {import('./plugin/recma-jsx-rewrite.js').RecmaJsxRewriteOptions} RecmaJsxRewriteOptions
|
| 7 | + * @typedef {import('remark-rehype').Options} RemarkRehypeOptions |
7 | 8 | *
|
8 | 9 | * @typedef BaseProcessorOptions
|
9 | 10 | * @property {boolean} [jsx=false]
|
|
22 | 23 | * List of remark (mdast, markdown) plugins.
|
23 | 24 | * @property {PluggableList} [rehypePlugins]
|
24 | 25 | * List of rehype (hast, HTML) plugins.
|
| 26 | + * @property {RemarkRehypeOptions} [remarkRehypeOptions] |
| 27 | + * Options to pass through to `remark-rehype`. |
25 | 28 | *
|
26 | 29 | * @typedef {Omit<RecmaDocumentOptions & RecmaStringifyOptions & RecmaJsxRewriteOptions, 'outputFormat'>} PluginOptions
|
27 | 30 | * @typedef {BaseProcessorOptions & PluginOptions} ProcessorOptions
|
@@ -70,6 +73,7 @@ export function createProcessor(options = {}) {
|
70 | 73 | recmaPlugins,
|
71 | 74 | rehypePlugins,
|
72 | 75 | remarkPlugins,
|
| 76 | + remarkRehypeOptions = {}, |
73 | 77 | SourceMapGenerator,
|
74 | 78 | ...rest
|
75 | 79 | } = options
|
@@ -103,7 +107,12 @@ export function createProcessor(options = {}) {
|
103 | 107 | pipeline
|
104 | 108 | .use(remarkMarkAndUnravel)
|
105 | 109 | .use(remarkPlugins || [])
|
106 |
| - .use(remarkRehype, {allowDangerousHtml: true, passThrough: nodeTypes}) |
| 110 | + .use(remarkRehype, { |
| 111 | + ...remarkRehypeOptions, |
| 112 | + allowDangerousHtml: true, |
| 113 | + /* c8 ignore next */ |
| 114 | + passThrough: [...(remarkRehypeOptions.passThrough || []), ...nodeTypes] |
| 115 | + }) |
107 | 116 | .use(rehypePlugins || [])
|
108 | 117 |
|
109 | 118 | if (format === 'md') {
|
|
1 commit comments
vercel[bot] commentedon Feb 9, 2022
Successfully deployed to the following URLs: