1
+ import assert from 'node:assert/strict'
1
2
import fs from 'node:fs'
2
3
import path from 'node:path'
3
4
import test from 'tape'
4
- import Slugger from 'github-slugger'
5
+ import { slug } from 'github-slugger'
5
6
import { toHast } from 'mdast-util-to-hast'
6
7
import { toHtml } from 'hast-util-to-html'
7
8
import { fromMarkdown } from 'mdast-util-from-markdown'
@@ -18,7 +19,7 @@ test('markdown -> mdast', (t) => {
18
19
19
20
while ( ++ index < files . length ) {
20
21
const example = files [ index ]
21
- const category = Slugger . slug ( example . category )
22
+ const category = slug ( example . category )
22
23
const name = index + '-' + category
23
24
const fixtureHtmlPath = path . join ( 'test' , name + '.html' )
24
25
const fixtureMarkdownPath = path . join ( 'test' , name + '.md' )
@@ -28,14 +29,14 @@ test('markdown -> mdast', (t) => {
28
29
mdastExtensions : [ gfmFromMarkdown ( ) ]
29
30
} )
30
31
31
- const html = toHtml (
32
- toHast ( mdast , { allowDangerousHtml : true , commonmark : true } ) ,
33
- {
34
- allowDangerousHtml : true ,
35
- entities : { useNamedReferences : true } ,
36
- closeSelfClosing : true
37
- }
38
- )
32
+ const hast = toHast ( mdast , { allowDangerousHtml : true , commonmark : true } )
33
+ assert ( hast , 'expected node' )
34
+
35
+ const html = toHtml ( hast , {
36
+ allowDangerousHtml : true ,
37
+ entities : { useNamedReferences : true } ,
38
+ closeSelfClosing : true
39
+ } )
39
40
40
41
let fixtureHtml
41
42
let fixtureMarkdown
0 commit comments