mdast-util-to-hast
Advanced tools
+2
-2
@@ -19,3 +19,3 @@ /** | ||
| let index = -1 | ||
| /** @type {ElementContent[]} */ | ||
| /** @type {Array<ElementContent>} */ | ||
| const listItems = [] | ||
@@ -34,3 +34,3 @@ | ||
| let referenceIndex = 0 | ||
| /** @type {ElementContent[]} */ | ||
| /** @type {Array<ElementContent>} */ | ||
| const backReferences = [] | ||
@@ -37,0 +37,0 @@ |
@@ -23,3 +23,3 @@ /** | ||
| const props = {} | ||
| /** @type {Array.<Content>} */ | ||
| /** @type {Array<Content>} */ | ||
| const wrapped = [] | ||
@@ -26,0 +26,0 @@ |
@@ -21,3 +21,3 @@ /** | ||
| const align = node.align || [] | ||
| /** @type {Array.<Element>} */ | ||
| /** @type {Array<Element>} */ | ||
| const result = [] | ||
@@ -28,9 +28,12 @@ | ||
| const name = index === 0 ? 'th' : 'td' | ||
| let pos = node.align ? align.length : row.length | ||
| /** @type {Array.<Content>} */ | ||
| /** @type {Array<Content>} */ | ||
| const out = [] | ||
| let cellIndex = -1 | ||
| const length = node.align ? align.length : row.length | ||
| while (pos--) { | ||
| const cell = row[pos] | ||
| out[pos] = h(cell, name, {align: align[pos]}, cell ? all(h, cell) : []) | ||
| while (++cellIndex < length) { | ||
| const cell = row[cellIndex] | ||
| out.push( | ||
| h(cell, name, {align: align[cellIndex]}, cell ? all(h, cell) : []) | ||
| ) | ||
| } | ||
@@ -37,0 +40,0 @@ |
+2
-6
@@ -46,5 +46,3 @@ /** | ||
| */ | ||
| export type Data = { | ||
| [x: string]: unknown | ||
| } & EmbeddedHastFields | ||
| export type Data = Record<string, unknown> & EmbeddedHastFields | ||
| /** | ||
@@ -96,5 +94,3 @@ * unist node with embedded hast data | ||
| */ | ||
| footnoteById: { | ||
| [x: string]: FootnoteDefinition | ||
| } | ||
| footnoteById: Record<string, FootnoteDefinition> | ||
| /** | ||
@@ -101,0 +97,0 @@ * Order in which footnotes occur |
+14
-14
@@ -18,5 +18,5 @@ /** | ||
| * @property {Properties} [hProperties] Defines the properties of an element | ||
| * @property {Array.<Content>} [hChildren] Defines the (hast) children of an element | ||
| * @property {Array<Content>} [hChildren] Defines the (hast) children of an element | ||
| * | ||
| * @typedef {Object.<string, unknown> & EmbeddedHastFields} Data unist data with embedded hast fields | ||
| * @typedef {Record<string, unknown> & EmbeddedHastFields} Data unist data with embedded hast fields | ||
| * | ||
@@ -29,3 +29,3 @@ * @typedef {MdastNode & {data?: Data}} NodeWithData unist node with embedded hast data | ||
| * @param {Parent|null} parent Parent of `node` | ||
| * @returns {Content|Array.<Content>|null|undefined} hast node | ||
| * @returns {Content|Array<Content>|null|undefined} hast node | ||
| * | ||
@@ -36,3 +36,3 @@ * @callback HFunctionProps | ||
| * @param {Properties} props Properties | ||
| * @param {Array.<Content>?} [children] hast content | ||
| * @param {Array<Content>?} [children] hast content | ||
| * @returns {Element} | ||
@@ -43,3 +43,3 @@ * | ||
| * @param {string} tagName HTML tag name | ||
| * @param {Array.<Content>?} [children] hast content | ||
| * @param {Array<Content>?} [children] hast content | ||
| * @returns {Element} | ||
@@ -53,9 +53,9 @@ * | ||
| * @property {(identifier: string) => Definition|null} definition Definition cache | ||
| * @property {Object.<string, FootnoteDefinition>} footnoteById Footnote cache | ||
| * @property {Array.<string>} footnoteOrder Order in which footnotes occur | ||
| * @property {Record.<string, number>} footnoteCounts Counts the same footnote was used | ||
| * @property {Record<string, FootnoteDefinition>} footnoteById Footnote cache | ||
| * @property {Array<string>} footnoteOrder Order in which footnotes occur | ||
| * @property {Record<string, number>} footnoteCounts Counts the same footnote was used | ||
| * @property {Handlers} handlers Applied handlers | ||
| * @property {Handler} unknownHandler Handler for any none not in `passThrough` or otherwise handled | ||
| * @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content} augment Like `h` but lower-level and usable on non-elements. | ||
| * @property {Array.<string>} passThrough List of node types to pass through untouched (except for their children). | ||
| * @property {Array<string>} passThrough List of node types to pass through untouched (except for their children). | ||
| * | ||
@@ -87,3 +87,3 @@ * @typedef Options | ||
| * Object mapping mdast nodes to functions handling them | ||
| * @property {Array.<string>} [passThrough] | ||
| * @property {Array<string>} [passThrough] | ||
| * List of custom mdast node types to pass through (keep) in hast | ||
@@ -93,3 +93,3 @@ * @property {Handler} [unknownHandler] | ||
| * | ||
| * @typedef {Record.<string, Handler>} Handlers | ||
| * @typedef {Record<string, Handler>} Handlers | ||
| * Map of node types to handlers | ||
@@ -120,3 +120,3 @@ * @typedef {HFunctionProps & HFunctionNoProps & HFields} H | ||
| const dangerous = settings.allowDangerousHtml || false | ||
| /** @type {Object.<string, FootnoteDefinition>} */ | ||
| /** @type {Record<string, FootnoteDefinition>} */ | ||
| const footnoteById = {} | ||
@@ -133,5 +133,5 @@ | ||
| h.footnoteById = footnoteById | ||
| /** @type {Array.<string>} */ | ||
| /** @type {Array<string>} */ | ||
| h.footnoteOrder = [] | ||
| /** @type {Record.<string, number>} */ | ||
| /** @type {Record<string, number>} */ | ||
| h.footnoteCounts = {} | ||
@@ -138,0 +138,0 @@ h.augment = augment |
+1
-1
@@ -6,3 +6,3 @@ /** | ||
| * @param {ImageReference|LinkReference} node | ||
| * @returns {Content|Array.<Content>} | ||
| * @returns {Content|Array<Content>} | ||
| */ | ||
@@ -9,0 +9,0 @@ export function revert( |
+1
-1
@@ -16,3 +16,3 @@ /** | ||
| * @param {ImageReference|LinkReference} node | ||
| * @returns {Content|Array.<Content>} | ||
| * @returns {Content|Array<Content>} | ||
| */ | ||
@@ -19,0 +19,0 @@ export function revert(h, node) { |
+1
-1
@@ -73,3 +73,3 @@ /** | ||
| export function all(h, parent) { | ||
| /** @type {Array.<Content>} */ | ||
| /** @type {Array<Content>} */ | ||
| const values = [] | ||
@@ -76,0 +76,0 @@ |
+2
-2
@@ -5,5 +5,5 @@ /** | ||
| * | ||
| * @param {Array.<Content>} nodes | ||
| * @param {Array<Content>} nodes | ||
| * @param {boolean} [loose=false] | ||
| * @returns {Array.<Content>} | ||
| * @returns {Array<Content>} | ||
| */ | ||
@@ -10,0 +10,0 @@ export function wrap( |
+3
-3
@@ -11,8 +11,8 @@ /** | ||
| * | ||
| * @param {Array.<Content>} nodes | ||
| * @param {Array<Content>} nodes | ||
| * @param {boolean} [loose=false] | ||
| * @returns {Array.<Content>} | ||
| * @returns {Array<Content>} | ||
| */ | ||
| export function wrap(nodes, loose) { | ||
| /** @type {Array.<Content>} */ | ||
| /** @type {Array<Content>} */ | ||
| const result = [] | ||
@@ -19,0 +19,0 @@ let index = -1 |
+1
-1
| { | ||
| "name": "mdast-util-to-hast", | ||
| "version": "12.1.0", | ||
| "version": "12.1.1", | ||
| "description": "mdast utility to transform to hast", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+1
-1
@@ -111,3 +111,3 @@ # mdast-util-to-hast | ||
| List of custom mdast node types to pass through (keep) in hast | ||
| (`Array.<string>`, default: `[]`). | ||
| (`Array<string>`, default: `[]`). | ||
| If the passed through nodes have children, those children are expected to be | ||
@@ -114,0 +114,0 @@ mdast and will be handled. |
64653
0.07%1745
-0.06%