@@ -3,17 +3,16 @@ import * as fixtures from '../common/fixtures.mjs';
3
3
4
4
import assert from 'assert' ;
5
5
import { readFileSync } from 'fs' ;
6
- import { createRequire } from 'module' ;
7
6
8
7
import * as html from '../../tools/doc/html.mjs' ;
9
8
import { replaceLinks } from '../../tools/doc/markdown.mjs' ;
10
-
11
- const require = createRequire ( new URL ( '../../tools/doc/' , import . meta . url ) ) ;
12
- const unified = require ( 'unified' ) ;
13
- const markdown = require ( 'remark-parse' ) ;
14
- const remark2rehype = require ( 'remark-rehype' ) ;
15
- const raw = require ( 'rehype-raw' ) ;
16
- const htmlStringify = require ( 'rehype-stringify' ) ;
9
+ import {
10
+ rehypeRaw ,
11
+ rehypeStringify ,
12
+ remarkParse ,
13
+ remarkRehype ,
14
+ unified ,
15
+ } from '../../tools/doc/deps.mjs' ;
17
16
18
17
// Test links mapper is an object of the following structure:
19
18
// {
@@ -31,14 +30,14 @@ const testLinksMapper = {
31
30
function toHTML ( { input, filename, nodeVersion, versions } ) {
32
31
const content = unified ( )
33
32
. use ( replaceLinks , { filename, linksMapper : testLinksMapper } )
34
- . use ( markdown )
33
+ . use ( remarkParse )
35
34
. use ( html . firstHeader )
36
35
. use ( html . preprocessText , { nodeVersion } )
37
36
. use ( html . preprocessElements , { filename } )
38
37
. use ( html . buildToc , { filename, apilinks : { } } )
39
- . use ( remark2rehype , { allowDangerousHtml : true } )
40
- . use ( raw )
41
- . use ( htmlStringify )
38
+ . use ( remarkRehype , { allowDangerousHtml : true } )
39
+ . use ( rehypeRaw )
40
+ . use ( rehypeStringify )
42
41
. processSync ( input ) ;
43
42
44
43
return html . toHTML ( { input, content, filename, nodeVersion, versions } ) ;
0 commit comments