first commit

This commit is contained in:
2026-01-09 23:05:52 -05:00
commit dec0c8e4e4
4203 changed files with 824454 additions and 0 deletions

94
node_modules/mdast-util-to-hast/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import type {Data, ElementContent, Literal, Properties} from 'hast'
// Expose types.
export type {
FootnoteBackContentTemplate,
FootnoteBackLabelTemplate
} from './lib/footer.js'
export type {Handler, Handlers, Options, State} from './lib/state.js'
// Expose JS API.
export {handlers as defaultHandlers} from './lib/handlers/index.js'
export {
defaultFootnoteBackContent,
defaultFootnoteBackLabel
} from './lib/footer.js'
export {toHast} from './lib/index.js'
/**
* Raw string of HTML embedded into HTML AST.
*/
export interface Raw extends Literal {
/**
* Node type of raw.
*/
type: 'raw'
/**
* Data associated with the hast raw.
*/
data?: RawData | undefined
}
/**
* Info associated with hast raw nodes by the ecosystem.
*/
export interface RawData extends Data {}
// Register nodes in content.
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 {
/**
* Raw string of HTML embedded into HTML AST.
*/
raw: Raw
}
interface RootContentMap {
/**
* Raw string of HTML embedded into HTML AST.
*/
raw: Raw
}
}
// Register data on mdast.
declare module 'mdast' {
interface Data {
/**
* Field supported by `mdast-util-to-hast` to signal that a node should
* result in something with these children.
*
* When this is defined, when a parent is created, these children will
* be used.
*/
hChildren?: ElementContent[] | undefined
/**
* Field supported by `mdast-util-to-hast` to signal that a node should
* result in a particular element, instead of its default behavior.
*
* When this is defined, an element with the given tag name is created.
* For example, when setting `hName` to `'b'`, a `<b>` element is created.
*/
hName?: string | undefined
/**
* Field supported by `mdast-util-to-hast` to signal that a node should
* result in an element with these properties.
*
* When this is defined, when an element is created, these properties will
* be used.
*/
hProperties?: Properties | undefined
}
}

7
node_modules/mdast-util-to-hast/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
// Note: types exposed from `index.d.ts`.
export {handlers as defaultHandlers} from './lib/handlers/index.js'
export {toHast} from './lib/index.js'
export {
defaultFootnoteBackContent,
defaultFootnoteBackLabel
} from './lib/footer.js'

81
node_modules/mdast-util-to-hast/lib/footer.d.ts generated vendored Normal file
View File

@@ -0,0 +1,81 @@
/**
* Generate the default content that GitHub uses on backreferences.
*
* @param {number} _
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {Array<ElementContent>}
* Content.
*/
export function defaultFootnoteBackContent(_: number, rereferenceIndex: number): Array<ElementContent>;
/**
* Generate the default label that GitHub uses on backreferences.
*
* @param {number} referenceIndex
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {string}
* Label.
*/
export function defaultFootnoteBackLabel(referenceIndex: number, rereferenceIndex: number): string;
/**
* Generate a hast footer for called footnote definitions.
*
* @param {State} state
* Info passed around.
* @returns {Element | undefined}
* `section` element or `undefined`.
*/
export function footer(state: State): Element | undefined;
/**
* Generate content for the backreference dynamically.
*
* For the following markdown:
*
* ```markdown
* Alpha[^micromark], bravo[^micromark], and charlie[^remark].
*
* [^remark]: things about remark
* [^micromark]: things about micromark
* ```
*
* This function will be called with:
*
* * `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
*/
export type FootnoteBackContentTemplate = (referenceIndex: number, rereferenceIndex: number) => Array<ElementContent> | ElementContent | string;
/**
* Generate a back label dynamically.
*
* For the following markdown:
*
* ```markdown
* Alpha[^micromark], bravo[^micromark], and charlie[^remark].
*
* [^remark]: things about remark
* [^micromark]: things about micromark
* ```
*
* This function will be called with:
*
* * `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
*/
export type FootnoteBackLabelTemplate = (referenceIndex: number, rereferenceIndex: number) => string;
import type { ElementContent } from 'hast';
import type { State } from './state.js';
import type { Element } from 'hast';
//# sourceMappingURL=footer.d.ts.map

1
node_modules/mdast-util-to-hast/lib/footer.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["footer.js"],"names":[],"mappings":"AAmEA;;;;;;;;;;GAUG;AACH,8CARW,MAAM,oBAGN,MAAM,GAEJ,KAAK,CAAC,cAAc,CAAC,CAiBjC;AAED;;;;;;;;;;GAUG;AACH,yDARW,MAAM,oBAGN,MAAM,GAEJ,MAAM,CASlB;AAED;;;;;;;GAOG;AAEH,8BANW,KAAK,GAEH,OAAO,GAAG,SAAS,CAmI/B;;;;;;;;;;;;;;;;;;;;;;2DA/NU,MAAM,oBAGN,MAAM,KAEJ,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;yDAwBjD,MAAM,oBAGN,MAAM,KAEJ,MAAM;oCA3DuB,MAAM;2BACxB,YAAY;6BADM,MAAM"}

250
node_modules/mdast-util-to-hast/lib/footer.js generated vendored Normal file
View File

@@ -0,0 +1,250 @@
/**
* @import {ElementContent, Element} from 'hast'
* @import {State} from './state.js'
*/
/**
* @callback FootnoteBackContentTemplate
* Generate content for the backreference dynamically.
*
* For the following markdown:
*
* ```markdown
* Alpha[^micromark], bravo[^micromark], and charlie[^remark].
*
* [^remark]: things about remark
* [^micromark]: things about micromark
* ```
*
* This function will be called with:
*
* * `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
* @param {number} referenceIndex
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {Array<ElementContent> | ElementContent | string}
* Content for the backreference when linking back from definitions to their
* reference.
*
* @callback FootnoteBackLabelTemplate
* Generate a back label dynamically.
*
* For the following markdown:
*
* ```markdown
* Alpha[^micromark], bravo[^micromark], and charlie[^remark].
*
* [^remark]: things about remark
* [^micromark]: things about micromark
* ```
*
* This function will be called with:
*
* * `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
* @param {number} referenceIndex
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {string}
* Back label to use when linking back from definitions to their reference.
*/
import structuredClone from '@ungap/structured-clone'
import {normalizeUri} from 'micromark-util-sanitize-uri'
/**
* Generate the default content that GitHub uses on backreferences.
*
* @param {number} _
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {Array<ElementContent>}
* Content.
*/
export function defaultFootnoteBackContent(_, rereferenceIndex) {
/** @type {Array<ElementContent>} */
const result = [{type: 'text', value: '↩'}]
if (rereferenceIndex > 1) {
result.push({
type: 'element',
tagName: 'sup',
properties: {},
children: [{type: 'text', value: String(rereferenceIndex)}]
})
}
return result
}
/**
* Generate the default label that GitHub uses on backreferences.
*
* @param {number} referenceIndex
* Index of the definition in the order that they are first referenced,
* 0-indexed.
* @param {number} rereferenceIndex
* Index of calls to the same definition, 0-indexed.
* @returns {string}
* Label.
*/
export function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
return (
'Back to reference ' +
(referenceIndex + 1) +
(rereferenceIndex > 1 ? '-' + rereferenceIndex : '')
)
}
/**
* Generate a hast footer for called footnote definitions.
*
* @param {State} state
* Info passed around.
* @returns {Element | undefined}
* `section` element or `undefined`.
*/
// eslint-disable-next-line complexity
export function footer(state) {
const clobberPrefix =
typeof state.options.clobberPrefix === 'string'
? state.options.clobberPrefix
: 'user-content-'
const footnoteBackContent =
state.options.footnoteBackContent || defaultFootnoteBackContent
const footnoteBackLabel =
state.options.footnoteBackLabel || defaultFootnoteBackLabel
const footnoteLabel = state.options.footnoteLabel || 'Footnotes'
const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'
const footnoteLabelProperties = state.options.footnoteLabelProperties || {
className: ['sr-only']
}
/** @type {Array<ElementContent>} */
const listItems = []
let referenceIndex = -1
while (++referenceIndex < state.footnoteOrder.length) {
const definition = state.footnoteById.get(
state.footnoteOrder[referenceIndex]
)
if (!definition) {
continue
}
const content = state.all(definition)
const id = String(definition.identifier).toUpperCase()
const safeId = normalizeUri(id.toLowerCase())
let rereferenceIndex = 0
/** @type {Array<ElementContent>} */
const backReferences = []
const counts = state.footnoteCounts.get(id)
// eslint-disable-next-line no-unmodified-loop-condition
while (counts !== undefined && ++rereferenceIndex <= counts) {
if (backReferences.length > 0) {
backReferences.push({type: 'text', value: ' '})
}
let children =
typeof footnoteBackContent === 'string'
? footnoteBackContent
: footnoteBackContent(referenceIndex, rereferenceIndex)
if (typeof children === 'string') {
children = {type: 'text', value: children}
}
backReferences.push({
type: 'element',
tagName: 'a',
properties: {
href:
'#' +
clobberPrefix +
'fnref-' +
safeId +
(rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),
dataFootnoteBackref: '',
ariaLabel:
typeof footnoteBackLabel === 'string'
? footnoteBackLabel
: footnoteBackLabel(referenceIndex, rereferenceIndex),
className: ['data-footnote-backref']
},
children: Array.isArray(children) ? children : [children]
})
}
const tail = content[content.length - 1]
if (tail && tail.type === 'element' && tail.tagName === 'p') {
const tailTail = tail.children[tail.children.length - 1]
if (tailTail && tailTail.type === 'text') {
tailTail.value += ' '
} else {
tail.children.push({type: 'text', value: ' '})
}
tail.children.push(...backReferences)
} else {
content.push(...backReferences)
}
/** @type {Element} */
const listItem = {
type: 'element',
tagName: 'li',
properties: {id: clobberPrefix + 'fn-' + safeId},
children: state.wrap(content, true)
}
state.patch(definition, listItem)
listItems.push(listItem)
}
if (listItems.length === 0) {
return
}
return {
type: 'element',
tagName: 'section',
properties: {dataFootnotes: true, className: ['footnotes']},
children: [
{
type: 'element',
tagName: footnoteLabelTagName,
properties: {
...structuredClone(footnoteLabelProperties),
id: 'footnote-label'
},
children: [{type: 'text', value: footnoteLabel}]
},
{type: 'text', value: '\n'},
{
type: 'element',
tagName: 'ol',
properties: {},
children: state.wrap(listItems, true)
},
{type: 'text', value: '\n'}
]
}
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Blockquote} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `blockquote` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Blockquote} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function blockquote(state: State, node: Blockquote): Element;
import type { State } from '../state.js';
import type { Blockquote } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=blockquote.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["blockquote.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,kCAPW,KAAK,QAEL,UAAU,GAER,OAAO,CAanB;2BAvBuB,aAAa;gCADR,OAAO;6BADV,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Blockquote} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `blockquote` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Blockquote} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function blockquote(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'blockquote',
properties: {},
children: state.wrap(state.all(node), true)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,21 @@
/**
* @import {Element, Text} from 'hast'
* @import {Break} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `break` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Break} node
* mdast node.
* @returns {Array<Element | Text>}
* hast element content.
*/
export function hardBreak(state: State, node: Break): Array<Element | Text>;
import type { State } from '../state.js';
import type { Break } from 'mdast';
import type { Element } from 'hast';
import type { Text } from 'hast';
//# sourceMappingURL=break.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"break.d.ts","sourceRoot":"","sources":["break.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,iCAPW,KAAK,QAEL,KAAK,GAEH,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAQjC;2BAlBuB,aAAa;2BADb,OAAO;6BADC,MAAM;0BAAN,MAAM"}

22
node_modules/mdast-util-to-hast/lib/handlers/break.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
* @import {Element, Text} from 'hast'
* @import {Break} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `break` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Break} node
* mdast node.
* @returns {Array<Element | Text>}
* hast element content.
*/
export function hardBreak(state, node) {
/** @type {Element} */
const result = {type: 'element', tagName: 'br', properties: {}, children: []}
state.patch(node, result)
return [state.applyData(node, result), {type: 'text', value: '\n'}]
}

20
node_modules/mdast-util-to-hast/lib/handlers/code.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Code} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `code` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Code} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function code(state: State, node: Code): Element;
import type { State } from '../state.js';
import type { Code } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=code.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["code.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,4BAPW,KAAK,QAEL,IAAI,GAEF,OAAO,CAmCnB;2BA7CuB,aAAa;0BADd,OAAO;6BADQ,MAAM"}

49
node_modules/mdast-util-to-hast/lib/handlers/code.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Code} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `code` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Code} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function code(state, node) {
const value = node.value ? node.value + '\n' : ''
/** @type {Properties} */
const properties = {}
// Someone can write `js&#x20;python&#x9;ruby`.
const language = node.lang ? node.lang.split(/\s+/) : []
// GH/CM still drop the non-first languages.
if (language.length > 0) {
properties.className = ['language-' + language[0]]
}
// Create `<code>`.
/** @type {Element} */
let result = {
type: 'element',
tagName: 'code',
properties,
children: [{type: 'text', value}]
}
if (node.meta) {
result.data = {meta: node.meta}
}
state.patch(node, result)
result = state.applyData(node, result)
// Create `<pre>`.
result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}
state.patch(node, result)
return result
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Delete} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `delete` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Delete} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strikethrough(state: State, node: Delete): Element;
import type { State } from '../state.js';
import type { Delete } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=delete.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["delete.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,qCAPW,KAAK,QAEL,MAAM,GAEJ,OAAO,CAanB;2BAvBuB,aAAa;4BADZ,OAAO;6BADN,MAAM"}

27
node_modules/mdast-util-to-hast/lib/handlers/delete.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Delete} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `delete` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Delete} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strikethrough(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'del',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Emphasis} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `emphasis` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Emphasis} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function emphasis(state: State, node: Emphasis): Element;
import type { State } from '../state.js';
import type { Emphasis } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=emphasis.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"emphasis.d.ts","sourceRoot":"","sources":["emphasis.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,gCAPW,KAAK,QAEL,QAAQ,GAEN,OAAO,CAanB;2BAvBuB,aAAa;8BADV,OAAO;6BADR,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Emphasis} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `emphasis` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Emphasis} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function emphasis(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'em',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `footnoteReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {FootnoteReference} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function footnoteReference(state: State, node: FootnoteReference): Element;
import type { State } from '../state.js';
import type { FootnoteReference } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=footnote-reference.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"footnote-reference.d.ts","sourceRoot":"","sources":["footnote-reference.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,yCAPW,KAAK,QAEL,iBAAiB,GAEf,OAAO,CAsDnB;2BAlEuB,aAAa;uCADD,OAAO;6BADjB,MAAM"}

View File

@@ -0,0 +1,70 @@
/**
* @import {Element} from 'hast'
* @import {FootnoteReference} from 'mdast'
* @import {State} from '../state.js'
*/
import {normalizeUri} from 'micromark-util-sanitize-uri'
/**
* Turn an mdast `footnoteReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {FootnoteReference} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function footnoteReference(state, node) {
const clobberPrefix =
typeof state.options.clobberPrefix === 'string'
? state.options.clobberPrefix
: 'user-content-'
const id = String(node.identifier).toUpperCase()
const safeId = normalizeUri(id.toLowerCase())
const index = state.footnoteOrder.indexOf(id)
/** @type {number} */
let counter
let reuseCounter = state.footnoteCounts.get(id)
if (reuseCounter === undefined) {
reuseCounter = 0
state.footnoteOrder.push(id)
counter = state.footnoteOrder.length
} else {
counter = index + 1
}
reuseCounter += 1
state.footnoteCounts.set(id, reuseCounter)
/** @type {Element} */
const link = {
type: 'element',
tagName: 'a',
properties: {
href: '#' + clobberPrefix + 'fn-' + safeId,
id:
clobberPrefix +
'fnref-' +
safeId +
(reuseCounter > 1 ? '-' + reuseCounter : ''),
dataFootnoteRef: true,
ariaDescribedBy: ['footnote-label']
},
children: [{type: 'text', value: String(counter)}]
}
state.patch(node, link)
/** @type {Element} */
const sup = {
type: 'element',
tagName: 'sup',
properties: {},
children: [link]
}
state.patch(node, sup)
return state.applyData(node, sup)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Heading} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `heading` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Heading} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function heading(state: State, node: Heading): Element;
import type { State } from '../state.js';
import type { Heading } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=heading.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["heading.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,+BAPW,KAAK,QAEL,OAAO,GAEL,OAAO,CAanB;2BAvBuB,aAAa;6BADX,OAAO;6BADP,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Heading} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `heading` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Heading} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function heading(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'h' + node.depth,
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

23
node_modules/mdast-util-to-hast/lib/handlers/html.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* @import {Element} from 'hast'
* @import {Html} from 'mdast'
* @import {State} from '../state.js'
* @import {Raw} from '../../index.js'
*/
/**
* Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
* nothing).
*
* @param {State} state
* Info passed around.
* @param {Html} node
* mdast node.
* @returns {Element | Raw | undefined}
* hast node.
*/
export function html(state: State, node: Html): Element | Raw | undefined;
import type { State } from '../state.js';
import type { Html } from 'mdast';
import type { Element } from 'hast';
import type { Raw } from '../../index.js';
//# sourceMappingURL=html.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["html.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,4BAPW,KAAK,QAEL,IAAI,GAEF,OAAO,GAAG,GAAG,GAAG,SAAS,CAYrC;2BAxBuB,aAAa;0BADd,OAAO;6BADJ,MAAM;yBAGV,gBAAgB"}

28
node_modules/mdast-util-to-hast/lib/handlers/html.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
/**
* @import {Element} from 'hast'
* @import {Html} from 'mdast'
* @import {State} from '../state.js'
* @import {Raw} from '../../index.js'
*/
/**
* Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
* nothing).
*
* @param {State} state
* Info passed around.
* @param {Html} node
* mdast node.
* @returns {Element | Raw | undefined}
* hast node.
*/
export function html(state, node) {
if (state.options.allowDangerousHtml) {
/** @type {Raw} */
const result = {type: 'raw', value: node.value}
state.patch(node, result)
return state.applyData(node, result)
}
return undefined
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `imageReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ImageReference} node
* mdast node.
* @returns {Array<ElementContent> | ElementContent}
* hast node.
*/
export function imageReference(state: State, node: ImageReference): Array<ElementContent> | ElementContent;
import type { State } from '../state.js';
import type { ImageReference } from 'mdast';
import type { ElementContent } from 'hast';
//# sourceMappingURL=image-reference.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image-reference.d.ts","sourceRoot":"","sources":["image-reference.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,sCAPW,KAAK,QAEL,cAAc,GAEZ,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc,CAsBlD;2BAnCuB,aAAa;oCADJ,OAAO;oCADc,MAAM"}

View File

@@ -0,0 +1,39 @@
/**
* @import {ElementContent, Element, Properties} from 'hast'
* @import {ImageReference} from 'mdast'
* @import {State} from '../state.js'
*/
import {normalizeUri} from 'micromark-util-sanitize-uri'
import {revert} from '../revert.js'
/**
* Turn an mdast `imageReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ImageReference} node
* mdast node.
* @returns {Array<ElementContent> | ElementContent}
* hast node.
*/
export function imageReference(state, node) {
const id = String(node.identifier).toUpperCase()
const definition = state.definitionById.get(id)
if (!definition) {
return revert(state, node)
}
/** @type {Properties} */
const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}
if (definition.title !== null && definition.title !== undefined) {
properties.title = definition.title
}
/** @type {Element} */
const result = {type: 'element', tagName: 'img', properties, children: []}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `image` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Image} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function image(state: State, node: Image): Element;
import type { State } from '../state.js';
import type { Image } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=image.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["image.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,6BAPW,KAAK,QAEL,KAAK,GAEH,OAAO,CAmBnB;2BA/BuB,aAAa;2BADb,OAAO;6BADO,MAAM"}

35
node_modules/mdast-util-to-hast/lib/handlers/image.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Image} from 'mdast'
* @import {State} from '../state.js'
*/
import {normalizeUri} from 'micromark-util-sanitize-uri'
/**
* Turn an mdast `image` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Image} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function image(state, node) {
/** @type {Properties} */
const properties = {src: normalizeUri(node.url)}
if (node.alt !== null && node.alt !== undefined) {
properties.alt = node.alt
}
if (node.title !== null && node.title !== undefined) {
properties.title = node.title
}
/** @type {Element} */
const result = {type: 'element', tagName: 'img', properties, children: []}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,55 @@
export namespace handlers {
export { blockquote };
export { hardBreak as break };
export { code };
export { strikethrough as delete };
export { emphasis };
export { footnoteReference };
export { heading };
export { html };
export { imageReference };
export { image };
export { inlineCode };
export { linkReference };
export { link };
export { listItem };
export { list };
export { paragraph };
export { root };
export { strong };
export { table };
export { tableCell };
export { tableRow };
export { text };
export { thematicBreak };
export { ignore as toml };
export { ignore as yaml };
export { ignore as definition };
export { ignore as footnoteDefinition };
}
import { blockquote } from './blockquote.js';
import { hardBreak } from './break.js';
import { code } from './code.js';
import { strikethrough } from './delete.js';
import { emphasis } from './emphasis.js';
import { footnoteReference } from './footnote-reference.js';
import { heading } from './heading.js';
import { html } from './html.js';
import { imageReference } from './image-reference.js';
import { image } from './image.js';
import { inlineCode } from './inline-code.js';
import { linkReference } from './link-reference.js';
import { link } from './link.js';
import { listItem } from './list-item.js';
import { list } from './list.js';
import { paragraph } from './paragraph.js';
import { root } from './root.js';
import { strong } from './strong.js';
import { table } from './table.js';
import { tableCell } from './table-cell.js';
import { tableRow } from './table-row.js';
import { text } from './text.js';
import { thematicBreak } from './thematic-break.js';
declare function ignore(): undefined;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAIyB,iBAAiB;0BAClB,YAAY;qBACjB,WAAW;8BACF,aAAa;yBAClB,eAAe;kCACN,yBAAyB;wBACnC,cAAc;qBACjB,WAAW;+BACD,sBAAsB;sBAC/B,YAAY;2BACP,kBAAkB;8BACf,qBAAqB;qBAC9B,WAAW;yBACP,gBAAgB;qBACpB,WAAW;0BACN,gBAAgB;qBACrB,WAAW;uBACT,aAAa;sBACd,YAAY;0BAER,iBAAiB;yBADlB,gBAAgB;qBAEpB,WAAW;8BACF,qBAAqB;AAuCjD,qCAEC"}

68
node_modules/mdast-util-to-hast/lib/handlers/index.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
/**
* @import {Handlers} from '../state.js'
*/
import {blockquote} from './blockquote.js'
import {hardBreak} from './break.js'
import {code} from './code.js'
import {strikethrough} from './delete.js'
import {emphasis} from './emphasis.js'
import {footnoteReference} from './footnote-reference.js'
import {heading} from './heading.js'
import {html} from './html.js'
import {imageReference} from './image-reference.js'
import {image} from './image.js'
import {inlineCode} from './inline-code.js'
import {linkReference} from './link-reference.js'
import {link} from './link.js'
import {listItem} from './list-item.js'
import {list} from './list.js'
import {paragraph} from './paragraph.js'
import {root} from './root.js'
import {strong} from './strong.js'
import {table} from './table.js'
import {tableRow} from './table-row.js'
import {tableCell} from './table-cell.js'
import {text} from './text.js'
import {thematicBreak} from './thematic-break.js'
/**
* Default handlers for nodes.
*
* @satisfies {Handlers}
*/
export const handlers = {
blockquote,
break: hardBreak,
code,
delete: strikethrough,
emphasis,
footnoteReference,
heading,
html,
imageReference,
image,
inlineCode,
linkReference,
link,
listItem,
list,
paragraph,
// @ts-expect-error: root is different, but hard to type.
root,
strong,
table,
tableCell,
tableRow,
text,
thematicBreak,
toml: ignore,
yaml: ignore,
definition: ignore,
footnoteDefinition: ignore
}
// Return nothing for nodes that are ignored.
function ignore() {
return undefined
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element, Text} from 'hast'
* @import {InlineCode} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `inlineCode` node into hast.
*
* @param {State} state
* Info passed around.
* @param {InlineCode} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function inlineCode(state: State, node: InlineCode): Element;
import type { State } from '../state.js';
import type { InlineCode } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=inline-code.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"inline-code.d.ts","sourceRoot":"","sources":["inline-code.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,kCAPW,KAAK,QAEL,UAAU,GAER,OAAO,CAiBnB;2BA3BuB,aAAa;gCADR,OAAO;6BADJ,MAAM"}

View File

@@ -0,0 +1,31 @@
/**
* @import {Element, Text} from 'hast'
* @import {InlineCode} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `inlineCode` node into hast.
*
* @param {State} state
* Info passed around.
* @param {InlineCode} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function inlineCode(state, node) {
/** @type {Text} */
const text = {type: 'text', value: node.value.replace(/\r?\n|\r/g, ' ')}
state.patch(node, text)
/** @type {Element} */
const result = {
type: 'element',
tagName: 'code',
properties: {},
children: [text]
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `linkReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {LinkReference} node
* mdast node.
* @returns {Array<ElementContent> | ElementContent}
* hast node.
*/
export function linkReference(state: State, node: LinkReference): Array<ElementContent> | ElementContent;
import type { State } from '../state.js';
import type { LinkReference } from 'mdast';
import type { ElementContent } from 'hast';
//# sourceMappingURL=link-reference.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link-reference.d.ts","sourceRoot":"","sources":["link-reference.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,qCAPW,KAAK,QAEL,aAAa,GAEX,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc,CA2BlD;2BAxCuB,aAAa;mCADL,OAAO;oCADe,MAAM"}

View File

@@ -0,0 +1,44 @@
/**
* @import {ElementContent, Element, Properties} from 'hast'
* @import {LinkReference} from 'mdast'
* @import {State} from '../state.js'
*/
import {normalizeUri} from 'micromark-util-sanitize-uri'
import {revert} from '../revert.js'
/**
* Turn an mdast `linkReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {LinkReference} node
* mdast node.
* @returns {Array<ElementContent> | ElementContent}
* hast node.
*/
export function linkReference(state, node) {
const id = String(node.identifier).toUpperCase()
const definition = state.definitionById.get(id)
if (!definition) {
return revert(state, node)
}
/** @type {Properties} */
const properties = {href: normalizeUri(definition.url || '')}
if (definition.title !== null && definition.title !== undefined) {
properties.title = definition.title
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'a',
properties,
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

15
node_modules/mdast-util-to-hast/lib/handlers/link.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `link` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Link} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function link(state: State, node: Link): Element;
import type { State } from '../state.js';
import type { Link } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=link.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,4BAPW,KAAK,QAEL,IAAI,GAEF,OAAO,CAoBnB;2BAhCuB,aAAa;0BADd,OAAO;6BADQ,MAAM"}

36
node_modules/mdast-util-to-hast/lib/handlers/link.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Link} from 'mdast'
* @import {State} from '../state.js'
*/
import {normalizeUri} from 'micromark-util-sanitize-uri'
/**
* Turn an mdast `link` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Link} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function link(state, node) {
/** @type {Properties} */
const properties = {href: normalizeUri(node.url)}
if (node.title !== null && node.title !== undefined) {
properties.title = node.title
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'a',
properties,
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,23 @@
/**
* @import {ElementContent, Element, Properties} from 'hast'
* @import {ListItem, Parents} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `listItem` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ListItem} node
* mdast node.
* @param {Parents | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
export function listItem(state: State, node: ListItem, parent: Parents | undefined): Element;
import type { State } from '../state.js';
import type { ListItem } from 'mdast';
import type { Parents } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=list-item.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"list-item.d.ts","sourceRoot":"","sources":["list-item.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,gCATW,KAAK,QAEL,QAAQ,UAER,OAAO,GAAG,SAAS,GAEjB,OAAO,CAwEnB;2BApFuB,aAAa;8BADD,OAAO;6BAAP,OAAO;6BADW,MAAM"}

View File

@@ -0,0 +1,119 @@
/**
* @import {ElementContent, Element, Properties} from 'hast'
* @import {ListItem, Parents} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `listItem` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ListItem} node
* mdast node.
* @param {Parents | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
export function listItem(state, node, parent) {
const results = state.all(node)
const loose = parent ? listLoose(parent) : listItemLoose(node)
/** @type {Properties} */
const properties = {}
/** @type {Array<ElementContent>} */
const children = []
if (typeof node.checked === 'boolean') {
const head = results[0]
/** @type {Element} */
let paragraph
if (head && head.type === 'element' && head.tagName === 'p') {
paragraph = head
} else {
paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}
results.unshift(paragraph)
}
if (paragraph.children.length > 0) {
paragraph.children.unshift({type: 'text', value: ' '})
}
paragraph.children.unshift({
type: 'element',
tagName: 'input',
properties: {type: 'checkbox', checked: node.checked, disabled: true},
children: []
})
// According to github-markdown-css, this class hides bullet.
// See: <https://github.com/sindresorhus/github-markdown-css>.
properties.className = ['task-list-item']
}
let index = -1
while (++index < results.length) {
const child = results[index]
// Add eols before nodes, except if this is a loose, first paragraph.
if (
loose ||
index !== 0 ||
child.type !== 'element' ||
child.tagName !== 'p'
) {
children.push({type: 'text', value: '\n'})
}
if (child.type === 'element' && child.tagName === 'p' && !loose) {
children.push(...child.children)
} else {
children.push(child)
}
}
const tail = results[results.length - 1]
// Add a final eol.
if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {
children.push({type: 'text', value: '\n'})
}
/** @type {Element} */
const result = {type: 'element', tagName: 'li', properties, children}
state.patch(node, result)
return state.applyData(node, result)
}
/**
* @param {Parents} node
* @return {Boolean}
*/
function listLoose(node) {
let loose = false
if (node.type === 'list') {
loose = node.spread || false
const children = node.children
let index = -1
while (!loose && ++index < children.length) {
loose = listItemLoose(children[index])
}
}
return loose
}
/**
* @param {ListItem} node
* @return {Boolean}
*/
function listItemLoose(node) {
const spread = node.spread
return spread === null || spread === undefined
? node.children.length > 1
: spread
}

20
node_modules/mdast-util-to-hast/lib/handlers/list.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @import {Element, Properties} from 'hast'
* @import {List} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `list` node into hast.
*
* @param {State} state
* Info passed around.
* @param {List} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function list(state: State, node: List): Element;
import type { State } from '../state.js';
import type { List } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=list.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,4BAPW,KAAK,QAEL,IAAI,GAEF,OAAO,CAsCnB;2BAhDuB,aAAa;0BADd,OAAO;6BADQ,MAAM"}

52
node_modules/mdast-util-to-hast/lib/handlers/list.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
/**
* @import {Element, Properties} from 'hast'
* @import {List} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `list` node into hast.
*
* @param {State} state
* Info passed around.
* @param {List} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function list(state, node) {
/** @type {Properties} */
const properties = {}
const results = state.all(node)
let index = -1
if (typeof node.start === 'number' && node.start !== 1) {
properties.start = node.start
}
// Like GitHub, add a class for custom styling.
while (++index < results.length) {
const child = results[index]
if (
child.type === 'element' &&
child.tagName === 'li' &&
child.properties &&
Array.isArray(child.properties.className) &&
child.properties.className.includes('task-list-item')
) {
properties.className = ['contains-task-list']
break
}
}
/** @type {Element} */
const result = {
type: 'element',
tagName: node.ordered ? 'ol' : 'ul',
properties,
children: state.wrap(results, true)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Paragraph} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `paragraph` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Paragraph} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function paragraph(state: State, node: Paragraph): Element;
import type { State } from '../state.js';
import type { Paragraph } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=paragraph.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,iCAPW,KAAK,QAEL,SAAS,GAEP,OAAO,CAanB;2BAvBuB,aAAa;+BADT,OAAO;6BADT,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Paragraph} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `paragraph` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Paragraph} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function paragraph(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'p',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

20
node_modules/mdast-util-to-hast/lib/handlers/root.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @import {Parents as HastParents, Root as HastRoot} from 'hast'
* @import {Root as MdastRoot} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `root` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastRoot} node
* mdast node.
* @returns {HastParents}
* hast node.
*/
export function root(state: State, node: MdastRoot): HastParents;
import type { State } from '../state.js';
import type { Root as MdastRoot } from 'mdast';
import type { Parents as HastParents } from 'hast';
//# sourceMappingURL=root.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["root.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,4BAPW,KAAK,QAEL,SAAS,GAEP,WAAW,CAQvB;2BAlBuB,aAAa;uCADD,OAAO;4CADgB,MAAM"}

22
node_modules/mdast-util-to-hast/lib/handlers/root.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
* @import {Parents as HastParents, Root as HastRoot} from 'hast'
* @import {Root as MdastRoot} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `root` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastRoot} node
* mdast node.
* @returns {HastParents}
* hast node.
*/
export function root(state, node) {
/** @type {HastRoot} */
const result = {type: 'root', children: state.wrap(state.all(node))}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Strong} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `strong` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Strong} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strong(state: State, node: Strong): Element;
import type { State } from '../state.js';
import type { Strong } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=strong.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["strong.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,8BAPW,KAAK,QAEL,MAAM,GAEJ,OAAO,CAanB;2BAvBuB,aAAa;4BADZ,OAAO;6BADN,MAAM"}

27
node_modules/mdast-util-to-hast/lib/handlers/strong.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Strong} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `strong` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Strong} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strong(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'strong',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {TableCell} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `tableCell` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableCell} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function tableCell(state: State, node: TableCell): Element;
import type { State } from '../state.js';
import type { TableCell } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=table-cell.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"table-cell.d.ts","sourceRoot":"","sources":["table-cell.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,iCAPW,KAAK,QAEL,SAAS,GAEP,OAAO,CAenB;2BAzBuB,aAAa;+BADT,OAAO;6BADT,MAAM"}

View File

@@ -0,0 +1,29 @@
/**
* @import {Element} from 'hast'
* @import {TableCell} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `tableCell` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableCell} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function tableCell(state, node) {
// Note: this function is normally not called: see `table-row` for how rows
// and their cells are compiled.
/** @type {Element} */
const result = {
type: 'element',
tagName: 'td', // Assume body cell.
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,23 @@
/**
* @import {Element, ElementContent, Properties} from 'hast'
* @import {Parents, TableRow} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `tableRow` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableRow} node
* mdast node.
* @param {Parents | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
export function tableRow(state: State, node: TableRow, parent: Parents | undefined): Element;
import type { State } from '../state.js';
import type { TableRow } from 'mdast';
import type { Parents } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=table-row.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["table-row.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,gCATW,KAAK,QAEL,QAAQ,UAER,OAAO,GAAG,SAAS,GAEjB,OAAO,CA+CnB;2BA3DuB,aAAa;8BADD,OAAO;6BAAP,OAAO;6BADW,MAAM"}

View File

@@ -0,0 +1,63 @@
/**
* @import {Element, ElementContent, Properties} from 'hast'
* @import {Parents, TableRow} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `tableRow` node into hast.
*
* @param {State} state
* Info passed around.
* @param {TableRow} node
* mdast node.
* @param {Parents | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
export function tableRow(state, node, parent) {
const siblings = parent ? parent.children : undefined
// Generate a body row when without parent.
const rowIndex = siblings ? siblings.indexOf(node) : 1
const tagName = rowIndex === 0 ? 'th' : 'td'
// To do: option to use `style`?
const align = parent && parent.type === 'table' ? parent.align : undefined
const length = align ? align.length : node.children.length
let cellIndex = -1
/** @type {Array<ElementContent>} */
const cells = []
while (++cellIndex < length) {
// Note: can also be undefined.
const cell = node.children[cellIndex]
/** @type {Properties} */
const properties = {}
const alignValue = align ? align[cellIndex] : undefined
if (alignValue) {
properties.align = alignValue
}
/** @type {Element} */
let result = {type: 'element', tagName, properties, children: []}
if (cell) {
result.children = state.all(cell)
state.patch(cell, result)
result = state.applyData(cell, result)
}
cells.push(result)
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'tr',
properties: {},
children: state.wrap(cells, true)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `table` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Table} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function table(state: State, node: Table): Element;
import type { State } from '../state.js';
import type { Table } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=table.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,6BAPW,KAAK,QAEL,KAAK,GAEH,OAAO,CA6CnB;2BAzDuB,aAAa;2BAFb,OAAO;6BACL,MAAM"}

61
node_modules/mdast-util-to-hast/lib/handlers/table.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
/**
* @import {Table} from 'mdast'
* @import {Element} from 'hast'
* @import {State} from '../state.js'
*/
import {pointEnd, pointStart} from 'unist-util-position'
/**
* Turn an mdast `table` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Table} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function table(state, node) {
const rows = state.all(node)
const firstRow = rows.shift()
/** @type {Array<Element>} */
const tableContent = []
if (firstRow) {
/** @type {Element} */
const head = {
type: 'element',
tagName: 'thead',
properties: {},
children: state.wrap([firstRow], true)
}
state.patch(node.children[0], head)
tableContent.push(head)
}
if (rows.length > 0) {
/** @type {Element} */
const body = {
type: 'element',
tagName: 'tbody',
properties: {},
children: state.wrap(rows, true)
}
const start = pointStart(node.children[1])
const end = pointEnd(node.children[node.children.length - 1])
if (start && end) body.position = {start, end}
tableContent.push(body)
}
/** @type {Element} */
const result = {
type: 'element',
tagName: 'table',
properties: {},
children: state.wrap(tableContent, true)
}
state.patch(node, result)
return state.applyData(node, result)
}

16
node_modules/mdast-util-to-hast/lib/handlers/text.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* Turn an mdast `text` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastText} node
* mdast node.
* @returns {HastElement | HastText}
* hast node.
*/
export function text(state: State, node: MdastText): HastElement | HastText;
import type { State } from '../state.js';
import type { Text as MdastText } from 'mdast';
import type { Element as HastElement } from 'hast';
import type { Text as HastText } from 'hast';
//# sourceMappingURL=text.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,4BAPW,KAAK,QAEL,SAAS,GAEP,WAAW,GAAG,QAAQ,CAQlC;2BApBuB,aAAa;uCADD,OAAO;4CADgB,MAAM;sCAAN,MAAM"}

24
node_modules/mdast-util-to-hast/lib/handlers/text.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
/**
* @import {Element as HastElement, Text as HastText} from 'hast'
* @import {Text as MdastText} from 'mdast'
* @import {State} from '../state.js'
*/
import {trimLines} from 'trim-lines'
/**
* Turn an mdast `text` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastText} node
* mdast node.
* @returns {HastElement | HastText}
* hast node.
*/
export function text(state, node) {
/** @type {HastText} */
const result = {type: 'text', value: trimLines(String(node.value))}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {ThematicBreak} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `thematicBreak` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ThematicBreak} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function thematicBreak(state: State, node: ThematicBreak): Element;
import type { State } from '../state.js';
import type { ThematicBreak } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=thematic-break.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,qCAPW,KAAK,QAEL,aAAa,GAEX,OAAO,CAanB;2BAvBuB,aAAa;mCADL,OAAO;6BADb,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {ThematicBreak} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `thematicBreak` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ThematicBreak} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function thematicBreak(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'hr',
properties: {},
children: []
}
state.patch(node, result)
return state.applyData(node, result)
}

82
node_modules/mdast-util-to-hast/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
/**
* Transform mdast to hast.
*
* ##### Notes
*
* ###### HTML
*
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
* as semistandard `raw` nodes.
* Most utilities ignore `raw` nodes but two notable ones dont:
*
* * `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` 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
*
* ###### Footnotes
*
* Many options supported here relate to footnotes.
* Footnotes are not specified by CommonMark, which we follow by default.
* They are supported by GitHub, so footnotes can be enabled in markdown with
* `mdast-util-gfm`.
*
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
* that explains footnotes, which is hidden for sighted users but shown to
* assistive technology.
* When your page is not in English, you must define translated values.
*
* Back references use ARIA attributes, but the section label itself uses a
* heading that is hidden with an `sr-only` class.
* To show it to sighted users, define different attributes in
* `footnoteLabelProperties`.
*
* ###### Clobbering
*
* Footnotes introduces a problem, as it links footnote calls to footnote
* definitions on the page through `id` attributes generated from user content,
* which results in DOM clobbering.
*
* DOM clobbering is this:
*
* ```html
* <p id=x></p>
* <script>alert(x) // `x` now refers to the DOM `p#x` element</script>
* ```
*
* Elements by their ID are made available by browsers on the `window` object,
* which is a security risk.
* Using a prefix solves this problem.
*
* More information on how to handle clobbering and the prefix is explained in
* Example: headings (DOM clobbering) in `rehype-sanitize`.
*
* ###### Unknown nodes
*
* Unknown nodes are nodes with a type that isnt in `handlers` or `passThrough`.
* The default behavior for unknown nodes is:
*
* * when the node has a `value` (and doesnt 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
*
* This behavior can be changed by passing an `unknownHandler`.
*
* @param {MdastNodes} tree
* mdast tree.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {HastNodes}
* hast tree.
*/
export function toHast(tree: MdastNodes, options?: Options | null | undefined): HastNodes;
import type { Nodes as MdastNodes } from 'mdast';
import type { Options } from './state.js';
import type { Nodes as HastNodes } from 'hast';
//# sourceMappingURL=index.d.ts.map

1
node_modules/mdast-util-to-hast/lib/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,6BAPW,UAAU,YAEV,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,SAAS,CAqBrB;yCAvGqC,OAAO;6BACnB,YAAY;wCAFD,MAAM"}

106
node_modules/mdast-util-to-hast/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
/**
* @import {Nodes as HastNodes} from 'hast'
* @import {Nodes as MdastNodes} from 'mdast'
* @import {Options} from './state.js'
*/
import {ok as assert} from 'devlop'
import {footer} from './footer.js'
import {createState} from './state.js'
/**
* Transform mdast to hast.
*
* ##### Notes
*
* ###### HTML
*
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
* as semistandard `raw` nodes.
* Most utilities ignore `raw` nodes but two notable ones dont:
*
* * `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` 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
*
* ###### Footnotes
*
* Many options supported here relate to footnotes.
* Footnotes are not specified by CommonMark, which we follow by default.
* They are supported by GitHub, so footnotes can be enabled in markdown with
* `mdast-util-gfm`.
*
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
* that explains footnotes, which is hidden for sighted users but shown to
* assistive technology.
* When your page is not in English, you must define translated values.
*
* Back references use ARIA attributes, but the section label itself uses a
* heading that is hidden with an `sr-only` class.
* To show it to sighted users, define different attributes in
* `footnoteLabelProperties`.
*
* ###### Clobbering
*
* Footnotes introduces a problem, as it links footnote calls to footnote
* definitions on the page through `id` attributes generated from user content,
* which results in DOM clobbering.
*
* DOM clobbering is this:
*
* ```html
* <p id=x></p>
* <script>alert(x) // `x` now refers to the DOM `p#x` element</script>
* ```
*
* Elements by their ID are made available by browsers on the `window` object,
* which is a security risk.
* Using a prefix solves this problem.
*
* More information on how to handle clobbering and the prefix is explained in
* Example: headings (DOM clobbering) in `rehype-sanitize`.
*
* ###### Unknown nodes
*
* Unknown nodes are nodes with a type that isnt in `handlers` or `passThrough`.
* The default behavior for unknown nodes is:
*
* * when the node has a `value` (and doesnt 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
*
* This behavior can be changed by passing an `unknownHandler`.
*
* @param {MdastNodes} tree
* mdast tree.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {HastNodes}
* hast tree.
*/
export function toHast(tree, options) {
const state = createState(tree, options)
const node = state.one(tree, undefined)
const foot = footer(state)
/** @type {HastNodes} */
const result = Array.isArray(node)
? {type: 'root', children: node}
: node || {type: 'root', children: []}
if (foot) {
// If theres a footer, there were definitions, meaning block
// content.
// So `result` is a parent node.
assert('children' in result)
result.children.push({type: 'text', value: '\n'}, foot)
}
return result
}

21
node_modules/mdast-util-to-hast/lib/revert.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/**
* @import {ElementContent} from 'hast'
* @import {Reference, Nodes} from 'mdast'
* @import {State} from './state.js'
*/
/**
* Return the content of a reference without definition as plain text.
*
* @param {State} state
* Info passed around.
* @param {Extract<Nodes, Reference>} node
* Reference node (image, link).
* @returns {Array<ElementContent>}
* hast content.
*/
export function revert(state: State, node: Extract<Nodes, Reference>): Array<ElementContent>;
import type { State } from './state.js';
import type { Nodes } from 'mdast';
import type { Reference } from 'mdast';
import type { ElementContent } from 'hast';
//# sourceMappingURL=revert.d.ts.map

1
node_modules/mdast-util-to-hast/lib/revert.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"revert.d.ts","sourceRoot":"","sources":["revert.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,8BAPW,KAAK,QAEL,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,GAEvB,KAAK,CAAC,cAAc,CAAC,CAmCjC;2BA7CuB,YAAY;2BADD,OAAO;+BAAP,OAAO;oCADT,MAAM"}

49
node_modules/mdast-util-to-hast/lib/revert.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
/**
* @import {ElementContent} from 'hast'
* @import {Reference, Nodes} from 'mdast'
* @import {State} from './state.js'
*/
/**
* Return the content of a reference without definition as plain text.
*
* @param {State} state
* Info passed around.
* @param {Extract<Nodes, Reference>} node
* Reference node (image, link).
* @returns {Array<ElementContent>}
* hast content.
*/
export function revert(state, node) {
const subtype = node.referenceType
let suffix = ']'
if (subtype === 'collapsed') {
suffix += '[]'
} else if (subtype === 'full') {
suffix += '[' + (node.label || node.identifier) + ']'
}
if (node.type === 'imageReference') {
return [{type: 'text', value: '![' + node.alt + suffix}]
}
const contents = state.all(node)
const head = contents[0]
if (head && head.type === 'text') {
head.value = '[' + head.value
} else {
contents.unshift({type: 'text', value: '['})
}
const tail = contents[contents.length - 1]
if (tail && tail.type === 'text') {
tail.value += suffix
} else {
contents.push({type: 'text', value: suffix})
}
return contents
}

233
node_modules/mdast-util-to-hast/lib/state.d.ts generated vendored Normal file
View File

@@ -0,0 +1,233 @@
/**
* Create `state` from an mdast tree.
*
* @param {MdastNodes} tree
* mdast node to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {State}
* `state` function.
*/
export function createState(tree: MdastNodes, options?: Options | null | undefined): State;
/**
* Wrap `nodes` with line endings between each node.
*
* @template {HastRootContent} Type
* Node type.
* @param {Array<Type>} nodes
* List of nodes to wrap.
* @param {boolean | undefined} [loose=false]
* Whether to add line endings at start and end (default: `false`).
* @returns {Array<HastText | Type>}
* Wrapped nodes.
*/
export function wrap<Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined): Array<HastText | Type>;
/**
* Handle a node.
*/
export type Handler = (state: State, node: any, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined;
/**
* Handle nodes.
*/
export type Handlers = Partial<Record<MdastNodes["type"], Handler>>;
/**
* Configuration (optional).
*/
export type Options = {
/**
* Whether to persist raw HTML in markdown in the hast tree (default:
* `false`).
*/
allowDangerousHtml?: boolean | null | undefined;
/**
* Prefix to use before the `id` property on footnotes to prevent them from
* *clobbering* (default: `'user-content-'`).
*
* Pass `''` for trusted markdown and when you are careful with
* polyfilling.
* You could pass a different prefix.
*
* DOM clobbering is this:
*
* ```html
* <p id="x"></p>
* <script>alert(x) // `x` now refers to the `p#x` DOM element</script>
* ```
*
* The above example shows that elements are made available by browsers, by
* their ID, on the `window` object.
* This is a security risk because you might be expecting some other variable
* at that place.
* It can also break polyfills.
* Using a prefix solves these problems.
*/
clobberPrefix?: string | null | undefined;
/**
* Corresponding virtual file representing the input document (optional).
*/
file?: VFile | null | undefined;
/**
* Content of the backreference back to references (default: `defaultFootnoteBackContent`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackContent(_, rereferenceIndex) {
* const result = [{type: 'text', value: '↩'}]
*
* if (rereferenceIndex > 1) {
* result.push({
* type: 'element',
* tagName: 'sup',
* properties: {},
* children: [{type: 'text', value: String(rereferenceIndex)}]
* })
* }
*
* return result
* }
* ```
*
* This content is used in the `a` element of each backreference (the `↩`
* links).
*/
footnoteBackContent?: FootnoteBackContentTemplate | string | null | undefined;
/**
* Label to describe the backreference back to references (default:
* `defaultFootnoteBackLabel`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
* return (
* 'Back to reference ' +
* (referenceIndex + 1) +
* (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')
* )
* }
* ```
*
* Change it when the markdown is not in English.
*
* This label is used in the `ariaLabel` property on each backreference
* (the `↩` links).
* It affects users of assistive technology.
*/
footnoteBackLabel?: FootnoteBackLabelTemplate | string | null | undefined;
/**
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* Change it when the markdown is not in English.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
*/
footnoteLabel?: string | null | undefined;
/**
* Properties to use on the footnote label (default: `{className:
* ['sr-only']}`).
*
* Change it to show the label and add other properties.
*
* This label is typically hidden visually (assuming an `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass an empty string.
* You can also add different properties.
*
* > **Note**: `id: 'footnote-label'` is always added, because footnote
* > calls use it with `aria-describedby` to provide an accessible label.
*/
footnoteLabelProperties?: HastProperties | null | undefined;
/**
* HTML tag name to use for the footnote label element (default: `'h2'`).
*
* Change it to match your document structure.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
*/
footnoteLabelTagName?: string | null | undefined;
/**
* Extra handlers for nodes (optional).
*/
handlers?: Handlers | null | undefined;
/**
* List of custom mdast node types to pass through (keep) in hast (note that
* the node itself is passed, but eventual children are transformed)
* (optional).
*/
passThrough?: Array<MdastNodes["type"]> | null | undefined;
/**
* Handler for all unknown nodes (optional).
*/
unknownHandler?: Handler | null | undefined;
};
/**
* Info passed around.
*/
export type State = {
/**
* Transform the children of an mdast parent to hast.
*/
all: (node: MdastNodes) => Array<HastElementContent>;
/**
* Honor the `data` of `from`, and generate an element instead of `node`.
*/
applyData: <Type extends HastNodes>(from: MdastNodes, to: Type) => HastElement | Type;
/**
* Definitions by their identifier.
*/
definitionById: Map<string, MdastDefinition>;
/**
* Footnote definitions by their identifier.
*/
footnoteById: Map<string, MdastFootnoteDefinition>;
/**
* Counts for how often the same footnote was called.
*/
footnoteCounts: Map<string, number>;
/**
* Identifiers of order when footnote calls first appear in tree order.
*/
footnoteOrder: Array<string>;
/**
* Applied handlers.
*/
handlers: Handlers;
/**
* Transform an mdast node to hast.
*/
one: (node: MdastNodes, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined;
/**
* Configuration.
*/
options: Options;
/**
* Copy a nodes positional info.
*/
patch: (from: MdastNodes, node: HastNodes) => undefined;
/**
* Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.
*/
wrap: <Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<HastText | Type>;
};
import type { Nodes as MdastNodes } from 'mdast';
import type { RootContent as HastRootContent } from 'hast';
import type { Text as HastText } from 'hast';
import type { Parents as MdastParents } from 'mdast';
import type { ElementContent as HastElementContent } from 'hast';
import type { VFile } from 'vfile';
import type { FootnoteBackContentTemplate } from './footer.js';
import type { FootnoteBackLabelTemplate } from './footer.js';
import type { Properties as HastProperties } from 'hast';
import type { Nodes as HastNodes } from 'hast';
import type { Element as HastElement } from 'hast';
import type { Definition as MdastDefinition } from 'mdast';
import type { FootnoteDefinition as MdastFootnoteDefinition } from 'mdast';
//# sourceMappingURL=state.d.ts.map

1
node_modules/mdast-util-to-hast/lib/state.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["state.js"],"names":[],"mappings":"AA2LA;;;;;;;;;GASG;AACH,kCAPW,UAAU,YAEV,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,KAAK,CAiIjB;AAqGD;;;;;;;;;;;GAWG;AACH,qBAT+B,IAAI,SAAtB,eAAiB,SAEnB,KAAK,CAAC,IAAI,CAAC,UAEX,OAAO,GAAG,SAAS,GAEjB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAsBlC;;;;8BA9aU,KAAK,QAEL,GAAG,UAEH,YAAY,GAAG,SAAS,KAEtB,KAAK,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,GAAG,SAAS;;;;uBAG1D,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;;;;;;;;;yBAK3C,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;oBAG1B,MAAM,GAAG,IAAI,GAAG,SAAS;;;;WAqBzB,KAAK,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;0BAExB,2BAA2B,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;wBAwBvD,yBAAyB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;oBAqBrD,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;8BASzB,cAAc,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;2BAcjC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;eASzB,QAAQ,GAAG,IAAI,GAAG,SAAS;;;;;;kBAE3B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS;;;;qBAI5C,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;;SAK1B,CAAC,IAAI,EAAE,UAAU,KAAK,KAAK,CAAC,kBAAkB,CAAC;;;;eAE/C,CAAC,IAAI,SAAS,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,KAAK,WAAW,GAAG,IAAI;;;;oBAE1E,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;;;;kBAE5B,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC;;;;oBAEpC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;;;;mBAEnB,KAAK,CAAC,MAAM,CAAC;;;;cAEb,QAAQ;;;;SAER,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,GAAG,SAAS,KAAK,KAAK,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,GAAG,SAAS;;;;aAElH,OAAO;;;;WAEP,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,KAAK,SAAS;;;;UAEhD,CAAC,IAAI,SAAS,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,KAAK,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;;yCA/J7G,OAAO;oDANP,MAAM;sCAAN,MAAM;6CAMN,OAAO;0DANP,MAAM;2BAOQ,OAAO;iDAIrB,aAAa;+CAAb,aAAa;kDAXb,MAAM;wCAAN,MAAM;4CAAN,MAAM;mDAMN,OAAO;mEAAP,OAAO"}

476
node_modules/mdast-util-to-hast/lib/state.js generated vendored Normal file
View File

@@ -0,0 +1,476 @@
/**
* @import {
* ElementContent as HastElementContent,
* Element as HastElement,
* Nodes as HastNodes,
* Properties as HastProperties,
* RootContent as HastRootContent,
* Text as HastText
* } from 'hast'
* @import {
* Definition as MdastDefinition,
* FootnoteDefinition as MdastFootnoteDefinition,
* Nodes as MdastNodes,
* Parents as MdastParents
* } from 'mdast'
* @import {VFile} from 'vfile'
* @import {
* FootnoteBackContentTemplate,
* FootnoteBackLabelTemplate
* } from './footer.js'
*/
/**
* @callback Handler
* Handle a node.
* @param {State} state
* Info passed around.
* @param {any} node
* mdast node to handle.
* @param {MdastParents | undefined} parent
* Parent of `node`.
* @returns {Array<HastElementContent> | HastElementContent | undefined}
* hast node.
*
* @typedef {Partial<Record<MdastNodes['type'], Handler>>} Handlers
* Handle nodes.
*
* @typedef Options
* Configuration (optional).
* @property {boolean | null | undefined} [allowDangerousHtml=false]
* Whether to persist raw HTML in markdown in the hast tree (default:
* `false`).
* @property {string | null | undefined} [clobberPrefix='user-content-']
* Prefix to use before the `id` property on footnotes to prevent them from
* *clobbering* (default: `'user-content-'`).
*
* Pass `''` for trusted markdown and when you are careful with
* polyfilling.
* You could pass a different prefix.
*
* DOM clobbering is this:
*
* ```html
* <p id="x"></p>
* <script>alert(x) // `x` now refers to the `p#x` DOM element</script>
* ```
*
* The above example shows that elements are made available by browsers, by
* their ID, on the `window` object.
* This is a security risk because you might be expecting some other variable
* at that place.
* It can also break polyfills.
* Using a prefix solves these problems.
* @property {VFile | null | undefined} [file]
* Corresponding virtual file representing the input document (optional).
* @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]
* Content of the backreference back to references (default: `defaultFootnoteBackContent`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackContent(_, rereferenceIndex) {
* const result = [{type: 'text', value: '↩'}]
*
* if (rereferenceIndex > 1) {
* result.push({
* type: 'element',
* tagName: 'sup',
* properties: {},
* children: [{type: 'text', value: String(rereferenceIndex)}]
* })
* }
*
* return result
* }
* ```
*
* This content is used in the `a` element of each backreference (the `↩`
* links).
* @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]
* Label to describe the backreference back to references (default:
* `defaultFootnoteBackLabel`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
* return (
* 'Back to reference ' +
* (referenceIndex + 1) +
* (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')
* )
* }
* ```
*
* Change it when the markdown is not in English.
*
* This label is used in the `ariaLabel` property on each backreference
* (the `↩` links).
* It affects users of assistive technology.
* @property {string | null | undefined} [footnoteLabel='Footnotes']
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* Change it when the markdown is not in English.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
* @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]
* Properties to use on the footnote label (default: `{className:
* ['sr-only']}`).
*
* Change it to show the label and add other properties.
*
* This label is typically hidden visually (assuming an `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass an empty string.
* You can also add different properties.
*
* > **Note**: `id: 'footnote-label'` is always added, because footnote
* > calls use it with `aria-describedby` to provide an accessible label.
* @property {string | null | undefined} [footnoteLabelTagName='h2']
* HTML tag name to use for the footnote label element (default: `'h2'`).
*
* Change it to match your document structure.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
* @property {Handlers | null | undefined} [handlers]
* Extra handlers for nodes (optional).
* @property {Array<MdastNodes['type']> | null | undefined} [passThrough]
* List of custom mdast node types to pass through (keep) in hast (note that
* the node itself is passed, but eventual children are transformed)
* (optional).
* @property {Handler | null | undefined} [unknownHandler]
* Handler for all unknown nodes (optional).
*
* @typedef State
* Info passed around.
* @property {(node: MdastNodes) => Array<HastElementContent>} all
* Transform the children of an mdast parent to hast.
* @property {<Type extends HastNodes>(from: MdastNodes, to: Type) => HastElement | Type} applyData
* Honor the `data` of `from`, and generate an element instead of `node`.
* @property {Map<string, MdastDefinition>} definitionById
* Definitions by their identifier.
* @property {Map<string, MdastFootnoteDefinition>} footnoteById
* Footnote definitions by their identifier.
* @property {Map<string, number>} footnoteCounts
* Counts for how often the same footnote was called.
* @property {Array<string>} footnoteOrder
* Identifiers of order when footnote calls first appear in tree order.
* @property {Handlers} handlers
* Applied handlers.
* @property {(node: MdastNodes, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined} one
* Transform an mdast node to hast.
* @property {Options} options
* Configuration.
* @property {(from: MdastNodes, node: HastNodes) => undefined} patch
* Copy a nodes positional info.
* @property {<Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<HastText | Type>} wrap
* Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.
*/
import structuredClone from '@ungap/structured-clone'
import {visit} from 'unist-util-visit'
import {position} from 'unist-util-position'
import {handlers as defaultHandlers} from './handlers/index.js'
const own = {}.hasOwnProperty
/** @type {Options} */
const emptyOptions = {}
/**
* Create `state` from an mdast tree.
*
* @param {MdastNodes} tree
* mdast node to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {State}
* `state` function.
*/
export function createState(tree, options) {
const settings = options || emptyOptions
/** @type {Map<string, MdastDefinition>} */
const definitionById = new Map()
/** @type {Map<string, MdastFootnoteDefinition>} */
const footnoteById = new Map()
/** @type {Map<string, number>} */
const footnoteCounts = new Map()
/** @type {Handlers} */
// @ts-expect-error: the root handler returns a root.
// Hard to type.
const handlers = {...defaultHandlers, ...settings.handlers}
/** @type {State} */
const state = {
all,
applyData,
definitionById,
footnoteById,
footnoteCounts,
footnoteOrder: [],
handlers,
one,
options: settings,
patch,
wrap
}
visit(tree, function (node) {
if (node.type === 'definition' || node.type === 'footnoteDefinition') {
const map = node.type === 'definition' ? definitionById : footnoteById
const id = String(node.identifier).toUpperCase()
// Mimick CM behavior of link definitions.
// See: <https://github.com/syntax-tree/mdast-util-definitions/blob/9032189/lib/index.js#L20-L21>.
if (!map.has(id)) {
// @ts-expect-error: node type matches map.
map.set(id, node)
}
}
})
return state
/**
* Transform an mdast node into a hast node.
*
* @param {MdastNodes} node
* mdast node.
* @param {MdastParents | undefined} [parent]
* Parent of `node`.
* @returns {Array<HastElementContent> | HastElementContent | undefined}
* Resulting hast node.
*/
function one(node, parent) {
const type = node.type
const handle = state.handlers[type]
if (own.call(state.handlers, type) && handle) {
return handle(state, node, parent)
}
if (state.options.passThrough && state.options.passThrough.includes(type)) {
if ('children' in node) {
const {children, ...shallow} = node
const result = structuredClone(shallow)
// @ts-expect-error: TS doesnt understand…
result.children = state.all(node)
// @ts-expect-error: TS doesnt understand…
return result
}
// @ts-expect-error: its custom.
return structuredClone(node)
}
const unknown = state.options.unknownHandler || defaultUnknownHandler
return unknown(state, node, parent)
}
/**
* Transform the children of an mdast node into hast nodes.
*
* @param {MdastNodes} parent
* mdast node to compile
* @returns {Array<HastElementContent>}
* Resulting hast nodes.
*/
function all(parent) {
/** @type {Array<HastElementContent>} */
const values = []
if ('children' in parent) {
const nodes = parent.children
let index = -1
while (++index < nodes.length) {
const result = state.one(nodes[index], parent)
// To do: see if we van clean this? Can we merge texts?
if (result) {
if (index && nodes[index - 1].type === 'break') {
if (!Array.isArray(result) && result.type === 'text') {
result.value = trimMarkdownSpaceStart(result.value)
}
if (!Array.isArray(result) && result.type === 'element') {
const head = result.children[0]
if (head && head.type === 'text') {
head.value = trimMarkdownSpaceStart(head.value)
}
}
}
if (Array.isArray(result)) {
values.push(...result)
} else {
values.push(result)
}
}
}
}
return values
}
}
/**
* Copy a nodes positional info.
*
* @param {MdastNodes} from
* mdast node to copy from.
* @param {HastNodes} to
* hast node to copy into.
* @returns {undefined}
* Nothing.
*/
function patch(from, to) {
if (from.position) to.position = position(from)
}
/**
* Honor the `data` of `from` and maybe generate an element instead of `to`.
*
* @template {HastNodes} Type
* Node type.
* @param {MdastNodes} from
* mdast node to use data from.
* @param {Type} to
* hast node to change.
* @returns {HastElement | Type}
* Nothing.
*/
function applyData(from, to) {
/** @type {HastElement | Type} */
let result = to
// Handle `data.hName`, `data.hProperties, `data.hChildren`.
if (from && from.data) {
const hName = from.data.hName
const hChildren = from.data.hChildren
const hProperties = from.data.hProperties
if (typeof hName === 'string') {
// Transforming the node resulted in an element with a different name
// than wanted:
if (result.type === 'element') {
result.tagName = hName
}
// Transforming the node resulted in a non-element, which happens for
// raw, text, and root nodes (unless custom handlers are passed).
// The intent of `hName` is to create an element, but likely also to keep
// the content around (otherwise: pass `hChildren`).
else {
/** @type {Array<HastElementContent>} */
// @ts-expect-error: assume no doctypes in `root`.
const children = 'children' in result ? result.children : [result]
result = {type: 'element', tagName: hName, properties: {}, children}
}
}
if (result.type === 'element' && hProperties) {
Object.assign(result.properties, structuredClone(hProperties))
}
if (
'children' in result &&
result.children &&
hChildren !== null &&
hChildren !== undefined
) {
result.children = hChildren
}
}
return result
}
/**
* Transform an unknown node.
*
* @param {State} state
* Info passed around.
* @param {MdastNodes} node
* Unknown mdast node.
* @returns {HastElement | HastText}
* Resulting hast node.
*/
function defaultUnknownHandler(state, node) {
const data = node.data || {}
/** @type {HastElement | HastText} */
const result =
'value' in node &&
!(own.call(data, 'hProperties') || own.call(data, 'hChildren'))
? {type: 'text', value: node.value}
: {
type: 'element',
tagName: 'div',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}
/**
* Wrap `nodes` with line endings between each node.
*
* @template {HastRootContent} Type
* Node type.
* @param {Array<Type>} nodes
* List of nodes to wrap.
* @param {boolean | undefined} [loose=false]
* Whether to add line endings at start and end (default: `false`).
* @returns {Array<HastText | Type>}
* Wrapped nodes.
*/
export function wrap(nodes, loose) {
/** @type {Array<HastText | Type>} */
const result = []
let index = -1
if (loose) {
result.push({type: 'text', value: '\n'})
}
while (++index < nodes.length) {
if (index) result.push({type: 'text', value: '\n'})
result.push(nodes[index])
}
if (loose && nodes.length > 0) {
result.push({type: 'text', value: '\n'})
}
return result
}
/**
* Trim spaces and tabs at the start of `value`.
*
* @param {string} value
* Value to trim.
* @returns {string}
* Result.
*/
function trimMarkdownSpaceStart(value) {
let index = 0
let code = value.charCodeAt(index)
while (code === 9 || code === 32) {
index++
code = value.charCodeAt(index)
}
return value.slice(index)
}

22
node_modules/mdast-util-to-hast/license generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

119
node_modules/mdast-util-to-hast/package.json generated vendored Normal file
View File

@@ -0,0 +1,119 @@
{
"name": "mdast-util-to-hast",
"version": "13.2.1",
"description": "mdast utility to transform to hast",
"license": "MIT",
"keywords": [
"unist",
"mdast",
"mdast-util",
"hast",
"hast-util",
"util",
"utility",
"markdown",
"html"
],
"repository": "syntax-tree/mdast-util-to-hast",
"bugs": "https://github.com/syntax-tree/mdast-util-to-hast/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"sideEffects": false,
"type": "module",
"exports": "./index.js",
"files": [
"lib/",
"index.d.ts.map",
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/hast": "^3.0.0",
"@types/mdast": "^4.0.0",
"@ungap/structured-clone": "^1.0.0",
"devlop": "^1.0.0",
"micromark-util-sanitize-uri": "^2.0.0",
"trim-lines": "^3.0.0",
"unist-util-position": "^5.0.0",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"@types/ungap__structured-clone": "^1.0.0",
"c8": "^9.0.0",
"hast-util-to-html": "^9.0.0",
"hastscript": "^9.0.0",
"mdast-util-from-markdown": "^2.0.0",
"mdast-util-gfm": "^3.0.0",
"micromark-extension-gfm": "^3.0.0",
"prettier": "^3.0.0",
"remark-cli": "^12.0.0",
"remark-preset-wooorm": "^10.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.5.1-rc",
"xo": "^0.58.0"
},
"scripts": {
"prepack": "npm run build && npm run format",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --conditions development test/index.js",
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
},
"prettier": {
"bracketSpacing": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
},
"remarkConfig": {
"plugins": [
"remark-preset-wooorm",
[
"remark-lint-no-html",
false
]
]
},
"typeCoverage": {
"atLeast": 100,
"detail": true,
"ignoreCatch": true,
"#": "needed `any`s",
"ignoreFiles": [
"lib/state.d.ts"
],
"strict": true
},
"xo": {
"overrides": [
{
"files": [
"**/*.ts"
],
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/consistent-type-definitions": "off"
}
}
],
"prettier": true,
"rules": {
"import/no-cycle": "error",
"max-depth": "off",
"unicorn/prefer-at": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-string-replace-all": "off"
}
}
}

1725
node_modules/mdast-util-to-hast/readme.md generated vendored Normal file

File diff suppressed because it is too large Load Diff