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 13.1.0 to 13.2.0

9

index.d.ts

@@ -40,2 +40,11 @@ import type {Data, ElementContent, Literal, Properties} from 'hast'

declare module 'hast' {
interface ElementData {
/**
* Custom info relating to the node, if `<code>` in `<pre>`.
*
* Defined by `mdast-util-to-hast` (`remark-rehype`).
*/
meta?: string | null | undefined
}
interface ElementContentMap {

@@ -42,0 +51,0 @@ /**

6

lib/footer.d.ts

@@ -34,5 +34,5 @@ /**

export function footer(state: State): Element | undefined;
export type Element = import('hast').Element;
export type ElementContent = import('hast').ElementContent;
export type State = import('./state.js').State;
export type Element = import("hast").Element;
export type ElementContent = import("hast").ElementContent;
export type State = import("./state.js").State;
/**

@@ -39,0 +39,0 @@ * Generate content for the backreference dynamically.

@@ -144,10 +144,12 @@ /**

while (++referenceIndex < state.footnoteOrder.length) {
const def = state.footnoteById.get(state.footnoteOrder[referenceIndex])
const definition = state.footnoteById.get(
state.footnoteOrder[referenceIndex]
)
if (!def) {
if (!definition) {
continue
}
const content = state.all(def)
const id = String(def.identifier).toUpperCase()
const content = state.all(definition)
const id = String(definition.identifier).toUpperCase()
const safeId = normalizeUri(id.toLowerCase())

@@ -218,3 +220,3 @@ let rereferenceIndex = 0

state.patch(def, listItem)
state.patch(definition, listItem)

@@ -221,0 +223,0 @@ listItems.push(listItem)

@@ -12,4 +12,4 @@ /**

export function blockquote(state: State, node: Blockquote): Element;
export type Element = import('hast').Element;
export type Blockquote = import('mdast').Blockquote;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Blockquote = import("mdast").Blockquote;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function hardBreak(state: State, 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 State = import('../state.js').State;
export type Element = import("hast").Element;
export type Text = import("hast").Text;
export type Break = import("mdast").Break;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function code(state: State, node: Code): Element;
export type Element = import('hast').Element;
export type Properties = import('hast').Properties;
export type Code = import('mdast').Code;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Properties = import("hast").Properties;
export type Code = import("mdast").Code;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function strikethrough(state: State, node: Delete): Element;
export type Element = import('hast').Element;
export type Delete = import('mdast').Delete;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Delete = import("mdast").Delete;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function emphasis(state: State, node: Emphasis): Element;
export type Element = import('hast').Element;
export type Emphasis = import('mdast').Emphasis;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Emphasis = import("mdast").Emphasis;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function footnoteReference(state: State, node: FootnoteReference): Element;
export type Element = import('hast').Element;
export type FootnoteReference = import('mdast').FootnoteReference;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type FootnoteReference = import("mdast").FootnoteReference;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function heading(state: State, node: Heading): Element;
export type Element = import('hast').Element;
export type Heading = import('mdast').Heading;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Heading = import("mdast").Heading;
export type State = import("../state.js").State;

@@ -13,5 +13,5 @@ /**

export function html(state: State, node: Html): Element | Raw | undefined;
export type Element = import('hast').Element;
export type Html = import('mdast').Html;
export type State = import('../state.js').State;
export type Raw = import('../../index.js').Raw;
export type Element = import("hast").Element;
export type Html = import("mdast").Html;
export type State = import("../state.js").State;
export type Raw = import("../../index.js").Raw;

@@ -12,6 +12,6 @@ /**

export function imageReference(state: State, node: ImageReference): Array<ElementContent> | ElementContent;
export type Element = import('hast').Element;
export type ElementContent = import('hast').ElementContent;
export type Properties = import('hast').Properties;
export type ImageReference = import('mdast').ImageReference;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type ElementContent = import("hast").ElementContent;
export type Properties = import("hast").Properties;
export type ImageReference = import("mdast").ImageReference;
export type State = import("../state.js").State;

@@ -24,5 +24,5 @@ /**

const id = String(node.identifier).toUpperCase()
const def = state.definitionById.get(id)
const definition = state.definitionById.get(id)
if (!def) {
if (!definition) {
return revert(state, node)

@@ -32,6 +32,6 @@ }

/** @type {Properties} */
const properties = {src: normalizeUri(def.url || ''), alt: node.alt}
const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}
if (def.title !== null && def.title !== undefined) {
properties.title = def.title
if (definition.title !== null && definition.title !== undefined) {
properties.title = definition.title
}

@@ -38,0 +38,0 @@

@@ -12,5 +12,5 @@ /**

export function image(state: State, node: Image): Element;
export type Element = import('hast').Element;
export type Properties = import('hast').Properties;
export type Image = import('mdast').Image;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Properties = import("hast").Properties;
export type Image = import("mdast").Image;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function inlineCode(state: State, node: InlineCode): Element;
export type Element = import('hast').Element;
export type Text = import('hast').Text;
export type InlineCode = import('mdast').InlineCode;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Text = import("hast").Text;
export type InlineCode = import("mdast").InlineCode;
export type State = import("../state.js").State;

@@ -12,6 +12,6 @@ /**

export function linkReference(state: State, node: LinkReference): Array<ElementContent> | ElementContent;
export type Element = import('hast').Element;
export type ElementContent = import('hast').ElementContent;
export type Properties = import('hast').Properties;
export type LinkReference = import('mdast').LinkReference;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type ElementContent = import("hast").ElementContent;
export type Properties = import("hast").Properties;
export type LinkReference = import("mdast").LinkReference;
export type State = import("../state.js").State;

@@ -24,5 +24,5 @@ /**

const id = String(node.identifier).toUpperCase()
const def = state.definitionById.get(id)
const definition = state.definitionById.get(id)
if (!def) {
if (!definition) {
return revert(state, node)

@@ -32,6 +32,6 @@ }

/** @type {Properties} */
const properties = {href: normalizeUri(def.url || '')}
const properties = {href: normalizeUri(definition.url || '')}
if (def.title !== null && def.title !== undefined) {
properties.title = def.title
if (definition.title !== null && definition.title !== undefined) {
properties.title = definition.title
}

@@ -38,0 +38,0 @@

@@ -12,5 +12,5 @@ /**

export function link(state: State, node: Link): Element;
export type Element = import('hast').Element;
export type Properties = import('hast').Properties;
export type Link = import('mdast').Link;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Properties = import("hast").Properties;
export type Link = import("mdast").Link;
export type State = import("../state.js").State;

@@ -14,7 +14,7 @@ /**

export function listItem(state: State, node: ListItem, parent: Parents | undefined): Element;
export type Element = import('hast').Element;
export type ElementContent = import('hast').ElementContent;
export type Properties = import('hast').Properties;
export type ListItem = import('mdast').ListItem;
export type Parents = import('mdast').Parents;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type ElementContent = import("hast").ElementContent;
export type Properties = import("hast").Properties;
export type ListItem = import("mdast").ListItem;
export type Parents = import("mdast").Parents;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function list(state: State, node: List): Element;
export type Element = import('hast').Element;
export type Properties = import('hast').Properties;
export type List = import('mdast').List;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Properties = import("hast").Properties;
export type List = import("mdast").List;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function paragraph(state: State, node: Paragraph): Element;
export type Element = import('hast').Element;
export type Paragraph = import('mdast').Paragraph;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Paragraph = import("mdast").Paragraph;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function root(state: State, node: MdastRoot): HastParents;
export type HastParents = import('hast').Parents;
export type HastRoot = import('hast').Root;
export type MdastRoot = import('mdast').Root;
export type State = import('../state.js').State;
export type HastParents = import("hast").Parents;
export type HastRoot = import("hast").Root;
export type MdastRoot = import("mdast").Root;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function strong(state: State, node: Strong): Element;
export type Element = import('hast').Element;
export type Strong = import('mdast').Strong;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Strong = import("mdast").Strong;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function tableCell(state: State, node: TableCell): Element;
export type Element = import('hast').Element;
export type TableCell = import('mdast').TableCell;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type TableCell = import("mdast").TableCell;
export type State = import("../state.js").State;

@@ -14,7 +14,7 @@ /**

export function tableRow(state: State, node: TableRow, parent: Parents | undefined): Element;
export type Element = import('hast').Element;
export type ElementContent = import('hast').ElementContent;
export type Properties = import('hast').Properties;
export type Parents = import('mdast').Parents;
export type TableRow = import('mdast').TableRow;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type ElementContent = import("hast").ElementContent;
export type Properties = import("hast").Properties;
export type Parents = import("mdast").Parents;
export type TableRow = import("mdast").TableRow;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function table(state: State, node: Table): Element;
export type Element = import('hast').Element;
export type Table = import('mdast').Table;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type Table = import("mdast").Table;
export type State = import("../state.js").State;

@@ -12,5 +12,5 @@ /**

export function text(state: State, node: MdastText): HastElement | HastText;
export type HastElement = import('hast').Element;
export type HastText = import('hast').Text;
export type MdastText = import('mdast').Text;
export type State = import('../state.js').State;
export type HastElement = import("hast").Element;
export type HastText = import("hast").Text;
export type MdastText = import("mdast").Text;
export type State = import("../state.js").State;

@@ -12,4 +12,4 @@ /**

export function thematicBreak(state: State, node: ThematicBreak): Element;
export type Element = import('hast').Element;
export type ThematicBreak = import('mdast').ThematicBreak;
export type State = import('../state.js').State;
export type Element = import("hast").Element;
export type ThematicBreak = import("mdast").ThematicBreak;
export type State = import("../state.js").State;

@@ -79,4 +79,4 @@ /**

export function toHast(tree: MdastNodes, options?: Options | null | undefined): HastNodes;
export type HastNodes = import('hast').Nodes;
export type MdastNodes = import('mdast').Nodes;
export type Options = import('./state.js').Options;
export type HastNodes = import("hast").Nodes;
export type MdastNodes = import("mdast").Nodes;
export type Options = import("./state.js").Options;

@@ -12,5 +12,5 @@ /**

export function revert(state: State, node: Extract<Nodes, Reference>): Array<ElementContent>;
export type ElementContent = import('hast').ElementContent;
export type Nodes = import('mdast').Nodes;
export type Reference = import('mdast').Reference;
export type State = import('./state.js').State;
export type ElementContent = import("hast").ElementContent;
export type Nodes = import("mdast").Nodes;
export type Reference = import("mdast").Reference;
export type State = import("./state.js").State;

@@ -24,16 +24,16 @@ /**

*/
export function wrap<Type extends import("hast").RootContent>(nodes: Type[], loose?: boolean | undefined): (import("hast").Text | Type)[];
export type HastElement = import('hast').Element;
export type HastElementContent = import('hast').ElementContent;
export type HastNodes = import('hast').Nodes;
export type HastProperties = import('hast').Properties;
export type HastRootContent = import('hast').RootContent;
export type HastText = import('hast').Text;
export type MdastDefinition = import('mdast').Definition;
export type MdastFootnoteDefinition = import('mdast').FootnoteDefinition;
export type MdastNodes = import('mdast').Nodes;
export type MdastParents = import('mdast').Parents;
export type VFile = import('vfile').VFile;
export type FootnoteBackContentTemplate = import('./footer.js').FootnoteBackContentTemplate;
export type FootnoteBackLabelTemplate = import('./footer.js').FootnoteBackLabelTemplate;
export function wrap<Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined): Array<HastText | Type>;
export type HastElement = import("hast").Element;
export type HastElementContent = import("hast").ElementContent;
export type HastNodes = import("hast").Nodes;
export type HastProperties = import("hast").Properties;
export type HastRootContent = import("hast").RootContent;
export type HastText = import("hast").Text;
export type MdastDefinition = import("mdast").Definition;
export type MdastFootnoteDefinition = import("mdast").FootnoteDefinition;
export type MdastNodes = import("mdast").Nodes;
export type MdastParents = import("mdast").Parents;
export type VFile = import("vfile").VFile;
export type FootnoteBackContentTemplate = import("./footer.js").FootnoteBackContentTemplate;
export type FootnoteBackLabelTemplate = import("./footer.js").FootnoteBackLabelTemplate;
/**

@@ -46,3 +46,3 @@ * Handle a node.

*/
export type Handlers = Partial<Record<MdastNodes['type'], Handler>>;
export type Handlers = Partial<Record<MdastNodes["type"], Handler>>;
/**

@@ -156,3 +156,3 @@ * Configuration (optional).

*
* > 👉 **Note**: `id: 'footnote-label'` is always added, because footnote
* > **Note**: `id: 'footnote-label'` is always added, because footnote
* > calls use it with `aria-describedby` to provide an accessible label.

@@ -181,3 +181,3 @@ */

*/
passThrough?: Array<MdastNodes['type']> | null | undefined;
passThrough?: Array<MdastNodes["type"]> | null | undefined;
/**

@@ -199,3 +199,3 @@ * Handler for all unknown nodes (optional).

*/
applyData: <Type extends import("hast").Nodes>(from: MdastNodes, to: Type) => import("hast").Element | Type;
applyData: <Type extends HastNodes>(from: MdastNodes, to: Type) => HastElement | Type;
/**

@@ -236,3 +236,3 @@ * Definitions by their identifier.

*/
wrap: <Type_1 extends import("hast").RootContent>(nodes: Type_1[], loose?: boolean | undefined) => (import("hast").Text | Type_1)[];
wrap: <Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<HastText | Type>;
};

@@ -129,3 +129,3 @@ /**

*
* > 👉 **Note**: `id: 'footnote-label'` is always added, because footnote
* > **Note**: `id: 'footnote-label'` is always added, because footnote
* > calls use it with `aria-describedby` to provide an accessible label.

@@ -132,0 +132,0 @@ * @property {string | null | undefined} [footnoteLabelTagName='h2']

{
"name": "mdast-util-to-hast",
"version": "13.1.0",
"version": "13.2.0",
"description": "mdast utility to transform to hast",

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

"hast-util-to-html": "^9.0.0",
"hastscript": "^8.0.0",
"hastscript": "^9.0.0",
"mdast-util-from-markdown": "^2.0.0",

@@ -57,7 +57,7 @@ "mdast-util-gfm": "^3.0.0",

"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"remark-cli": "^12.0.0",
"remark-preset-wooorm": "^10.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"xo": "^0.56.0"
"typescript": "^5.5.1-rc",
"xo": "^0.58.0"
},

@@ -106,2 +106,3 @@ "scripts": {

"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/consistent-type-definitions": "off"

@@ -108,0 +109,0 @@ }

@@ -15,35 +15,35 @@ # mdast-util-to-hast

* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`](#defaultfootnotebackcontentreferenceindex-rereferenceindex)
* [`defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`](#defaultfootnotebacklabelreferenceindex-rereferenceindex)
* [`defaultHandlers`](#defaulthandlers)
* [`toHast(tree[, options])`](#tohasttree-options)
* [`FootnoteBackContentTemplate`](#footnotebackcontenttemplate)
* [`FootnoteBackLabelTemplate`](#footnotebacklabeltemplate)
* [`Handler`](#handler)
* [`Handlers`](#handlers)
* [`Options`](#options)
* [`Raw`](#raw)
* [`State`](#state)
* [Examples](#examples)
* [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely)
* [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly)
* [Example: footnotes in languages other than English](#example-footnotes-in-languages-other-than-english)
* [Example: supporting custom nodes](#example-supporting-custom-nodes)
* [Algorithm](#algorithm)
* [Default handling](#default-handling)
* [Fields on nodes](#fields-on-nodes)
* [CSS](#css)
* [Syntax tree](#syntax-tree)
* [Nodes](#nodes)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`defaultFootnoteBackContent(referenceIndex, rereferenceIndex)`](#defaultfootnotebackcontentreferenceindex-rereferenceindex)
* [`defaultFootnoteBackLabel(referenceIndex, rereferenceIndex)`](#defaultfootnotebacklabelreferenceindex-rereferenceindex)
* [`defaultHandlers`](#defaulthandlers)
* [`toHast(tree[, options])`](#tohasttree-options)
* [`FootnoteBackContentTemplate`](#footnotebackcontenttemplate)
* [`FootnoteBackLabelTemplate`](#footnotebacklabeltemplate)
* [`Handler`](#handler)
* [`Handlers`](#handlers)
* [`Options`](#options)
* [`Raw`](#raw)
* [`State`](#state)
* [Examples](#examples)
* [Example: supporting HTML in markdown naïvely](#example-supporting-html-in-markdown-naïvely)
* [Example: supporting HTML in markdown properly](#example-supporting-html-in-markdown-properly)
* [Example: footnotes in languages other than English](#example-footnotes-in-languages-other-than-english)
* [Example: supporting custom nodes](#example-supporting-custom-nodes)
* [Algorithm](#algorithm)
* [Default handling](#default-handling)
* [Fields on nodes](#fields-on-nodes)
* [CSS](#css)
* [Syntax tree](#syntax-tree)
* [Nodes](#nodes)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)

@@ -135,7 +135,7 @@ ## What is this?

* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed

@@ -152,7 +152,7 @@ ###### Returns

* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed

@@ -173,6 +173,6 @@ ###### Returns

* `tree` ([`MdastNode`][mdast-node])
— mdast tree
* `options` ([`Options`][api-options], optional)
— configuration
* `tree` ([`MdastNode`][mdast-node])
— mdast tree
* `options` ([`Options`][api-options], optional)
— configuration

@@ -191,10 +191,10 @@ ###### Returns

* [`hast-util-to-html`][hast-util-to-html] also has an option
`allowDangerousHtml` which will output the raw HTML.
This is typically discouraged as noted by the option name but is useful if
you completely trust authors
* [`hast-util-raw`][hast-util-raw] can handle the raw embedded HTML strings by
parsing them into standard hast nodes (`element`, `text`, etc).
This is a heavy task as it needs a full HTML parser, but it is the only way
to support untrusted content
* [`hast-util-to-html`][hast-util-to-html] also has an option
`allowDangerousHtml` which will output the raw HTML.
This is typically discouraged as noted by the option name but is useful if
you completely trust authors
* [`hast-util-raw`][hast-util-raw] can handle the raw embedded HTML strings by
parsing them into standard hast nodes (`element`, `text`, etc).
This is a heavy task as it needs a full HTML parser, but it is the only way
to support untrusted content

@@ -243,7 +243,7 @@ ###### Footnotes

* when the node has a `value` (and doesn’t have `data.hName`,
`data.hProperties`, or `data.hChildren`, see later), create a hast `text`
node
* otherwise, create a `<div>` element (which could be changed with
`data.hName`), with its children mapped from mdast to hast as well
* when the node has a `value` (and doesn’t have `data.hName`,
`data.hProperties`, or `data.hChildren`, see later), create a hast `text`
node
* otherwise, create a `<div>` element (which could be changed with
`data.hName`), with its children mapped from mdast to hast as well

@@ -267,16 +267,16 @@ This behavior can be changed by passing an `unknownHandler`.

* `0` and `0` for the backreference from `things about micromark` to
`alpha`, as it is the first used definition, and the first call to it
* `0` and `1` for the backreference from `things about micromark` to
`bravo`, as it is the first used definition, and the second call to it
* `1` and `0` for the backreference from `things about remark` to
`charlie`, as it is the second used definition
* `0` and `0` for the backreference from `things about micromark` to
`alpha`, as it is the first used definition, and the first call to it
* `0` and `1` for the backreference from `things about micromark` to
`bravo`, as it is the first used definition, and the second call to it
* `1` and `0` for the backreference from `things about remark` to
`charlie`, as it is the second used definition
###### Parameters
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed

@@ -303,16 +303,16 @@ ###### Returns

* `0` and `0` for the backreference from `things about micromark` to
`alpha`, as it is the first used definition, and the first call to it
* `0` and `1` for the backreference from `things about micromark` to
`bravo`, as it is the first used definition, and the second call to it
* `1` and `0` for the backreference from `things about remark` to
`charlie`, as it is the second used definition
* `0` and `0` for the backreference from `things about micromark` to
`alpha`, as it is the first used definition, and the first call to it
* `0` and `1` for the backreference from `things about micromark` to
`bravo`, as it is the first used definition, and the second call to it
* `1` and `0` for the backreference from `things about remark` to
`charlie`, as it is the second used definition
###### Parameters
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed
* `referenceIndex` (`number`)
— index of the definition in the order that they are first referenced,
0-indexed
* `rereferenceIndex` (`number`)
— index of calls to the same definition, 0-indexed

@@ -330,8 +330,8 @@ ###### Returns

* `state` ([`State`][api-state])
— info passed around
* `node` ([`MdastNode`][mdast-node])
— node to handle
* `parent` ([`MdastNode | undefined`][mdast-node])
— parent of `node`
* `state` ([`State`][api-state])
— info passed around
* `node` ([`MdastNode`][mdast-node])
— node to handle
* `parent` ([`MdastNode | undefined`][mdast-node])
— parent of `node`

@@ -358,35 +358,35 @@ ###### Returns

* `allowDangerousHtml` (`boolean`, default: `false`)
— whether to persist raw HTML in markdown in the hast tree
* `clobberPrefix` (`string`, default: `'user-content-'`)
— prefix to use before the `id` property on footnotes to prevent them from
*clobbering*
* `file` ([`VFile`][vfile], optional)
— corresponding virtual file representing the input document
* `footnoteBackContent`
([`FootnoteBackContentTemplate`][api-footnote-back-content-template]
or `string`, default:
[`defaultFootnoteBackContent`][api-default-footnote-back-content])
— content of the backreference back to references
* `footnoteBackLabel`
([`FootnoteBackLabelTemplate`][api-footnote-back-label-template]
or `string`, default:
[`defaultFootnoteBackLabel`][api-default-footnote-back-label])
— label to describe the backreference back to references
* `footnoteLabel` (`string`, default: `'Footnotes'`)
— label to use for the footnotes section (affects screen readers)
* `footnoteLabelProperties`
([`Properties`][properties], default: `{className: ['sr-only']}`)
— properties to use on the footnote label
(note that `id: 'footnote-label'` is always added as footnote calls use it
with `aria-describedby` to provide an accessible label)
* `footnoteLabelTagName` (`string`, default: `h2`)
— tag name to use for the footnote label
* `handlers` ([`Handlers`][api-handlers], optional)
— extra handlers for nodes
* `passThrough` (`Array<Nodes['type']>`, optional)
— list of custom mdast node types to pass through (keep) in hast (note that
the node itself is passed, but eventual children are transformed)
* `unknownHandler` ([`Handler`][api-handler], optional)
— handle all unknown nodes
* `allowDangerousHtml` (`boolean`, default: `false`)
— whether to persist raw HTML in markdown in the hast tree
* `clobberPrefix` (`string`, default: `'user-content-'`)
— prefix to use before the `id` property on footnotes to prevent them from
*clobbering*
* `file` ([`VFile`][vfile], optional)
— corresponding virtual file representing the input document
* `footnoteBackContent`
([`FootnoteBackContentTemplate`][api-footnote-back-content-template]
or `string`, default:
[`defaultFootnoteBackContent`][api-default-footnote-back-content])
— content of the backreference back to references
* `footnoteBackLabel`
([`FootnoteBackLabelTemplate`][api-footnote-back-label-template]
or `string`, default:
[`defaultFootnoteBackLabel`][api-default-footnote-back-label])
— label to describe the backreference back to references
* `footnoteLabel` (`string`, default: `'Footnotes'`)
— label to use for the footnotes section (affects screen readers)
* `footnoteLabelProperties`
([`Properties`][properties], default: `{className: ['sr-only']}`)
— properties to use on the footnote label
(note that `id: 'footnote-label'` is always added as footnote calls use it
with `aria-describedby` to provide an accessible label)
* `footnoteLabelTagName` (`string`, default: `h2`)
— tag name to use for the footnote label
* `handlers` ([`Handlers`][api-handlers], optional)
— extra handlers for nodes
* `passThrough` (`Array<Nodes['type']>`, optional)
— list of custom mdast node types to pass through (keep) in hast (note that
the node itself is passed, but eventual children are transformed)
* `unknownHandler` ([`Handler`][api-handler], optional)
— handle all unknown nodes

@@ -416,24 +416,24 @@ ### `Raw`

* `all` (`(node: MdastNode) => Array<HastNode>`)
— transform the children of an mdast parent to hast
* `applyData` (`<Type extends HastNode>(from: MdastNode, to: Type) => Type | HastElement`)
— honor the `data` of `from` and maybe generate an element instead of `to`
* `definitionById` (`Map<string, Definition>`)
— definitions by their uppercased identifier
* `footnoteById` (`Map<string, FootnoteDefinition>`)
— footnote definitions by their uppercased identifier
* `footnoteCounts` (`Map<string, number>`)
— counts for how often the same footnote was called
* `footnoteOrder` (`Array<string>`)
— identifiers of order when footnote calls first appear in tree order
* `handlers` ([`Handlers`][api-handlers])
— applied node handlers
* `one` (`(node: MdastNode, parent: MdastNode | undefined) => HastNode | Array<HastNode> | undefined`)
— transform an mdast node to hast
* `options` ([`Options`][api-options])
— configuration
* `patch` (`(from: MdastNode, to: HastNode) => undefined`)
* `wrap` (`<Type extends HastNode>(nodes: Array<Type>, loose?: boolean) => Array<Type | HastText>`)
— wrap `nodes` with line endings between each node, adds initial/final line
endings when `loose`
* `all` (`(node: MdastNode) => Array<HastNode>`)
— transform the children of an mdast parent to hast
* `applyData` (`<Type extends HastNode>(from: MdastNode, to: Type) => Type | HastElement`)
— honor the `data` of `from` and maybe generate an element instead of `to`
* `definitionById` (`Map<string, Definition>`)
— definitions by their uppercased identifier
* `footnoteById` (`Map<string, FootnoteDefinition>`)
— footnote definitions by their uppercased identifier
* `footnoteCounts` (`Map<string, number>`)
— counts for how often the same footnote was called
* `footnoteOrder` (`Array<string>`)
— identifiers of order when footnote calls first appear in tree order
* `handlers` ([`Handlers`][api-handlers])
— applied node handlers
* `one` (`(node: MdastNode, parent: MdastNode | undefined) => HastNode | Array<HastNode> | undefined`)
— transform an mdast node to hast
* `options` ([`Options`][api-options])
— configuration
* `patch` (`(from: MdastNode, to: HastNode) => undefined`)
* `wrap` (`<Type extends HastNode>(nodes: Array<Type>, loose?: boolean) => Array<Type | HastText>`)
— wrap `nodes` with line endings between each node, adds initial/final line
endings when `loose`

@@ -1177,3 +1177,4 @@ ## Examples

[`element`](https://github.com/syntax-tree/hast#element) (`table`, `thead`, `tbody`, `tr`, `td`, `th`)
[`element`](https://github.com/syntax-tree/hast#element) (`table`, `thead`,
`tbody`, `tr`, `td`, `th`)

@@ -1307,5 +1308,5 @@ </td>

* `node.data.hName` — define the element’s tag name
* `node.data.hProperties` — define extra properties to use
* `node.data.hChildren` — define hast children to use
* `node.data.hName` — define the element’s tag name
* `node.data.hProperties` — define extra properties to use
* `node.data.hChildren` — define hast children to use

@@ -1612,8 +1613,8 @@ ###### `hName`

* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
— transform hast to mdast
* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)
— transform hast to xast
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
— sanitize hast nodes
* [`hast-util-to-mdast`](https://github.com/syntax-tree/hast-util-to-mdast)
— transform hast to mdast
* [`hast-util-to-xast`](https://github.com/syntax-tree/hast-util-to-xast)
— transform hast to xast
* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)
— sanitize hast nodes

@@ -1620,0 +1621,0 @@ ## Contribute

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