@@ -104,10 +104,11 @@ A :i[lovely] language know as :abbr[HTML]{title="HyperText Markup Language"}.
104
104
…and our module ` example.js ` contains:
105
105
106
106
``` js
107
- // Register `hName`, `hProperties` types, used when turning markdown to HTML:
108
- // / <reference types="mdast-util-to-hast" />
109
- // Register directive nodes in mdast:
110
- // / <reference types="mdast-util-directive" />
107
+ /**
108
+ * @import {} from 'mdast-util-directive'
109
+ * @import {} from 'mdast-util-to-hast'
110
+ * @import {Root} from 'mdast'
111
+ */
111
112
112
113
import {h } from ' hastscript'
113
114
import rehypeFormat from ' rehype-format'
@@ -135,7 +136,7 @@ console.log(String(file))
135
136
// See below for others examples.
136
137
function myRemarkPlugin () {
137
138
/**
138
- * @param {import('mdast'). Root} tree
139
+ * @param {Root} tree
139
140
* Tree.
140
141
* @returns {undefined}
141
142
* Nothing.
@@ -199,19 +200,21 @@ It’s based on the example in Use above.
199
200
If ` myRemarkPlugin ` was replaced with this function:
200
201
201
202
``` js
202
- // Register `hName`, `hProperties` types, used when turning markdown to HTML:
203
- // / <reference types="mdast-util-to-hast" />
204
- // Register directive nodes in mdast:
205
- // / <reference types="mdast-util-directive" />
203
+ /**
204
+ * @import {} from 'mdast-util-directive'
205
+ * @import {} from 'mdast-util-to-hast'
206
+ * @import {Root} from 'mdast'
207
+ * @import {VFile} from 'vfile'
208
+ */
206
209
207
210
import {visit } from ' unist-util-visit'
208
211
209
212
// This plugin is an example to turn `::youtube` into iframes.
210
213
function myRemarkPlugin () {
211
214
/**
212
- * @param {import('mdast'). Root} tree
215
+ * @param {Root} tree
213
216
* Tree.
214
- * @param {import('vfile'). VFile} file
217
+ * @param {VFile} file
215
218
* File.
216
219
* @returns {undefined}
217
220
* Nothing.
@@ -279,10 +282,11 @@ It’s based on the example in Use above.
279
282
If ` myRemarkPlugin ` was replaced with this function:
280
283
281
284
``` js
282
- // Register `hName`, `hProperties` types, used when turning markdown to HTML:
283
- // / <reference types="mdast-util-to-hast" />
284
- // Register directive nodes in mdast:
285
- // / <reference types="mdast-util-directive" />
285
+ /**
286
+ * @import {} from 'mdast-util-directive'
287
+ * @import {} from 'mdast-util-to-hast'
288
+ * @import {Root} from 'mdast'
289
+ */
286
290
287
291
import {h } from ' hastscript'
288
292
import {visit } from ' unist-util-visit'
@@ -291,7 +295,7 @@ import {visit} from 'unist-util-visit'
291
295
// attributes.
292
296
function myRemarkPlugin () {
293
297
/**
294
- * @param {import('mdast'). Root} tree
298
+ * @param {Root} tree
295
299
* Tree.
296
300
* @returns {undefined}
297
301
* Nothing.
@@ -372,14 +376,16 @@ If you’re working with the syntax tree, you can register the new node types
372
376
with ` @types/mdast ` by adding a reference:
373
377
374
378
``` js
375
- // Register directive nodes in mdast:
376
- // / <reference types="mdast-util-directive" />
379
+ /**
380
+ * @import {} from 'mdast-util-directive'
381
+ * @import {Root} from 'mdast'
382
+ */
377
383
378
384
import {visit } from ' unist-util-visit'
379
385
380
386
function myRemarkPlugin () {
381
387
/**
382
- * @param {import('mdast'). Root} tree
388
+ * @param {Root} tree
383
389
* Tree.
384
390
* @returns {undefined}
385
391
* Nothing.
0 commit comments