Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.

This commit is contained in:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
/**
* @import {Blockquote, Parents} from 'mdast'
* @import {Info, Map, State} from 'mdast-util-to-markdown'
*/
/**
* @param {Blockquote} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function blockquote(node: Blockquote, _: Parents | undefined, state: State, info: Info): string;
import type { Blockquote } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=blockquote.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["blockquote.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,iCANW,UAAU,KACV,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAalB;gCAtBqC,OAAO;6BAAP,OAAO;2BACV,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,29 @@
/**
* @import {Blockquote, Parents} from 'mdast'
* @import {Info, Map, State} from 'mdast-util-to-markdown'
*/
/**
* @param {Blockquote} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function blockquote(node, _, state, info) {
const exit = state.enter('blockquote')
const tracker = state.createTracker(info)
tracker.move('> ')
tracker.shift(2)
const value = state.indentLines(
state.containerFlow(node, tracker.current()),
map
)
exit()
return value
}
/** @type {Map} */
function map(line, _, blank) {
return '>' + (blank ? '' : ' ') + line
}

View File

@@ -0,0 +1,13 @@
/**
* @param {Break} _
* @param {Parents | undefined} _1
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function hardBreak(_: Break, _1: Parents | undefined, state: State, info: Info): string;
import type { Break } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=break.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"break.d.ts","sourceRoot":"","sources":["break.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,6BANW,KAAK,MACL,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAiBlB;2BA5BgC,OAAO;6BAAP,OAAO;2BACV,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,30 @@
/**
* @import {Break, Parents} from 'mdast'
* @import {Info, State} from 'mdast-util-to-markdown'
*/
import {patternInScope} from '../util/pattern-in-scope.js'
/**
* @param {Break} _
* @param {Parents | undefined} _1
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function hardBreak(_, _1, state, info) {
let index = -1
while (++index < state.unsafe.length) {
// If we cant put eols in this construct (setext headings, tables), use a
// space instead.
if (
state.unsafe[index].character === '\n' &&
patternInScope(state.stack, state.unsafe[index])
) {
return /[ \t]/.test(info.before) ? '' : ' '
}
}
return '\\\n'
}

View File

@@ -0,0 +1,13 @@
/**
* @param {Code} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function code(node: Code, _: Parents | undefined, state: State, info: Info): string;
import type { Code } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=code.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["code.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAuDlB;0BAnE+B,OAAO;6BAAP,OAAO;2BADJ,wBAAwB;0BAAxB,wBAAwB"}

75
node_modules/mdast-util-to-markdown/lib/handle/code.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
/**
* @import {Info, Map, State} from 'mdast-util-to-markdown'
* @import {Code, Parents} from 'mdast'
*/
import {longestStreak} from 'longest-streak'
import {formatCodeAsIndented} from '../util/format-code-as-indented.js'
import {checkFence} from '../util/check-fence.js'
/**
* @param {Code} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function code(node, _, state, info) {
const marker = checkFence(state)
const raw = node.value || ''
const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'
if (formatCodeAsIndented(node, state)) {
const exit = state.enter('codeIndented')
const value = state.indentLines(raw, map)
exit()
return value
}
const tracker = state.createTracker(info)
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3))
const exit = state.enter('codeFenced')
let value = tracker.move(sequence)
if (node.lang) {
const subexit = state.enter(`codeFencedLang${suffix}`)
value += tracker.move(
state.safe(node.lang, {
before: value,
after: ' ',
encode: ['`'],
...tracker.current()
})
)
subexit()
}
if (node.lang && node.meta) {
const subexit = state.enter(`codeFencedMeta${suffix}`)
value += tracker.move(' ')
value += tracker.move(
state.safe(node.meta, {
before: value,
after: '\n',
encode: ['`'],
...tracker.current()
})
)
subexit()
}
value += tracker.move('\n')
if (raw) {
value += tracker.move(raw + '\n')
}
value += tracker.move(sequence)
exit()
return value
}
/** @type {Map} */
function map(line, _, blank) {
return (blank ? '' : ' ') + line
}

View File

@@ -0,0 +1,13 @@
/**
* @param {Definition} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function definition(node: Definition, _: Parents | undefined, state: State, info: Info): string;
import type { Definition } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=definition.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["definition.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,iCANW,UAAU,KACV,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA+DlB;gCAzEqC,OAAO;6BAAP,OAAO;2BADf,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,76 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Definition, Parents} from 'mdast'
*/
import {checkQuote} from '../util/check-quote.js'
/**
* @param {Definition} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function definition(node, _, state, info) {
const quote = checkQuote(state)
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
const exit = state.enter('definition')
let subexit = state.enter('label')
const tracker = state.createTracker(info)
let value = tracker.move('[')
value += tracker.move(
state.safe(state.associationId(node), {
before: value,
after: ']',
...tracker.current()
})
)
value += tracker.move(']: ')
subexit()
if (
// If theres no url, or…
!node.url ||
// If there are control characters or whitespace.
/[\0- \u007F]/.test(node.url)
) {
subexit = state.enter('destinationLiteral')
value += tracker.move('<')
value += tracker.move(
state.safe(node.url, {before: value, after: '>', ...tracker.current()})
)
value += tracker.move('>')
} else {
// No whitespace, raw is prettier.
subexit = state.enter('destinationRaw')
value += tracker.move(
state.safe(node.url, {
before: value,
after: node.title ? ' ' : '\n',
...tracker.current()
})
)
}
subexit()
if (node.title) {
subexit = state.enter(`title${suffix}`)
value += tracker.move(' ' + quote)
value += tracker.move(
state.safe(node.title, {
before: value,
after: quote,
...tracker.current()
})
)
value += tracker.move(quote)
subexit()
}
exit()
return value
}

View File

@@ -0,0 +1,24 @@
/**
* @param {Emphasis} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function emphasis(node: Emphasis, _: Parents | undefined, state: State, info: Info): string;
export namespace emphasis {
export { emphasisPeek as peek };
}
import type { Emphasis } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @param {Emphasis} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
declare function emphasisPeek(_: Emphasis, _1: Parents | undefined, state: State): string;
export {};
//# sourceMappingURL=emphasis.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"emphasis.d.ts","sourceRoot":"","sources":["emphasis.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,+BANW,QAAQ,KACR,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA0ClB;;;;8BAxDmC,OAAO;6BAAP,OAAO;2BADb,wBAAwB;0BAAxB,wBAAwB;AA2DtD;;;;;GAKG;AACH,iCALW,QAAQ,MACR,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAIlB"}

View File

@@ -0,0 +1,69 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Emphasis, Parents} from 'mdast'
*/
import {checkEmphasis} from '../util/check-emphasis.js'
import {encodeCharacterReference} from '../util/encode-character-reference.js'
import {encodeInfo} from '../util/encode-info.js'
emphasis.peek = emphasisPeek
/**
* @param {Emphasis} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function emphasis(node, _, state, info) {
const marker = checkEmphasis(state)
const exit = state.enter('emphasis')
const tracker = state.createTracker(info)
const before = tracker.move(marker)
let between = tracker.move(
state.containerPhrasing(node, {
after: marker,
before,
...tracker.current()
})
)
const betweenHead = between.charCodeAt(0)
const open = encodeInfo(
info.before.charCodeAt(info.before.length - 1),
betweenHead,
marker
)
if (open.inside) {
between = encodeCharacterReference(betweenHead) + between.slice(1)
}
const betweenTail = between.charCodeAt(between.length - 1)
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)
if (close.inside) {
between = between.slice(0, -1) + encodeCharacterReference(betweenTail)
}
const after = tracker.move(marker)
exit()
state.attentionEncodeSurroundingInfo = {
after: close.outside,
before: open.outside
}
return before + between + after
}
/**
* @param {Emphasis} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
function emphasisPeek(_, _1, state) {
return state.options.emphasis || '*'
}

View File

@@ -0,0 +1,13 @@
/**
* @param {Heading} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function heading(node: Heading, _: Parents | undefined, state: State, info: Info): string;
import type { Heading } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=heading.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["heading.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,8BANW,OAAO,KACP,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA6DlB;6BAxEkC,OAAO;6BAAP,OAAO;2BADZ,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,75 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Heading, Parents} from 'mdast'
*/
import {encodeCharacterReference} from '../util/encode-character-reference.js'
import {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'
/**
* @param {Heading} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function heading(node, _, state, info) {
const rank = Math.max(Math.min(6, node.depth || 1), 1)
const tracker = state.createTracker(info)
if (formatHeadingAsSetext(node, state)) {
const exit = state.enter('headingSetext')
const subexit = state.enter('phrasing')
const value = state.containerPhrasing(node, {
...tracker.current(),
before: '\n',
after: '\n'
})
subexit()
exit()
return (
value +
'\n' +
(rank === 1 ? '=' : '-').repeat(
// The whole size…
value.length -
// Minus the position of the character after the last EOL (or
// 0 if there is none)…
(Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1)
)
)
}
const sequence = '#'.repeat(rank)
const exit = state.enter('headingAtx')
const subexit = state.enter('phrasing')
// Note: for proper tracking, we should reset the output positions when there
// is no content returned, because then the space is not output.
// Practically, in that case, there is no content, so it doesnt matter that
// weve tracked one too many characters.
tracker.move(sequence + ' ')
let value = state.containerPhrasing(node, {
before: '# ',
after: '\n',
...tracker.current()
})
if (/^[\t ]/.test(value)) {
// To do: what effect has the character reference on tracking?
value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1)
}
value = value ? sequence + ' ' + value : sequence
if (state.options.closeAtx) {
value += ' ' + sequence
}
subexit()
exit()
return value
}

View File

@@ -0,0 +1,15 @@
/**
* @param {Html} node
* @returns {string}
*/
export function html(node: Html): string;
export namespace html {
export { htmlPeek as peek };
}
import type { Html } from 'mdast';
/**
* @returns {string}
*/
declare function htmlPeek(): string;
export {};
//# sourceMappingURL=html.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["html.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,2BAHW,IAAI,GACF,MAAM,CAIlB;;;;0BAXsB,OAAO;AAa9B;;GAEG;AACH,6BAFa,MAAM,CAIlB"}

20
node_modules/mdast-util-to-markdown/lib/handle/html.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @import {Html} from 'mdast'
*/
html.peek = htmlPeek
/**
* @param {Html} node
* @returns {string}
*/
export function html(node) {
return node.value || ''
}
/**
* @returns {string}
*/
function htmlPeek() {
return '<'
}

View File

@@ -0,0 +1,21 @@
/**
* @param {ImageReference} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function imageReference(node: ImageReference, _: Parents | undefined, state: State, info: Info): string;
export namespace imageReference {
export { imageReferencePeek as peek };
}
import type { ImageReference } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @returns {string}
*/
declare function imageReferencePeek(): string;
export {};
//# 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":"AAOA;;;;;;GAMG;AACH,qCANW,cAAc,KACd,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA2ClB;;;;oCArDyC,OAAO;6BAAP,OAAO;2BADnB,wBAAwB;0BAAxB,wBAAwB;AAwDtD;;GAEG;AACH,uCAFa,MAAM,CAIlB"}

View File

@@ -0,0 +1,63 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {ImageReference, Parents} from 'mdast'
*/
imageReference.peek = imageReferencePeek
/**
* @param {ImageReference} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function imageReference(node, _, state, info) {
const type = node.referenceType
const exit = state.enter('imageReference')
let subexit = state.enter('label')
const tracker = state.createTracker(info)
let value = tracker.move('![')
const alt = state.safe(node.alt, {
before: value,
after: ']',
...tracker.current()
})
value += tracker.move(alt + '][')
subexit()
// Hide the fact that were in phrasing, because escapes dont work.
const stack = state.stack
state.stack = []
subexit = state.enter('reference')
// Note: for proper tracking, we should reset the output positions when we end
// up making a `shortcut` reference, because then there is no brace output.
// Practically, in that case, there is no content, so it doesnt matter that
// weve tracked one too many characters.
const reference = state.safe(state.associationId(node), {
before: value,
after: ']',
...tracker.current()
})
subexit()
state.stack = stack
exit()
if (type === 'full' || !alt || alt !== reference) {
value += tracker.move(reference + ']')
} else if (type === 'shortcut') {
// Remove the unwanted `[`.
value = value.slice(0, -1)
} else {
value += tracker.move(']')
}
return value
}
/**
* @returns {string}
*/
function imageReferencePeek() {
return '!'
}

View File

@@ -0,0 +1,21 @@
/**
* @param {Image} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function image(node: Image, _: Parents | undefined, state: State, info: Info): string;
export namespace image {
export { imagePeek as peek };
}
import type { Image } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @returns {string}
*/
declare function imagePeek(): string;
export {};
//# sourceMappingURL=image.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["image.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,4BANW,KAAK,KACL,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA4DlB;;;;2BAxEgC,OAAO;6BAAP,OAAO;2BADV,wBAAwB;0BAAxB,wBAAwB;AA2EtD;;GAEG;AACH,8BAFa,MAAM,CAIlB"}

View File

@@ -0,0 +1,82 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Image, Parents} from 'mdast'
*/
import {checkQuote} from '../util/check-quote.js'
image.peek = imagePeek
/**
* @param {Image} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function image(node, _, state, info) {
const quote = checkQuote(state)
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
const exit = state.enter('image')
let subexit = state.enter('label')
const tracker = state.createTracker(info)
let value = tracker.move('![')
value += tracker.move(
state.safe(node.alt, {before: value, after: ']', ...tracker.current()})
)
value += tracker.move('](')
subexit()
if (
// If theres no url but there is a title…
(!node.url && node.title) ||
// If there are control characters or whitespace.
/[\0- \u007F]/.test(node.url)
) {
subexit = state.enter('destinationLiteral')
value += tracker.move('<')
value += tracker.move(
state.safe(node.url, {before: value, after: '>', ...tracker.current()})
)
value += tracker.move('>')
} else {
// No whitespace, raw is prettier.
subexit = state.enter('destinationRaw')
value += tracker.move(
state.safe(node.url, {
before: value,
after: node.title ? ' ' : ')',
...tracker.current()
})
)
}
subexit()
if (node.title) {
subexit = state.enter(`title${suffix}`)
value += tracker.move(' ' + quote)
value += tracker.move(
state.safe(node.title, {
before: value,
after: quote,
...tracker.current()
})
)
value += tracker.move(quote)
subexit()
}
value += tracker.move(')')
exit()
return value
}
/**
* @returns {string}
*/
function imagePeek() {
return '!'
}

View File

@@ -0,0 +1,42 @@
export namespace handle {
export { blockquote };
export { hardBreak as break };
export { code };
export { definition };
export { emphasis };
export { hardBreak };
export { heading };
export { html };
export { image };
export { imageReference };
export { inlineCode };
export { link };
export { linkReference };
export { list };
export { listItem };
export { paragraph };
export { root };
export { strong };
export { text };
export { thematicBreak };
}
import { blockquote } from './blockquote.js';
import { hardBreak } from './break.js';
import { code } from './code.js';
import { definition } from './definition.js';
import { emphasis } from './emphasis.js';
import { heading } from './heading.js';
import { html } from './html.js';
import { image } from './image.js';
import { imageReference } from './image-reference.js';
import { inlineCode } from './inline-code.js';
import { link } from './link.js';
import { linkReference } from './link-reference.js';
import { list } from './list.js';
import { listItem } from './list-item.js';
import { paragraph } from './paragraph.js';
import { root } from './root.js';
import { strong } from './strong.js';
import { text } from './text.js';
import { thematicBreak } from './thematic-break.js';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;2BAAyB,iBAAiB;0BAClB,YAAY;qBACjB,WAAW;2BACL,iBAAiB;yBACnB,eAAe;wBAChB,cAAc;qBACjB,WAAW;sBACV,YAAY;+BACH,sBAAsB;2BAC1B,kBAAkB;qBACxB,WAAW;8BACF,qBAAqB;qBAC9B,WAAW;yBACP,gBAAgB;0BACf,gBAAgB;qBACrB,WAAW;uBACT,aAAa;qBACf,WAAW;8BACF,qBAAqB"}

View File

@@ -0,0 +1,45 @@
import {blockquote} from './blockquote.js'
import {hardBreak} from './break.js'
import {code} from './code.js'
import {definition} from './definition.js'
import {emphasis} from './emphasis.js'
import {heading} from './heading.js'
import {html} from './html.js'
import {image} from './image.js'
import {imageReference} from './image-reference.js'
import {inlineCode} from './inline-code.js'
import {link} from './link.js'
import {linkReference} from './link-reference.js'
import {list} from './list.js'
import {listItem} from './list-item.js'
import {paragraph} from './paragraph.js'
import {root} from './root.js'
import {strong} from './strong.js'
import {text} from './text.js'
import {thematicBreak} from './thematic-break.js'
/**
* Default (CommonMark) handlers.
*/
export const handle = {
blockquote,
break: hardBreak,
code,
definition,
emphasis,
hardBreak,
heading,
html,
image,
imageReference,
inlineCode,
link,
linkReference,
list,
listItem,
paragraph,
root,
strong,
text,
thematicBreak
}

View File

@@ -0,0 +1,19 @@
/**
* @param {InlineCode} node
* @param {Parents | undefined} _
* @param {State} state
* @returns {string}
*/
export function inlineCode(node: InlineCode, _: Parents | undefined, state: State): string;
export namespace inlineCode {
export { inlineCodePeek as peek };
}
import type { InlineCode } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
/**
* @returns {string}
*/
declare function inlineCodePeek(): string;
export {};
//# 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":"AAOA;;;;;GAKG;AACH,iCALW,UAAU,KACV,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAyDlB;;;;gCAlEqC,OAAO;6BAAP,OAAO;2BADrB,wBAAwB;AAqEhD;;GAEG;AACH,mCAFa,MAAM,CAIlB"}

View File

@@ -0,0 +1,76 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {InlineCode, Parents} from 'mdast'
*/
inlineCode.peek = inlineCodePeek
/**
* @param {InlineCode} node
* @param {Parents | undefined} _
* @param {State} state
* @returns {string}
*/
export function inlineCode(node, _, state) {
let value = node.value || ''
let sequence = '`'
let index = -1
// If there is a single grave accent on its own in the code, use a fence of
// two.
// If there are two in a row, use one.
while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {
sequence += '`'
}
// If this is not just spaces or eols (tabs dont count), and either the
// first or last character are a space, eol, or tick, then pad with spaces.
if (
/[^ \r\n]/.test(value) &&
((/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value)) || /^`|`$/.test(value))
) {
value = ' ' + value + ' '
}
// We have a potential problem: certain characters after eols could result in
// blocks being seen.
// For example, if someone injected the string `'\n# b'`, then that would
// result in an ATX heading.
// We cant escape characters in `inlineCode`, but because eols are
// transformed to spaces when going from markdown to HTML anyway, we can swap
// them out.
while (++index < state.unsafe.length) {
const pattern = state.unsafe[index]
const expression = state.compilePattern(pattern)
/** @type {RegExpExecArray | null} */
let match
// Only look for `atBreak`s.
// Btw: note that `atBreak` patterns will always start the regex at LF or
// CR.
if (!pattern.atBreak) continue
while ((match = expression.exec(value))) {
let position = match.index
// Support CRLF (patterns only look for one of the characters).
if (
value.charCodeAt(position) === 10 /* `\n` */ &&
value.charCodeAt(position - 1) === 13 /* `\r` */
) {
position--
}
value = value.slice(0, position) + ' ' + value.slice(match.index + 1)
}
}
return sequence + value + sequence
}
/**
* @returns {string}
*/
function inlineCodePeek() {
return '`'
}

View File

@@ -0,0 +1,21 @@
/**
* @param {LinkReference} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function linkReference(node: LinkReference, _: Parents | undefined, state: State, info: Info): string;
export namespace linkReference {
export { linkReferencePeek as peek };
}
import type { LinkReference } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @returns {string}
*/
declare function linkReferencePeek(): string;
export {};
//# 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":"AAOA;;;;;;GAMG;AACH,oCANW,aAAa,KACb,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA2ClB;;;;mCArDwC,OAAO;6BAAP,OAAO;2BADlB,wBAAwB;0BAAxB,wBAAwB;AAwDtD;;GAEG;AACH,sCAFa,MAAM,CAIlB"}

View File

@@ -0,0 +1,63 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {LinkReference, Parents} from 'mdast'
*/
linkReference.peek = linkReferencePeek
/**
* @param {LinkReference} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function linkReference(node, _, state, info) {
const type = node.referenceType
const exit = state.enter('linkReference')
let subexit = state.enter('label')
const tracker = state.createTracker(info)
let value = tracker.move('[')
const text = state.containerPhrasing(node, {
before: value,
after: ']',
...tracker.current()
})
value += tracker.move(text + '][')
subexit()
// Hide the fact that were in phrasing, because escapes dont work.
const stack = state.stack
state.stack = []
subexit = state.enter('reference')
// Note: for proper tracking, we should reset the output positions when we end
// up making a `shortcut` reference, because then there is no brace output.
// Practically, in that case, there is no content, so it doesnt matter that
// weve tracked one too many characters.
const reference = state.safe(state.associationId(node), {
before: value,
after: ']',
...tracker.current()
})
subexit()
state.stack = stack
exit()
if (type === 'full' || !text || text !== reference) {
value += tracker.move(reference + ']')
} else if (type === 'shortcut') {
// Remove the unwanted `[`.
value = value.slice(0, -1)
} else {
value += tracker.move(']')
}
return value
}
/**
* @returns {string}
*/
function linkReferencePeek() {
return '['
}

View File

@@ -0,0 +1,24 @@
/**
* @param {Link} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function link(node: Link, _: Parents | undefined, state: State, info: Info): string;
export namespace link {
export { linkPeek as peek };
}
import type { Link } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @param {Link} node
* @param {Parents | undefined} _
* @param {State} state
* @returns {string}
*/
declare function linkPeek(node: Link, _: Parents | undefined, state: State): string;
export {};
//# sourceMappingURL=link.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAuFlB;;;;0BArG+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB;AAwGtD;;;;;GAKG;AACH,gCALW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAIlB"}

114
node_modules/mdast-util-to-markdown/lib/handle/link.js generated vendored Normal file
View File

@@ -0,0 +1,114 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Link, Parents} from 'mdast'
* @import {Exit} from '../types.js'
*/
import {checkQuote} from '../util/check-quote.js'
import {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'
link.peek = linkPeek
/**
* @param {Link} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function link(node, _, state, info) {
const quote = checkQuote(state)
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
const tracker = state.createTracker(info)
/** @type {Exit} */
let exit
/** @type {Exit} */
let subexit
if (formatLinkAsAutolink(node, state)) {
// Hide the fact that were in phrasing, because escapes dont work.
const stack = state.stack
state.stack = []
exit = state.enter('autolink')
let value = tracker.move('<')
value += tracker.move(
state.containerPhrasing(node, {
before: value,
after: '>',
...tracker.current()
})
)
value += tracker.move('>')
exit()
state.stack = stack
return value
}
exit = state.enter('link')
subexit = state.enter('label')
let value = tracker.move('[')
value += tracker.move(
state.containerPhrasing(node, {
before: value,
after: '](',
...tracker.current()
})
)
value += tracker.move('](')
subexit()
if (
// If theres no url but there is a title…
(!node.url && node.title) ||
// If there are control characters or whitespace.
/[\0- \u007F]/.test(node.url)
) {
subexit = state.enter('destinationLiteral')
value += tracker.move('<')
value += tracker.move(
state.safe(node.url, {before: value, after: '>', ...tracker.current()})
)
value += tracker.move('>')
} else {
// No whitespace, raw is prettier.
subexit = state.enter('destinationRaw')
value += tracker.move(
state.safe(node.url, {
before: value,
after: node.title ? ' ' : ')',
...tracker.current()
})
)
}
subexit()
if (node.title) {
subexit = state.enter(`title${suffix}`)
value += tracker.move(' ' + quote)
value += tracker.move(
state.safe(node.title, {
before: value,
after: quote,
...tracker.current()
})
)
value += tracker.move(quote)
subexit()
}
value += tracker.move(')')
exit()
return value
}
/**
* @param {Link} node
* @param {Parents | undefined} _
* @param {State} state
* @returns {string}
*/
function linkPeek(node, _, state) {
return formatLinkAsAutolink(node, state) ? '<' : '['
}

View File

@@ -0,0 +1,13 @@
/**
* @param {ListItem} node
* @param {Parents | undefined} parent
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function listItem(node: ListItem, parent: Parents | undefined, state: State, info: Info): string;
import type { ListItem } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# 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":"AAQA;;;;;;GAMG;AACH,+BANW,QAAQ,UACR,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAgDlB;8BA3DmC,OAAO;6BAAP,OAAO;2BADR,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,62 @@
/**
* @import {Info, Map, State} from 'mdast-util-to-markdown'
* @import {ListItem, Parents} from 'mdast'
*/
import {checkBullet} from '../util/check-bullet.js'
import {checkListItemIndent} from '../util/check-list-item-indent.js'
/**
* @param {ListItem} node
* @param {Parents | undefined} parent
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function listItem(node, parent, state, info) {
const listItemIndent = checkListItemIndent(state)
let bullet = state.bulletCurrent || checkBullet(state)
// Add the marker value for ordered lists.
if (parent && parent.type === 'list' && parent.ordered) {
bullet =
(typeof parent.start === 'number' && parent.start > -1
? parent.start
: 1) +
(state.options.incrementListMarker === false
? 0
: parent.children.indexOf(node)) +
bullet
}
let size = bullet.length + 1
if (
listItemIndent === 'tab' ||
(listItemIndent === 'mixed' &&
((parent && parent.type === 'list' && parent.spread) || node.spread))
) {
size = Math.ceil(size / 4) * 4
}
const tracker = state.createTracker(info)
tracker.move(bullet + ' '.repeat(size - bullet.length))
tracker.shift(size)
const exit = state.enter('listItem')
const value = state.indentLines(
state.containerFlow(node, tracker.current()),
map
)
exit()
return value
/** @type {Map} */
function map(line, index, blank) {
if (index) {
return (blank ? '' : ' '.repeat(size)) + line
}
return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line
}
}

View File

@@ -0,0 +1,13 @@
/**
* @param {List} node
* @param {Parents | undefined} parent
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function list(node: List, parent: Parents | undefined, state: State, info: Info): string;
import type { List } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=list.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,2BANW,IAAI,UACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAoFlB;0BAjG+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}

100
node_modules/mdast-util-to-markdown/lib/handle/list.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {List, Parents} from 'mdast'
*/
import {checkBullet} from '../util/check-bullet.js'
import {checkBulletOther} from '../util/check-bullet-other.js'
import {checkBulletOrdered} from '../util/check-bullet-ordered.js'
import {checkRule} from '../util/check-rule.js'
/**
* @param {List} node
* @param {Parents | undefined} parent
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function list(node, parent, state, info) {
const exit = state.enter('list')
const bulletCurrent = state.bulletCurrent
/** @type {string} */
let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state)
/** @type {string} */
const bulletOther = node.ordered
? bullet === '.'
? ')'
: '.'
: checkBulletOther(state)
let useDifferentMarker =
parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false
if (!node.ordered) {
const firstListItem = node.children ? node.children[0] : undefined
// If theres an empty first list item directly in two list items,
// we have to use a different bullet:
//
// ```markdown
// * - *
// ```
//
// …because otherwise it would become one big thematic break.
if (
// Bullet could be used as a thematic break marker:
(bullet === '*' || bullet === '-') &&
// Empty first list item:
firstListItem &&
(!firstListItem.children || !firstListItem.children[0]) &&
// Directly in two other list items:
state.stack[state.stack.length - 1] === 'list' &&
state.stack[state.stack.length - 2] === 'listItem' &&
state.stack[state.stack.length - 3] === 'list' &&
state.stack[state.stack.length - 4] === 'listItem' &&
// That are each the first child.
state.indexStack[state.indexStack.length - 1] === 0 &&
state.indexStack[state.indexStack.length - 2] === 0 &&
state.indexStack[state.indexStack.length - 3] === 0
) {
useDifferentMarker = true
}
// If theres a thematic break at the start of the first list item,
// we have to use a different bullet:
//
// ```markdown
// * ---
// ```
//
// …because otherwise it would become one big thematic break.
if (checkRule(state) === bullet && firstListItem) {
let index = -1
while (++index < node.children.length) {
const item = node.children[index]
if (
item &&
item.type === 'listItem' &&
item.children &&
item.children[0] &&
item.children[0].type === 'thematicBreak'
) {
useDifferentMarker = true
break
}
}
}
}
if (useDifferentMarker) {
bullet = bulletOther
}
state.bulletCurrent = bullet
const value = state.containerFlow(node, info)
state.bulletLastUsed = bullet
state.bulletCurrent = bulletCurrent
exit()
return value
}

View File

@@ -0,0 +1,17 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Paragraph, Parents} from 'mdast'
*/
/**
* @param {Paragraph} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function paragraph(node: Paragraph, _: Parents | undefined, state: State, info: Info): string;
import type { Paragraph } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=paragraph.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["paragraph.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,gCANW,SAAS,KACT,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CASlB;+BAjBoC,OAAO;6BAAP,OAAO;2BADd,wBAAwB;0BAAxB,wBAAwB"}

View File

@@ -0,0 +1,20 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Paragraph, Parents} from 'mdast'
*/
/**
* @param {Paragraph} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function paragraph(node, _, state, info) {
const exit = state.enter('paragraph')
const subexit = state.enter('phrasing')
const value = state.containerPhrasing(node, info)
subexit()
exit()
return value
}

View File

@@ -0,0 +1,13 @@
/**
* @param {Root} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function root(node: Root, _: Parents | undefined, state: State, info: Info): string;
import type { Root } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=root.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["root.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAUlB;0BApB+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}

23
node_modules/mdast-util-to-markdown/lib/handle/root.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Parents, Root} from 'mdast'
*/
import {phrasing} from 'mdast-util-phrasing'
/**
* @param {Root} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function root(node, _, state, info) {
// Note: `html` nodes are ambiguous.
const hasPhrasing = node.children.some(function (d) {
return phrasing(d)
})
const container = hasPhrasing ? state.containerPhrasing : state.containerFlow
return container.call(state, node, info)
}

View File

@@ -0,0 +1,24 @@
/**
* @param {Strong} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function strong(node: Strong, _: Parents | undefined, state: State, info: Info): string;
export namespace strong {
export { strongPeek as peek };
}
import type { Strong } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
/**
* @param {Strong} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
declare function strongPeek(_: Strong, _1: Parents | undefined, state: State): string;
export {};
//# sourceMappingURL=strong.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["strong.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,6BANW,MAAM,KACN,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA0ClB;;;;4BAxDiC,OAAO;6BAAP,OAAO;2BADX,wBAAwB;0BAAxB,wBAAwB;AA2DtD;;;;;GAKG;AACH,+BALW,MAAM,MACN,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAIlB"}

View File

@@ -0,0 +1,69 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Parents, Strong} from 'mdast'
*/
import {checkStrong} from '../util/check-strong.js'
import {encodeCharacterReference} from '../util/encode-character-reference.js'
import {encodeInfo} from '../util/encode-info.js'
strong.peek = strongPeek
/**
* @param {Strong} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function strong(node, _, state, info) {
const marker = checkStrong(state)
const exit = state.enter('strong')
const tracker = state.createTracker(info)
const before = tracker.move(marker + marker)
let between = tracker.move(
state.containerPhrasing(node, {
after: marker,
before,
...tracker.current()
})
)
const betweenHead = between.charCodeAt(0)
const open = encodeInfo(
info.before.charCodeAt(info.before.length - 1),
betweenHead,
marker
)
if (open.inside) {
between = encodeCharacterReference(betweenHead) + between.slice(1)
}
const betweenTail = between.charCodeAt(between.length - 1)
const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)
if (close.inside) {
between = between.slice(0, -1) + encodeCharacterReference(betweenTail)
}
const after = tracker.move(marker + marker)
exit()
state.attentionEncodeSurroundingInfo = {
after: close.outside,
before: open.outside
}
return before + between + after
}
/**
* @param {Strong} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
function strongPeek(_, _1, state) {
return state.options.strong || '*'
}

View File

@@ -0,0 +1,17 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Parents, Text} from 'mdast'
*/
/**
* @param {Text} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function text(node: Text, _: Parents | undefined, state: State, info: Info): string;
import type { Text } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
import type { Info } from 'mdast-util-to-markdown';
//# sourceMappingURL=text.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,2BANW,IAAI,KACJ,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAIlB;0BAZ+B,OAAO;6BAAP,OAAO;2BADT,wBAAwB;0BAAxB,wBAAwB"}

15
node_modules/mdast-util-to-markdown/lib/handle/text.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Parents, Text} from 'mdast'
*/
/**
* @param {Text} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function text(node, _, state, info) {
return state.safe(node.value, info)
}

View File

@@ -0,0 +1,11 @@
/**
* @param {ThematicBreak} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
export function thematicBreak(_: ThematicBreak, _1: Parents | undefined, state: State): string;
import type { ThematicBreak } from 'mdast';
import type { Parents } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
//# 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":"AAQA;;;;;GAKG;AACH,iCALW,aAAa,MACb,OAAO,GAAG,SAAS,SACnB,KAAK,GACH,MAAM,CAQlB;mCAlBwC,OAAO;6BAAP,OAAO;2BADxB,wBAAwB"}

View File

@@ -0,0 +1,21 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {Parents, ThematicBreak} from 'mdast'
*/
import {checkRuleRepetition} from '../util/check-rule-repetition.js'
import {checkRule} from '../util/check-rule.js'
/**
* @param {ThematicBreak} _
* @param {Parents | undefined} _1
* @param {State} state
* @returns {string}
*/
export function thematicBreak(_, _1, state) {
const value = (
checkRule(state) + (state.options.ruleSpaces ? ' ' : '')
).repeat(checkRuleRepetition(state))
return state.options.ruleSpaces ? value.slice(0, -1) : value
}