66 * @typedef {import('mdast').Content } MdastContent
77 * @typedef {import('mdast').BlockContent } MdastBlockContent
88 * @typedef {import('mdast').DefinitionContent } MdastDefinitionContent
9- * @typedef {import('mdast').PhrasingContent } MdastPhrasingContent
109 * @typedef {import('./types.js').Options } Options
1110 * @typedef {import('./types.js').Handle } Handle
1211 * @typedef {import('./types.js').NodeHandle } NodeHandle
2120 *
2221 * @typedef State
2322 * Info passed around about the current state.
24- * @property {PatchPosition } patch
23+ * @property {Patch } patch
2524 * Copy a node’s positional info.
25+ * @property {One } one
26+ * Transform a hast node to mdast.
2627 * @property {All } all
2728 * Transform the children of a hast parent to mdast.
2829 * @property {ToFlow } toFlow
29- * Transform the children of a hast parent to mdast flow content .
30+ * Transform a list of mdast nodes to flow.
3031 * @property {<ChildType extends MdastNode, ParentType extends MdastParent & {'children': Array<ChildType>}>(nodes: Array<MdastContent>, build: (() => ParentType)) => Array<ParentType> } toSpecificContent
3132 * Turn arbitrary content into a list of a particular node type.
3233 *
3536 * in this example, when non-items are found, they will be queued, and
3637 * inserted into an adjacent item.
3738 * When no actual items exist, one will be made with `build`.
38- * @property {One } one
39- * Transform a hast node to mdast.
4039 * @property {Resolve } resolve
4140 * Resolve a URL relative to a base.
4241 * @property {Options } options
5655 * @property {number } qNesting
5756 * Non-negative finite integer representing how deep we’re in `<q>`s.
5857 *
59- * @callback PatchPosition
58+ * @callback Patch
6059 * Copy a node’s positional info.
61- * @param {Node } origin
60+ * @param {Node } from
6261 * hast node to copy from.
63- * @param {MdastNode } node
62+ * @param {MdastNode } to
6463 * mdast node to copy into.
6564 * @returns {void }
6665 * Nothing.
7372 * mdast children.
7473 *
7574 * @callback ToFlow
76- * Transform the children of a hast parent to mdast, as flow content .
75+ * Transform a list of mdast nodes to flow.
7776 * @param {Array<MdastContent> } nodes
7877 * mdast nodes.
7978 * @returns {Array<MdastFlowContent> }
@@ -233,7 +232,7 @@ function all(parent) {
233232}
234233
235234/**
236- * Transform the children of a hast parent to mdast .
235+ * Transform a list of mdast nodes to flow .
237236 *
238237 * @this {State}
239238 * Info passed around about the current state.
@@ -247,29 +246,7 @@ function toFlow(nodes) {
247246}
248247
249248/**
250- * @this {State}
251- * Info passed around about the current state.
252- * @param {string | null | undefined } url
253- * Possible URL value.
254- * @returns {string }
255- * URL, resolved to a `base` element, if any.
256- */
257- function resolve ( url ) {
258- const base = this . frozenBaseUrl
259-
260- if ( url === null || url === undefined ) {
261- return ''
262- }
263-
264- if ( base ) {
265- return String ( new URL ( url , base ) )
266- }
267-
268- return url
269- }
270-
271- /**
272- * Turn arbitrary content into a list of a particular node type.
249+ * Turn arbitrary content into a particular node type.
273250 *
274251 * This is useful for example for lists, which must have list items as content.
275252 * in this example, when non-items are found, they will be queued, and
@@ -335,3 +312,25 @@ function toSpecificContent(nodes, build) {
335312 return node . type === reference . type
336313 }
337314}
315+
316+ /**
317+ * @this {State}
318+ * Info passed around about the current state.
319+ * @param {string | null | undefined } url
320+ * Possible URL value.
321+ * @returns {string }
322+ * URL, resolved to a `base` element, if any.
323+ */
324+ function resolve ( url ) {
325+ const base = this . frozenBaseUrl
326+
327+ if ( url === null || url === undefined ) {
328+ return ''
329+ }
330+
331+ if ( base ) {
332+ return String ( new URL ( url , base ) )
333+ }
334+
335+ return url
336+ }
0 commit comments