Socket
Socket
Sign inDemoInstall

mdast-util-to-hast

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-to-hast - npm Package Compare versions

Comparing version 12.2.4 to 12.2.5

2

index.d.ts

@@ -5,4 +5,4 @@ export type Options = import('./lib/index.js').Options

export type H = import('./lib/index.js').H
export type Raw = import('./complex-types').Raw
export type Raw = import('./complex-types.js').Raw
export {one, all} from './lib/traverse.js'
export {defaultHandlers, toHast} from './lib/index.js'

@@ -6,3 +6,3 @@ /**

* @typedef {import('./lib/index.js').H} H
* @typedef {import('./complex-types').Raw} Raw
* @typedef {import('./complex-types.js').Raw} Raw
*/

@@ -9,0 +9,0 @@

/**
* @type {Handler}
* @param {H} h
* @param {Blockquote} node
*/
export function blockquote(
h: import('../index.js').H,
node: Blockquote
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function blockquote(h: H, node: Blockquote): import('hast').Element
export type Blockquote = import('mdast').Blockquote
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Blockquote} Blockquote
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -10,3 +10,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Blockquote} node

@@ -13,0 +13,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Break} node
* @returns {Array<Element|Text>}
*/
export function hardBreak(
h: import('../index.js').H,
node: Break
): Array<Element | Text>
export function hardBreak(h: H, node: Break): Array<Element | Text>
export type Element = import('hast').Element
export type Text = import('hast').Text
export type Break = import('mdast').Break
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H

@@ -5,3 +5,3 @@ /**

* @typedef {import('mdast').Break} Break
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -12,3 +12,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Break} node

@@ -15,0 +15,0 @@ * @returns {Array<Element|Text>}

/**
* @type {Handler}
* @param {H} h
* @param {Code} node
*/
export function code(
h: import('../index.js').H,
node: Code
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function code(h: H, node: Code): import('hast').Element
export type Code = import('mdast').Code
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Code} Code
* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -10,3 +11,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Code} node

@@ -13,0 +14,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Delete} node
*/
export function strikethrough(
h: import('../index.js').H,
node: Delete
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function strikethrough(h: H, node: Delete): import('hast').Element
export type Delete = import('mdast').Delete
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Delete} Delete
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +10,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Delete} node

@@ -12,0 +13,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Emphasis} node
*/
export function emphasis(
h: import('../index.js').H,
node: Emphasis
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function emphasis(h: H, node: Emphasis): import('hast').Element
export type Emphasis = import('mdast').Emphasis
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Emphasis} Emphasis
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +9,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Emphasis} node

@@ -12,0 +12,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {FootnoteReference} node
*/
export function footnoteReference(
h: import('../index.js').H,
h: H,
node: FootnoteReference
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
): import('hast').Element
export type FootnoteReference = import('mdast').FootnoteReference
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').FootnoteReference} FootnoteReference
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -10,3 +10,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {FootnoteReference} node

@@ -13,0 +13,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Footnote} node
*/
export function footnote(
h: import('../index.js').H,
node: Footnote
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function footnote(h: H, node: Footnote): import('hast').Element
export type Footnote = import('mdast').Footnote
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Footnote} Footnote
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*

@@ -16,3 +16,3 @@ * @todo

/**
* @type {Handler}
* @param {H} h
* @param {Footnote} node

@@ -19,0 +19,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Heading} node
*/
export function heading(
h: import('../index.js').H,
node: Heading
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function heading(h: H, node: Heading): import('hast').Element
export type Heading = import('mdast').Heading
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Heading} Heading
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +9,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Heading} node

@@ -12,0 +12,0 @@ */

/**
* Return either a `raw` node in dangerous mode, otherwise nothing.
*
* @type {Handler}
* @param {H} h
* @param {HTML} node
*/
export function html(
h: import('../index.js').H,
node: HTML
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function html(h: H, node: HTML): import('hast').ElementContent | null
export type HTML = import('mdast').HTML
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').HTML} HTML
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -11,3 +11,3 @@

*
* @type {Handler}
* @param {H} h
* @param {HTML} node

@@ -14,0 +14,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {ImageReference} node
*/
export function imageReference(
h: import('../index.js').H,
h: H,
node: ImageReference
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
): import('hast').ElementContent | import('hast').ElementContent[]
export type ImageReference = import('mdast').ImageReference
export type Parent = import('mdast').Parent
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').ImageReference} ImageReference
* @typedef {import('mdast').Parent} Parent
* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -11,3 +12,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {ImageReference} node

@@ -14,0 +15,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Image} node
*/
export function image(
h: import('../index.js').H,
node: Image
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function image(h: H, node: Image): import('hast').Element
export type Image = import('mdast').Image
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Image} Image
* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -10,3 +10,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Image} node

@@ -13,0 +13,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {InlineCode} node
*/
export function inlineCode(
h: import('../index.js').H,
node: InlineCode
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function inlineCode(h: H, node: InlineCode): import('hast').Element
export type InlineCode = import('mdast').InlineCode
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').InlineCode} InlineCode
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +9,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {InlineCode} node

@@ -12,0 +12,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {LinkReference} node
*/
export function linkReference(
h: import('../index.js').H,
h: H,
node: LinkReference
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
): import('hast').ElementContent | import('hast').ElementContent[]
export type LinkReference = import('mdast').LinkReference
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
export type Parent = import('mdast').Parent
/**
* @typedef {import('mdast').LinkReference} LinkReference
* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
* @typedef {import('mdast').Parent} Parent
*/

@@ -12,3 +13,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {LinkReference} node

@@ -15,0 +16,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Link} node
*/
export function link(
h: import('../index.js').H,
node: Link
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function link(h: H, node: Link): import('hast').Element
export type Link = import('mdast').Link
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Link} Link
* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -11,3 +11,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Link} node

@@ -14,0 +14,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {ListItem} node

@@ -7,10 +7,6 @@ * @param {List} parent

export function listItem(
h: import('../index.js').H,
h: H,
node: ListItem,
parent: List
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
): import('hast').Element
export type ListItem = import('mdast').ListItem

@@ -20,3 +16,3 @@ export type List = import('mdast').List

export type Element = import('hast').Element
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
export type Content = import('../index.js').Content

@@ -6,3 +6,3 @@ /**

* @typedef {import('hast').Element} Element
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
* @typedef {import('../index.js').Content} Content

@@ -15,3 +15,3 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {ListItem} node

@@ -18,0 +18,0 @@ * @param {List} parent

/**
* @type {Handler}
* @param {H} h
* @param {List} node
* @returns {Element}
*/
export function list(h: import('../index.js').H, node: List): Element
export function list(h: H, node: List): import('hast').Element
export type List = import('mdast').List
export type Element = import('hast').Element
export type Properties = import('hast').Properties
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H

@@ -5,3 +5,3 @@ /**

* @typedef {import('hast').Properties} Properties
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -13,5 +13,4 @@

/**
* @type {Handler}
* @param {H} h
* @param {List} node
* @returns {Element}
*/

@@ -18,0 +17,0 @@ export function list(h, node) {

/**
* @type {Handler}
* @param {H} h
* @param {Paragraph} node
*/
export function paragraph(
h: import('../index.js').H,
node: Paragraph
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function paragraph(h: H, node: Paragraph): import('hast').Element
export type Paragraph = import('mdast').Paragraph
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Paragraph} Paragraph
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +9,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Paragraph} node

@@ -12,0 +12,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Root} node
*/
export function root(
h: import('../index.js').H,
node: Root
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function root(h: H, node: Root): import('hast').ElementContent
export type Root = import('mdast').Root
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Root} Root
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -11,3 +11,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Root} node

@@ -14,0 +14,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Strong} node
*/
export function strong(
h: import('../index.js').H,
node: Strong
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function strong(h: H, node: Strong): import('hast').Element
export type Strong = import('mdast').Strong
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Strong} Strong
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -9,3 +9,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Strong} node

@@ -12,0 +12,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Table} node
*/
export function table(
h: import('../index.js').H,
node: Table
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function table(h: H, node: Table): import('hast').Element
export type Table = import('mdast').Table
export type Element = import('hast').Element
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
export type Content = import('../index.js').Content
/**
* @typedef {import('mdast').Table} Table
* @typedef {import('hast').Element} Element
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
* @typedef {import('../index.js').Content} Content

@@ -13,3 +13,3 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Table} node

@@ -16,0 +16,0 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {Text} node
*/
export function text(
h: import('../index.js').H,
node: Text
):
| import('hast').ElementContent
| import('hast').ElementContent[]
| null
| undefined
export function text(h: H, node: Text): import('hast').ElementContent
export type Text = import('mdast').Text
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').Text} Text
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/

@@ -10,3 +10,3 @@

/**
* @type {Handler}
* @param {H} h
* @param {Text} node

@@ -13,0 +13,0 @@ */

/**
* @typedef {import('mdast').ThematicBreak} ThematicBreak
* @typedef {import('hast').Element} Element
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/
/**
* @type {Handler}
* @param {H} h
* @param {ThematicBreak} [node]
* @returns {Element}
*/
export function thematicBreak(
h: import('../index.js').H,
h: H,
node?: import('mdast').ThematicBreak | undefined
): Element
): import('hast').Element
export type ThematicBreak = import('mdast').ThematicBreak
export type Element = import('hast').Element
export type Handler = import('../index.js').Handler
export type H = import('../index.js').H
/**
* @typedef {import('mdast').ThematicBreak} ThematicBreak
* @typedef {import('hast').Element} Element
* @typedef {import('../index.js').Handler} Handler
* @typedef {import('../index.js').H} H
*/
/**
* @type {Handler}
* @param {H} h
* @param {ThematicBreak} [node]
* @returns {Element}
*/

@@ -12,0 +11,0 @@ export function thematicBreak(h, node) {

/**
* Return the content of a reference without definition as plain text.
*
* @type {Handler}
* @param {H} h
* @param {ImageReference|LinkReference} node

@@ -9,3 +9,3 @@ * @returns {Content|Array<Content>}

export function revert(
h: import('./index.js').H,
h: H,
node: ImageReference | LinkReference

@@ -15,3 +15,3 @@ ): Content | Array<Content>

export type ImageReference = import('mdast').ImageReference
export type Handler = import('./index.js').Handler
export type H = import('./index.js').H
export type Content = import('./index.js').Content
/**
* @typedef {import('mdast').LinkReference} LinkReference
* @typedef {import('mdast').ImageReference} ImageReference
* @typedef {import('./index.js').Handler} Handler
* @typedef {import('./index.js').H} H
* @typedef {import('./index.js').Content} Content

@@ -14,3 +14,3 @@ */

*
* @type {Handler}
* @param {H} h
* @param {ImageReference|LinkReference} node

@@ -17,0 +17,0 @@ * @returns {Content|Array<Content>}

/**
* @type {Handler}
* @param {H} h
* @param {MdastNode} node
* @param {MdastParent | null} parent
*/
export function one(
h: import('./index.js').H,
h: H,
node: MdastNode,
parent: import('mdast').Parent | null
parent: MdastParent | null
):

@@ -19,7 +20,6 @@ | import('hast').ElementContent

export function all(h: H, parent: MdastNode): import('hast').ElementContent[]
export type MdastNode =
| import('mdast').Root
| import('mdast').Parent['children'][number]
export type MdastNode = import('mdast').Root | import('mdast').Content
export type MdastParent = Extract<MdastNode, import('mdast').Parent>
export type Handler = import('./index.js').Handler
export type H = import('./index.js').H
export type Handler = import('./index.js').Handler
export type Content = import('./index.js').Content
/**
* @typedef {import('mdast').Root|import('mdast').Parent['children'][number]} MdastNode
* @typedef {import('mdast').Root|import('mdast').Content} MdastNode
* @typedef {Extract<MdastNode, import('mdast').Parent>} MdastParent
* @typedef {import('./index.js').Handler} Handler
* @typedef {import('./index.js').H} H
* @typedef {import('./index.js').Handler} Handler
* @typedef {import('./index.js').Content} Content

@@ -14,3 +15,4 @@ */

* Transform an unknown node.
* @type {Handler}
*
* @param {H} h
* @param {MdastNode} node

@@ -36,4 +38,5 @@ */

/**
* @type {Handler}
* @param {H} h
* @param {MdastNode} node
* @param {MdastParent | null} parent
*/

@@ -62,7 +65,8 @@ export function one(h, node, parent) {

/**
* @type {Handler}
* @param {MdastNode} node
* @template {MdastNode} Node
* @param {H} h
* @param {Node} node
* @returns {Node}
*/
function returnNode(h, node) {
// @ts-expect-error: Pass through custom node.
return 'children' in node ? {...node, children: all(h, node)} : node

@@ -69,0 +73,0 @@ }

{
"name": "mdast-util-to-hast",
"version": "12.2.4",
"version": "12.2.5",
"description": "mdast utility to transform to hast",

@@ -62,3 +62,3 @@ "license": "MIT",

"typescript": "^4.0.0",
"xo": "^0.52.0"
"xo": "^0.53.0"
},

@@ -65,0 +65,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc