@@ -3,17 +3,16 @@ import * as fixtures from '../common/fixtures.mjs';
33
44import assert from 'assert' ;
55import { readFileSync } from 'fs' ;
6- import { createRequire } from 'module' ;
76
87import * as html from '../../tools/doc/html.mjs' ;
98import { 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' ;
1716
1817// Test links mapper is an object of the following structure:
1918// {
@@ -31,14 +30,14 @@ const testLinksMapper = {
3130function toHTML ( { input, filename, nodeVersion, versions } ) {
3231 const content = unified ( )
3332 . use ( replaceLinks , { filename, linksMapper : testLinksMapper } )
34- . use ( markdown )
33+ . use ( remarkParse )
3534 . use ( html . firstHeader )
3635 . use ( html . preprocessText , { nodeVersion } )
3736 . use ( html . preprocessElements , { filename } )
3837 . 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 )
4241 . processSync ( input ) ;
4342
4443 return html . toHTML ( { input, content, filename, nodeVersion, versions } ) ;
0 commit comments