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:
9
node_modules/mdast-util-to-markdown/lib/configure.d.ts
generated
vendored
Normal file
9
node_modules/mdast-util-to-markdown/lib/configure.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @param {State} base
|
||||
* @param {Options} extension
|
||||
* @returns {State}
|
||||
*/
|
||||
export function configure(base: State, extension: Options): State;
|
||||
import type { State } from './types.js';
|
||||
import type { Options } from './types.js';
|
||||
//# sourceMappingURL=configure.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/configure.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/configure.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["configure.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,gCAJW,KAAK,aACL,OAAO,GACL,KAAK,CA+CjB;2BAvDgC,YAAY;6BAAZ,YAAY"}
|
79
node_modules/mdast-util-to-markdown/lib/configure.js
generated
vendored
Normal file
79
node_modules/mdast-util-to-markdown/lib/configure.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @import {Options, State} from './types.js'
|
||||
*/
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
/**
|
||||
* @param {State} base
|
||||
* @param {Options} extension
|
||||
* @returns {State}
|
||||
*/
|
||||
export function configure(base, extension) {
|
||||
let index = -1
|
||||
/** @type {keyof Options} */
|
||||
let key
|
||||
|
||||
// First do subextensions.
|
||||
if (extension.extensions) {
|
||||
while (++index < extension.extensions.length) {
|
||||
configure(base, extension.extensions[index])
|
||||
}
|
||||
}
|
||||
|
||||
for (key in extension) {
|
||||
if (own.call(extension, key)) {
|
||||
switch (key) {
|
||||
case 'extensions': {
|
||||
// Empty.
|
||||
break
|
||||
}
|
||||
|
||||
/* c8 ignore next 4 */
|
||||
case 'unsafe': {
|
||||
list(base[key], extension[key])
|
||||
break
|
||||
}
|
||||
|
||||
case 'join': {
|
||||
list(base[key], extension[key])
|
||||
break
|
||||
}
|
||||
|
||||
case 'handlers': {
|
||||
map(base[key], extension[key])
|
||||
break
|
||||
}
|
||||
|
||||
default: {
|
||||
// @ts-expect-error: matches.
|
||||
base.options[key] = extension[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return base
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Array<T>} left
|
||||
* @param {Array<T> | null | undefined} right
|
||||
*/
|
||||
function list(left, right) {
|
||||
if (right) {
|
||||
left.push(...right)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {Record<string, T>} left
|
||||
* @param {Record<string, T> | null | undefined} right
|
||||
*/
|
||||
function map(left, right) {
|
||||
if (right) {
|
||||
Object.assign(left, right)
|
||||
}
|
||||
}
|
17
node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts
generated
vendored
Normal file
17
node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map
generated
vendored
Normal 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"}
|
29
node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
generated
vendored
Normal file
29
node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
generated
vendored
Normal 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
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/break.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/break.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map
generated
vendored
Normal 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"}
|
30
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal file
30
node_modules/mdast-util-to-markdown/lib/handle/break.js
generated
vendored
Normal 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 can’t 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'
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/code.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/code.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map
generated
vendored
Normal 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
75
node_modules/mdast-util-to-markdown/lib/handle/code.js
generated
vendored
Normal 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
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map
generated
vendored
Normal 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"}
|
76
node_modules/mdast-util-to-markdown/lib/handle/definition.js
generated
vendored
Normal file
76
node_modules/mdast-util-to-markdown/lib/handle/definition.js
generated
vendored
Normal 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 there’s 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
|
||||
}
|
24
node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts
generated
vendored
Normal file
24
node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map
generated
vendored
Normal 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"}
|
69
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal file
69
node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
generated
vendored
Normal 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 || '*'
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map
generated
vendored
Normal 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"}
|
75
node_modules/mdast-util-to-markdown/lib/handle/heading.js
generated
vendored
Normal file
75
node_modules/mdast-util-to-markdown/lib/handle/heading.js
generated
vendored
Normal 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 doesn’t matter that
|
||||
// we’ve 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
|
||||
}
|
15
node_modules/mdast-util-to-markdown/lib/handle/html.d.ts
generated
vendored
Normal file
15
node_modules/mdast-util-to-markdown/lib/handle/html.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map
generated
vendored
Normal 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
20
node_modules/mdast-util-to-markdown/lib/handle/html.js
generated
vendored
Normal 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 '<'
|
||||
}
|
21
node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map
generated
vendored
Normal 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"}
|
63
node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
generated
vendored
Normal file
63
node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
generated
vendored
Normal 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 we’re in phrasing, because escapes don’t 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 doesn’t matter that
|
||||
// we’ve 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 '!'
|
||||
}
|
21
node_modules/mdast-util-to-markdown/lib/handle/image.d.ts
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/image.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map
generated
vendored
Normal 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"}
|
82
node_modules/mdast-util-to-markdown/lib/handle/image.js
generated
vendored
Normal file
82
node_modules/mdast-util-to-markdown/lib/handle/image.js
generated
vendored
Normal 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 there’s 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 '!'
|
||||
}
|
42
node_modules/mdast-util-to-markdown/lib/handle/index.d.ts
generated
vendored
Normal file
42
node_modules/mdast-util-to-markdown/lib/handle/index.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/index.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/index.d.ts.map
generated
vendored
Normal 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"}
|
45
node_modules/mdast-util-to-markdown/lib/handle/index.js
generated
vendored
Normal file
45
node_modules/mdast-util-to-markdown/lib/handle/index.js
generated
vendored
Normal 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
|
||||
}
|
19
node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts
generated
vendored
Normal file
19
node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map
generated
vendored
Normal 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"}
|
76
node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
generated
vendored
Normal file
76
node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
generated
vendored
Normal 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 don’t 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 can’t 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 '`'
|
||||
}
|
21
node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map
generated
vendored
Normal 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"}
|
63
node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
generated
vendored
Normal file
63
node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
generated
vendored
Normal 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 we’re in phrasing, because escapes don’t 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 doesn’t matter that
|
||||
// we’ve 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 '['
|
||||
}
|
24
node_modules/mdast-util-to-markdown/lib/handle/link.d.ts
generated
vendored
Normal file
24
node_modules/mdast-util-to-markdown/lib/handle/link.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map
generated
vendored
Normal 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
114
node_modules/mdast-util-to-markdown/lib/handle/link.js
generated
vendored
Normal 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 we’re in phrasing, because escapes don’t 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 there’s 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) ? '<' : '['
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map
generated
vendored
Normal 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"}
|
62
node_modules/mdast-util-to-markdown/lib/handle/list-item.js
generated
vendored
Normal file
62
node_modules/mdast-util-to-markdown/lib/handle/list-item.js
generated
vendored
Normal 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
|
||||
}
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/list.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/list.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map
generated
vendored
Normal 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
100
node_modules/mdast-util-to-markdown/lib/handle/list.js
generated
vendored
Normal 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 there’s 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 there’s 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
|
||||
}
|
17
node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts
generated
vendored
Normal file
17
node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map
generated
vendored
Normal 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"}
|
20
node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
generated
vendored
Normal file
20
node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
generated
vendored
Normal 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
|
||||
}
|
13
node_modules/mdast-util-to-markdown/lib/handle/root.d.ts
generated
vendored
Normal file
13
node_modules/mdast-util-to-markdown/lib/handle/root.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map
generated
vendored
Normal 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
23
node_modules/mdast-util-to-markdown/lib/handle/root.js
generated
vendored
Normal 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)
|
||||
}
|
24
node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts
generated
vendored
Normal file
24
node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map
generated
vendored
Normal 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"}
|
69
node_modules/mdast-util-to-markdown/lib/handle/strong.js
generated
vendored
Normal file
69
node_modules/mdast-util-to-markdown/lib/handle/strong.js
generated
vendored
Normal 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 || '*'
|
||||
}
|
17
node_modules/mdast-util-to-markdown/lib/handle/text.d.ts
generated
vendored
Normal file
17
node_modules/mdast-util-to-markdown/lib/handle/text.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map
generated
vendored
Normal 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
15
node_modules/mdast-util-to-markdown/lib/handle/text.js
generated
vendored
Normal 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)
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts
generated
vendored
Normal 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
|
1
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map
generated
vendored
Normal 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"}
|
21
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
generated
vendored
Normal 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
|
||||
}
|
14
node_modules/mdast-util-to-markdown/lib/index.d.ts
generated
vendored
Normal file
14
node_modules/mdast-util-to-markdown/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Turn an mdast syntax tree into markdown.
|
||||
*
|
||||
* @param {Nodes} tree
|
||||
* Tree to serialize.
|
||||
* @param {Options | null | undefined} [options]
|
||||
* Configuration (optional).
|
||||
* @returns {string}
|
||||
* Serialized markdown representing `tree`.
|
||||
*/
|
||||
export function toMarkdown(tree: Nodes, options?: Options | null | undefined): string;
|
||||
import type { Nodes } from 'mdast';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAmBA;;;;;;;;;GASG;AACH,iCAPW,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAoElB;2BA5FuB,OAAO;6BAD0B,wBAAwB"}
|
187
node_modules/mdast-util-to-markdown/lib/index.js
generated
vendored
Normal file
187
node_modules/mdast-util-to-markdown/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* @import {Info, Join, Options, SafeConfig, State} from 'mdast-util-to-markdown'
|
||||
* @import {Nodes} from 'mdast'
|
||||
* @import {Enter, FlowParents, PhrasingParents, TrackFields} from './types.js'
|
||||
*/
|
||||
|
||||
import {zwitch} from 'zwitch'
|
||||
import {configure} from './configure.js'
|
||||
import {handle as handlers} from './handle/index.js'
|
||||
import {join} from './join.js'
|
||||
import {unsafe} from './unsafe.js'
|
||||
import {association} from './util/association.js'
|
||||
import {compilePattern} from './util/compile-pattern.js'
|
||||
import {containerPhrasing} from './util/container-phrasing.js'
|
||||
import {containerFlow} from './util/container-flow.js'
|
||||
import {indentLines} from './util/indent-lines.js'
|
||||
import {safe} from './util/safe.js'
|
||||
import {track} from './util/track.js'
|
||||
|
||||
/**
|
||||
* Turn an mdast syntax tree into markdown.
|
||||
*
|
||||
* @param {Nodes} tree
|
||||
* Tree to serialize.
|
||||
* @param {Options | null | undefined} [options]
|
||||
* Configuration (optional).
|
||||
* @returns {string}
|
||||
* Serialized markdown representing `tree`.
|
||||
*/
|
||||
export function toMarkdown(tree, options) {
|
||||
const settings = options || {}
|
||||
/** @type {State} */
|
||||
const state = {
|
||||
associationId: association,
|
||||
containerPhrasing: containerPhrasingBound,
|
||||
containerFlow: containerFlowBound,
|
||||
createTracker: track,
|
||||
compilePattern,
|
||||
enter,
|
||||
// @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined
|
||||
// here.
|
||||
handlers: {...handlers},
|
||||
// @ts-expect-error: add `handle` in a second.
|
||||
handle: undefined,
|
||||
indentLines,
|
||||
indexStack: [],
|
||||
join: [...join],
|
||||
options: {},
|
||||
safe: safeBound,
|
||||
stack: [],
|
||||
unsafe: [...unsafe]
|
||||
}
|
||||
|
||||
configure(state, settings)
|
||||
|
||||
if (state.options.tightDefinitions) {
|
||||
state.join.push(joinDefinition)
|
||||
}
|
||||
|
||||
state.handle = zwitch('type', {
|
||||
invalid,
|
||||
unknown,
|
||||
handlers: state.handlers
|
||||
})
|
||||
|
||||
let result = state.handle(tree, undefined, state, {
|
||||
before: '\n',
|
||||
after: '\n',
|
||||
now: {line: 1, column: 1},
|
||||
lineShift: 0
|
||||
})
|
||||
|
||||
if (
|
||||
result &&
|
||||
result.charCodeAt(result.length - 1) !== 10 &&
|
||||
result.charCodeAt(result.length - 1) !== 13
|
||||
) {
|
||||
result += '\n'
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
/** @type {Enter} */
|
||||
function enter(name) {
|
||||
state.stack.push(name)
|
||||
return exit
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function exit() {
|
||||
state.stack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {unknown} value
|
||||
* @returns {never}
|
||||
*/
|
||||
function invalid(value) {
|
||||
throw new Error('Cannot handle value `' + value + '`, expected node')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {unknown} value
|
||||
* @returns {never}
|
||||
*/
|
||||
function unknown(value) {
|
||||
// Always a node.
|
||||
const node = /** @type {Nodes} */ (value)
|
||||
throw new Error('Cannot handle unknown node `' + node.type + '`')
|
||||
}
|
||||
|
||||
/** @type {Join} */
|
||||
function joinDefinition(left, right) {
|
||||
// No blank line between adjacent definitions.
|
||||
if (left.type === 'definition' && left.type === right.type) {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the children of a parent that contains phrasing children.
|
||||
*
|
||||
* These children will be joined flush together.
|
||||
*
|
||||
* @this {State}
|
||||
* Info passed around about the current state.
|
||||
* @param {PhrasingParents} parent
|
||||
* Parent of flow nodes.
|
||||
* @param {Info} info
|
||||
* Info on where we are in the document we are generating.
|
||||
* @returns {string}
|
||||
* Serialized children, joined together.
|
||||
*/
|
||||
function containerPhrasingBound(parent, info) {
|
||||
return containerPhrasing(parent, this, info)
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the children of a parent that contains flow children.
|
||||
*
|
||||
* These children will typically be joined by blank lines.
|
||||
* What they are joined by exactly is defined by `Join` functions.
|
||||
*
|
||||
* @this {State}
|
||||
* Info passed around about the current state.
|
||||
* @param {FlowParents} parent
|
||||
* Parent of flow nodes.
|
||||
* @param {TrackFields} info
|
||||
* Info on where we are in the document we are generating.
|
||||
* @returns {string}
|
||||
* Serialized children, joined by (blank) lines.
|
||||
*/
|
||||
function containerFlowBound(parent, info) {
|
||||
return containerFlow(parent, this, info)
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a string safe for embedding in markdown constructs.
|
||||
*
|
||||
* In markdown, almost all punctuation characters can, in certain cases,
|
||||
* result in something.
|
||||
* Whether they do is highly subjective to where they happen and in what
|
||||
* they happen.
|
||||
*
|
||||
* To solve this, `mdast-util-to-markdown` tracks:
|
||||
*
|
||||
* * Characters before and after something;
|
||||
* * What “constructs” we are in.
|
||||
*
|
||||
* This information is then used by this function to escape or encode
|
||||
* special characters.
|
||||
*
|
||||
* @this {State}
|
||||
* Info passed around about the current state.
|
||||
* @param {string | null | undefined} value
|
||||
* Raw value to make safe.
|
||||
* @param {SafeConfig} config
|
||||
* Configuration.
|
||||
* @returns {string}
|
||||
* Serialized markdown safe for embedding.
|
||||
*/
|
||||
function safeBound(value, config) {
|
||||
return safe(this, value, config)
|
||||
}
|
4
node_modules/mdast-util-to-markdown/lib/join.d.ts
generated
vendored
Normal file
4
node_modules/mdast-util-to-markdown/lib/join.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/** @type {Array<Join>} */
|
||||
export const join: Array<Join>;
|
||||
import type { Join } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=join.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/join.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/join.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["join.js"],"names":[],"mappings":"AAOA,0BAA0B;AAC1B,mBADW,KAAK,CAAC,IAAI,CAAC,CACY;0BAPX,wBAAwB"}
|
39
node_modules/mdast-util-to-markdown/lib/join.js
generated
vendored
Normal file
39
node_modules/mdast-util-to-markdown/lib/join.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @import {Join} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
import {formatCodeAsIndented} from './util/format-code-as-indented.js'
|
||||
import {formatHeadingAsSetext} from './util/format-heading-as-setext.js'
|
||||
|
||||
/** @type {Array<Join>} */
|
||||
export const join = [joinDefaults]
|
||||
|
||||
/** @type {Join} */
|
||||
function joinDefaults(left, right, parent, state) {
|
||||
// Indented code after list or another indented code.
|
||||
if (
|
||||
right.type === 'code' &&
|
||||
formatCodeAsIndented(right, state) &&
|
||||
(left.type === 'list' ||
|
||||
(left.type === right.type && formatCodeAsIndented(left, state)))
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Join children of a list or an item.
|
||||
// In which case, `parent` has a `spread` field.
|
||||
if ('spread' in parent && typeof parent.spread === 'boolean') {
|
||||
if (
|
||||
left.type === 'paragraph' &&
|
||||
// Two paragraphs.
|
||||
(left.type === right.type ||
|
||||
right.type === 'definition' ||
|
||||
// Paragraph followed by a setext heading.
|
||||
(right.type === 'heading' && formatHeadingAsSetext(right, state)))
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
return parent.spread ? 1 : 0
|
||||
}
|
||||
}
|
965
node_modules/mdast-util-to-markdown/lib/types.d.ts
generated
vendored
Normal file
965
node_modules/mdast-util-to-markdown/lib/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,965 @@
|
||||
import type {
|
||||
Parents,
|
||||
PhrasingContent,
|
||||
TableCell,
|
||||
TableRow,
|
||||
Association,
|
||||
Nodes
|
||||
} from 'mdast'
|
||||
import type {Point} from 'unist'
|
||||
|
||||
/**
|
||||
* Get an identifier from an association to match it to others.
|
||||
*
|
||||
* Associations are nodes that match to something else through an ID:
|
||||
* <https://github.com/syntax-tree/mdast#association>.
|
||||
*
|
||||
* The `label` of an association is the string value: character escapes and
|
||||
* references work, and casing is intact.
|
||||
* The `identifier` is used to match one association to another:
|
||||
* controversially, character escapes and references don’t work in this
|
||||
* matching: `©` does not match `©`, and `\+` does not match `+`.
|
||||
*
|
||||
* But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb`
|
||||
* matches `a b`.
|
||||
* So, we do prefer the label when figuring out how we’re going to serialize:
|
||||
* it has whitespace, casing, and we can ignore most useless character
|
||||
* escapes and all character references.
|
||||
*
|
||||
* @param node
|
||||
* Node that includes an association.
|
||||
* @returns
|
||||
* ID.
|
||||
*/
|
||||
export type AssociationId = (node: Association) => string
|
||||
|
||||
/**
|
||||
* Compile an unsafe pattern to a regex.
|
||||
*
|
||||
* @param info
|
||||
* Pattern.
|
||||
* @returns
|
||||
* Regex.
|
||||
*/
|
||||
export type CompilePattern = (info: Unsafe) => RegExp
|
||||
|
||||
/**
|
||||
* Interface of registered constructs.
|
||||
*
|
||||
* When working on extensions that use new constructs, extend the corresponding
|
||||
* interface to register its name:
|
||||
*
|
||||
* ```ts
|
||||
* declare module 'mdast-util-to-markdown' {
|
||||
* interface ConstructNameMap {
|
||||
* // Register a new construct name (value is used, key should match it).
|
||||
* gfmStrikethrough: 'gfmStrikethrough'
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export interface ConstructNameMap {
|
||||
/**
|
||||
* Whole autolink.
|
||||
*
|
||||
* ```markdown
|
||||
* > | <https://example.com> and <admin@example.com>
|
||||
* ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
|
||||
* ```
|
||||
*/
|
||||
autolink: 'autolink'
|
||||
/**
|
||||
* Whole block quote.
|
||||
*
|
||||
* ```markdown
|
||||
* > | > a
|
||||
* ^^^
|
||||
* > | b
|
||||
* ^
|
||||
* ```
|
||||
*/
|
||||
blockquote: 'blockquote'
|
||||
/**
|
||||
* Whole code (indented).
|
||||
*
|
||||
* ```markdown
|
||||
* ␠␠␠␠console.log(1)
|
||||
* ^^^^^^^^^^^^^^^^^^
|
||||
* ```
|
||||
*/
|
||||
codeIndented: 'codeIndented'
|
||||
/**
|
||||
* Whole code (fenced).
|
||||
*
|
||||
* ````markdown
|
||||
* > | ```js
|
||||
* ^^^^^
|
||||
* > | console.log(1)
|
||||
* ^^^^^^^^^^^^^^
|
||||
* > | ```
|
||||
* ^^^
|
||||
* ````
|
||||
*/
|
||||
codeFenced: 'codeFenced'
|
||||
/**
|
||||
* Code (fenced) language, when fenced with grave accents.
|
||||
*
|
||||
* ````markdown
|
||||
* > | ```js
|
||||
* ^^
|
||||
* | console.log(1)
|
||||
* | ```
|
||||
* ````
|
||||
*/
|
||||
codeFencedLangGraveAccent: 'codeFencedLangGraveAccent'
|
||||
/**
|
||||
* Code (fenced) language, when fenced with tildes.
|
||||
*
|
||||
* ````markdown
|
||||
* > | ~~~js
|
||||
* ^^
|
||||
* | console.log(1)
|
||||
* | ~~~
|
||||
* ````
|
||||
*/
|
||||
codeFencedLangTilde: 'codeFencedLangTilde'
|
||||
/**
|
||||
* Code (fenced) meta string, when fenced with grave accents.
|
||||
*
|
||||
* ````markdown
|
||||
* > | ```js eval
|
||||
* ^^^^
|
||||
* | console.log(1)
|
||||
* | ```
|
||||
* ````
|
||||
*/
|
||||
codeFencedMetaGraveAccent: 'codeFencedMetaGraveAccent'
|
||||
/**
|
||||
* Code (fenced) meta string, when fenced with tildes.
|
||||
*
|
||||
* ````markdown
|
||||
* > | ~~~js eval
|
||||
* ^^^^
|
||||
* | console.log(1)
|
||||
* | ~~~
|
||||
* ````
|
||||
*/
|
||||
codeFencedMetaTilde: 'codeFencedMetaTilde'
|
||||
/**
|
||||
* Whole definition.
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a]: b "c"
|
||||
* ^^^^^^^^^^
|
||||
* ```
|
||||
*/
|
||||
definition: 'definition'
|
||||
/**
|
||||
* Destination (literal) (occurs in definition, image, link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a]: <b> "c"
|
||||
* ^^^
|
||||
* > | a  e
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
destinationLiteral: 'destinationLiteral'
|
||||
/**
|
||||
* Destination (raw) (occurs in definition, image, link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a]: b "c"
|
||||
* ^
|
||||
* > | a  e
|
||||
* ^
|
||||
* ```
|
||||
*/
|
||||
destinationRaw: 'destinationRaw'
|
||||
/**
|
||||
* Emphasis.
|
||||
*
|
||||
* ```markdown
|
||||
* > | *a*
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
emphasis: 'emphasis'
|
||||
/**
|
||||
* Whole heading (atx).
|
||||
*
|
||||
* ```markdown
|
||||
* > | # alpha
|
||||
* ^^^^^^^
|
||||
* ```
|
||||
*/
|
||||
headingAtx: 'headingAtx'
|
||||
/**
|
||||
* Whole heading (setext).
|
||||
*
|
||||
* ```markdown
|
||||
* > | alpha
|
||||
* ^^^^^
|
||||
* > | =====
|
||||
* ^^^^^
|
||||
* ```
|
||||
*/
|
||||
headingSetext: 'headingSetext'
|
||||
/**
|
||||
* Whole image.
|
||||
*
|
||||
* ```markdown
|
||||
* > | 
|
||||
* ^^^^^^^
|
||||
* > | ![c]
|
||||
* ^^^^
|
||||
* ```
|
||||
*/
|
||||
image: 'image'
|
||||
/**
|
||||
* Whole image reference.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ![a]
|
||||
* ^^^^
|
||||
* ```
|
||||
*/
|
||||
imageReference: 'imageReference'
|
||||
/**
|
||||
* Label (occurs in definitions, image reference, image, link reference,
|
||||
* link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a]: b "c"
|
||||
* ^^^
|
||||
* > | a [b] c
|
||||
* ^^^
|
||||
* > | a ![b][c] d
|
||||
* ^^^^
|
||||
* > | a [b](c) d
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
label: 'label'
|
||||
/**
|
||||
* Whole link.
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a](b)
|
||||
* ^^^^^^
|
||||
* > | [c]
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
link: 'link'
|
||||
/**
|
||||
* Whole link reference.
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a]
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
linkReference: 'linkReference'
|
||||
/**
|
||||
* List.
|
||||
*
|
||||
* ```markdown
|
||||
* > | * a
|
||||
* ^^^
|
||||
* > | 1. b
|
||||
* ^^^^
|
||||
* ```
|
||||
*/
|
||||
list: 'list'
|
||||
/**
|
||||
* List item.
|
||||
*
|
||||
* ```markdown
|
||||
* > | * a
|
||||
* ^^^
|
||||
* > | 1. b
|
||||
* ^^^^
|
||||
* ```
|
||||
*/
|
||||
listItem: 'listItem'
|
||||
/**
|
||||
* Paragraph.
|
||||
*
|
||||
* ```markdown
|
||||
* > | a b
|
||||
* ^^^
|
||||
* > | c.
|
||||
* ^^
|
||||
* ```
|
||||
*/
|
||||
paragraph: 'paragraph'
|
||||
/**
|
||||
* Phrasing (occurs in headings, paragraphs, etc).
|
||||
*
|
||||
* ```markdown
|
||||
* > | a
|
||||
* ^
|
||||
* ```
|
||||
*/
|
||||
phrasing: 'phrasing'
|
||||
/**
|
||||
* Reference (occurs in image, link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a][]
|
||||
* ^^
|
||||
* ```
|
||||
*/
|
||||
reference: 'reference'
|
||||
/**
|
||||
* Strong.
|
||||
*
|
||||
* ```markdown
|
||||
* > | **a**
|
||||
* ^^^^^
|
||||
* ```
|
||||
*/
|
||||
strong: 'strong'
|
||||
/**
|
||||
* Title using single quotes (occurs in definition, image, link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a](b 'c')
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
titleApostrophe: 'titleApostrophe'
|
||||
/**
|
||||
* Title using double quotes (occurs in definition, image, link).
|
||||
*
|
||||
* ```markdown
|
||||
* > | [a](b "c")
|
||||
* ^^^
|
||||
* ```
|
||||
*/
|
||||
titleQuote: 'titleQuote'
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct names for things generated by `mdast-util-to-markdown`.
|
||||
*
|
||||
* This is an enum of strings, each being a semantic label, useful to know when
|
||||
* serializing whether we’re for example in a double (`"`) or single (`'`)
|
||||
* quoted title.
|
||||
*/
|
||||
export type ConstructName = ConstructNameMap[keyof ConstructNameMap]
|
||||
|
||||
/**
|
||||
* Serialize the children of a parent that contains flow children.
|
||||
*
|
||||
* These children will typically be joined by blank lines.
|
||||
* What they are joined by exactly is defined by `Join` functions.
|
||||
*
|
||||
* @param parent
|
||||
* Parent of flow nodes.
|
||||
* @param info
|
||||
* Info on where we are in the document we are generating.
|
||||
* @returns
|
||||
* Serialized children, joined by (blank) lines.
|
||||
*/
|
||||
export type ContainerFlow = (parent: FlowParents, info: TrackFields) => string
|
||||
|
||||
/**
|
||||
* Serialize the children of a parent that contains phrasing children.
|
||||
*
|
||||
* These children will be joined flush together.
|
||||
*
|
||||
* @param parent
|
||||
* Parent of phrasing nodes.
|
||||
* @param info
|
||||
* Info on where we are in the document we are generating.
|
||||
* @returns
|
||||
* Serialized children, joined together.
|
||||
*/
|
||||
export type ContainerPhrasing = (parent: PhrasingParents, info: Info) => string
|
||||
|
||||
/**
|
||||
* Track positional info in the output.
|
||||
*
|
||||
* This info isn’t used yet but such functionality will allow line wrapping,
|
||||
* source maps, etc.
|
||||
*
|
||||
* @param info
|
||||
* Info on where we are in the document we are generating.
|
||||
* @returns
|
||||
* Tracker.
|
||||
*/
|
||||
export type CreateTracker = (info: TrackFields) => Tracker
|
||||
|
||||
/**
|
||||
* Whether to encode things — with fields representing the surrounding of a
|
||||
* whole.
|
||||
*/
|
||||
export interface EncodeSurrounding {
|
||||
/**
|
||||
* Whether to encode after.
|
||||
*/
|
||||
after: boolean
|
||||
|
||||
/**
|
||||
* Whether to encode before.
|
||||
*/
|
||||
before: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to encode things — with fields representing the relationship to a
|
||||
* whole.
|
||||
*/
|
||||
export interface EncodeSides {
|
||||
/**
|
||||
* Whether to encode inside.
|
||||
*/
|
||||
inside: boolean
|
||||
|
||||
/**
|
||||
* Whether to encode before.
|
||||
*/
|
||||
outside: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter something.
|
||||
*
|
||||
* @param name
|
||||
* Label, more similar to a micromark event than an mdast node type.
|
||||
* @returns
|
||||
* Revert.
|
||||
*/
|
||||
export type Enter = (name: ConstructName) => Exit
|
||||
|
||||
/**
|
||||
* Exit something.
|
||||
*
|
||||
* @returns
|
||||
* Nothing.
|
||||
*/
|
||||
export type Exit = () => undefined
|
||||
|
||||
/**
|
||||
* Children of flow nodes.
|
||||
*/
|
||||
export type FlowChildren = FlowParents extends {
|
||||
children: Array<infer T>
|
||||
}
|
||||
? T
|
||||
: never
|
||||
|
||||
/**
|
||||
* Parents that are not phrasing,
|
||||
* or similar.
|
||||
*/
|
||||
export type FlowParents = Exclude<
|
||||
Parents,
|
||||
PhrasingContent | TableCell | TableRow
|
||||
>
|
||||
|
||||
/**
|
||||
* Handle particular nodes.
|
||||
*
|
||||
* Each key is a node type, each value its corresponding handler.
|
||||
*/
|
||||
export type Handlers = Record<Nodes['type'], Handle>
|
||||
|
||||
/**
|
||||
* Handle a particular node.
|
||||
*
|
||||
* @param node
|
||||
* Expected mdast node.
|
||||
* @param parent
|
||||
* Parent of `node`.
|
||||
* @param state
|
||||
* Info passed around about the current state.
|
||||
* @param Info
|
||||
* Info on the surrounding of the node that is serialized.
|
||||
* @returns
|
||||
* Serialized markdown representing `node`.
|
||||
*/
|
||||
export type Handle = (
|
||||
node: any,
|
||||
parent: Parents | undefined,
|
||||
state: State,
|
||||
Info: Info
|
||||
) => string
|
||||
|
||||
/**
|
||||
* Pad serialized markdown.
|
||||
*
|
||||
* @param value
|
||||
* Whole fragment of serialized markdown.
|
||||
* @param map
|
||||
* Map function.
|
||||
* @returns
|
||||
* Padded value.
|
||||
*/
|
||||
export type IndentLines = (value: string, map: Map) => string
|
||||
|
||||
/**
|
||||
* Info on the surrounding of the node that is serialized.
|
||||
*/
|
||||
export interface Info extends SafeFields, TrackFields {}
|
||||
|
||||
/**
|
||||
* How to join two blocks.
|
||||
*
|
||||
* “Blocks” are typically joined by one blank line.
|
||||
* Sometimes it’s nicer to have them flush next to each other, yet other
|
||||
* times they cannot occur together at all.
|
||||
*
|
||||
* Join functions receive two adjacent siblings and their parent and what
|
||||
* they return defines how many blank lines to use between them.
|
||||
*
|
||||
* @param left
|
||||
* First of two adjacent siblings.
|
||||
* @param right
|
||||
* Second of two adjacent siblings.
|
||||
* @param parent
|
||||
* Parent of the two siblings.
|
||||
* @param state
|
||||
* Info passed around about the current state.
|
||||
* @returns
|
||||
* How many blank lines to use between the siblings.
|
||||
*
|
||||
* Where `true` is as passing `1` and `false` means the nodes cannot be
|
||||
* joined by a blank line, such as two adjacent block quotes or indented code
|
||||
* after a list, in which case a comment will be injected to break them up:
|
||||
*
|
||||
* ```markdown
|
||||
* > Quote 1
|
||||
*
|
||||
* <!---->
|
||||
*
|
||||
* > Quote 2
|
||||
* ```
|
||||
*
|
||||
* > 👉 **Note**: abusing this feature will break markdown.
|
||||
* > One such example is when returning `0` for two paragraphs, which will
|
||||
* > result in the text running together, and in the future to be seen as
|
||||
* > one paragraph.
|
||||
*/
|
||||
export type Join = (
|
||||
left: FlowChildren,
|
||||
right: FlowChildren,
|
||||
parent: FlowParents,
|
||||
state: State
|
||||
) => boolean | number | null | undefined | void
|
||||
|
||||
/**
|
||||
* Map function to pad a single line.
|
||||
*
|
||||
* @param value
|
||||
* A single line of serialized markdown.
|
||||
* @param line
|
||||
* Line number relative to the fragment.
|
||||
* @param blank
|
||||
* Whether the line is considered blank in markdown.
|
||||
* @returns
|
||||
* Padded line.
|
||||
*/
|
||||
export type Map = (value: string, line: number, blank: boolean) => string
|
||||
|
||||
/**
|
||||
* Configuration (optional).
|
||||
*/
|
||||
export interface Options {
|
||||
/**
|
||||
* Marker to use in certain cases where the primary bullet doesn’t work
|
||||
* (default: `'-'` when `bullet` is `'*'`, `'*'` otherwise).
|
||||
*
|
||||
* Cannot be equal to `bullet`.
|
||||
*/
|
||||
bulletOther?: '*' | '+' | '-' | null | undefined
|
||||
/**
|
||||
* Marker to use for bullets of items in ordered lists (default: `'.'`).
|
||||
*
|
||||
* There is one case where the primary bullet for ordered items cannot be
|
||||
* used:
|
||||
*
|
||||
* * when two ordered lists appear next to each other: `1. a\n2) b`; to
|
||||
* solve
|
||||
* that, `'.'` will be used when `bulletOrdered` is `')'`, and `'.'`
|
||||
* otherwise
|
||||
*/
|
||||
bulletOrdered?: '.' | ')' | null | undefined
|
||||
/**
|
||||
* Marker to use for bullets of items in unordered lists (default: `'*'`).
|
||||
*
|
||||
* There are three cases where the primary bullet cannot be used:
|
||||
*
|
||||
* * when three or more list items are on their own, the last one is empty,
|
||||
* and `bullet` is also a valid `rule`: `* - +`; this would turn into a
|
||||
* thematic break if serialized with three primary bullets; `bulletOther`
|
||||
* is used for the last item
|
||||
* * when a thematic break is the first child of a list item and `bullet` is
|
||||
* the same character as `rule`: `- ***`; this would turn into a single
|
||||
* thematic break if serialized with primary bullets; `bulletOther` is used
|
||||
* for the item
|
||||
* * when two unordered lists appear next to each other: `* a\n- b`;
|
||||
* `bulletOther` is used for such lists
|
||||
*/
|
||||
bullet?: '*' | '+' | '-' | null | undefined
|
||||
/**
|
||||
* Whether to add the same number of number signs (`#`) at the end of an ATX
|
||||
* heading as the opening sequence (default: `false`).
|
||||
*/
|
||||
closeAtx?: boolean | null | undefined
|
||||
/**
|
||||
* Marker to use for emphasis (default: `'*'`).
|
||||
*/
|
||||
emphasis?: '*' | '_' | null | undefined
|
||||
/**
|
||||
* List of extensions to include (optional).
|
||||
*
|
||||
* Each `ToMarkdownExtension` is an object with the same interface as
|
||||
* `Options` here.
|
||||
*/
|
||||
extensions?: Array<Options> | null | undefined
|
||||
/**
|
||||
* Whether to use fenced code always (default: `true`).
|
||||
*
|
||||
* The default is to use fenced code if there is a language defined, if the
|
||||
* code is empty, or if it starts or ends in blank lines.
|
||||
*/
|
||||
fences?: boolean | null | undefined
|
||||
/**
|
||||
* Marker to use for fenced code (default: ``'`'``).
|
||||
*/
|
||||
fence?: '`' | '~' | null | undefined
|
||||
/**
|
||||
* Handle particular nodes (optional).
|
||||
*
|
||||
* Each key is a node type, each value its corresponding handler.
|
||||
*/
|
||||
handlers?: Partial<Handlers> | null | undefined
|
||||
/**
|
||||
* Whether to increment the counter of ordered lists items (default: `true`).
|
||||
*/
|
||||
incrementListMarker?: boolean | null | undefined
|
||||
/**
|
||||
* How to join blocks (optional).
|
||||
*/
|
||||
join?: Array<Join> | null | undefined
|
||||
/**
|
||||
* How to indent the content of list items (default: `'one'`).
|
||||
*
|
||||
* Either with the size of the bullet plus one space (when `'one'`), a tab
|
||||
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`,
|
||||
* uses `'one'` if the item and list are tight and `'tab'` otherwise).
|
||||
*/
|
||||
listItemIndent?: 'mixed' | 'one' | 'tab' | null | undefined
|
||||
/**
|
||||
* Marker to use for titles (default: `'"'`).
|
||||
*/
|
||||
quote?: '"' | "'" | null | undefined
|
||||
/**
|
||||
* Whether to always use resource links (default: `false`).
|
||||
*
|
||||
* The default is to use autolinks (`<https://example.com>`) when possible
|
||||
* and resource links (`[text](url)`) otherwise.
|
||||
*/
|
||||
resourceLink?: boolean | null | undefined
|
||||
/**
|
||||
* Number of markers to use for thematic breaks (default: `3`).
|
||||
*/
|
||||
ruleRepetition?: number | null | undefined
|
||||
/**
|
||||
* Whether to add spaces between markers in thematic breaks (default:
|
||||
* `false`).
|
||||
*/
|
||||
ruleSpaces?: boolean | null | undefined
|
||||
/**
|
||||
* Marker to use for thematic breaks (default: `'*'`).
|
||||
*/
|
||||
rule?: '*' | '-' | '_' | null | undefined
|
||||
/**
|
||||
* Whether to use setext headings when possible (default: `false`).
|
||||
*
|
||||
* The default is to always use ATX headings (`# heading`) instead of setext
|
||||
* headings (`heading\n=======`).
|
||||
* Setext headings cannot be used for empty headings or headings with a rank
|
||||
* of three or more.
|
||||
*/
|
||||
setext?: boolean | null | undefined
|
||||
/**
|
||||
* Marker to use for strong (default: `'*'`).
|
||||
*/
|
||||
strong?: '*' | '_' | null | undefined
|
||||
/**
|
||||
* Whether to join definitions without a blank line (default: `false`).
|
||||
*
|
||||
* The default is to add blank lines between any flow (“block”) construct.
|
||||
* Turning this option on is a shortcut for a join function like so:
|
||||
*
|
||||
* ```js
|
||||
* function joinTightDefinitions(left, right) {
|
||||
* if (left.type === 'definition' && right.type === 'definition') {
|
||||
* return 0
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
tightDefinitions?: boolean | null | undefined
|
||||
/**
|
||||
* Schemas that define when characters cannot occur (optional).
|
||||
*/
|
||||
unsafe?: Array<Unsafe> | null | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent of phrasing nodes.
|
||||
*/
|
||||
export type PhrasingParents = Parents extends {
|
||||
children: Array<infer T>
|
||||
}
|
||||
? PhrasingContent extends T
|
||||
? Parents
|
||||
: never
|
||||
: never
|
||||
|
||||
/**
|
||||
* Configuration for `safe`
|
||||
*/
|
||||
export interface SafeConfig extends SafeFields {
|
||||
/**
|
||||
* Extra characters that *must* be encoded (as character references) instead
|
||||
* of escaped (character escapes) (optional).
|
||||
*
|
||||
* Only ASCII punctuation will use character escapes, so you never need to
|
||||
* pass non-ASCII-punctuation here.
|
||||
*/
|
||||
encode?: Array<string> | null | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Info on the characters that are around the current thing we are generating.
|
||||
*/
|
||||
export interface SafeFields {
|
||||
/**
|
||||
* Characters after this (guaranteed to be one, can be more).
|
||||
*/
|
||||
after: string
|
||||
/**
|
||||
* Characters before this (guaranteed to be one, can be more).
|
||||
*/
|
||||
before: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a string safe for embedding in markdown constructs.
|
||||
*
|
||||
* In markdown, almost all punctuation characters can, in certain cases,
|
||||
* result in something.
|
||||
* Whether they do is highly subjective to where they happen and in what
|
||||
* they happen.
|
||||
*
|
||||
* To solve this, `mdast-util-to-markdown` tracks:
|
||||
*
|
||||
* * Characters before and after something;
|
||||
* * What “constructs” we are in.
|
||||
*
|
||||
* This information is then used by this function to escape or encode
|
||||
* special characters.
|
||||
*
|
||||
* @param input
|
||||
* Raw value to make safe.
|
||||
* @param config
|
||||
* Configuration.
|
||||
* @returns
|
||||
* Serialized markdown safe for embedding.
|
||||
*/
|
||||
export type Safe = (
|
||||
input: string | null | undefined,
|
||||
config: SafeConfig
|
||||
) => string
|
||||
|
||||
/**
|
||||
* Info passed around about the current state.
|
||||
*/
|
||||
export interface State {
|
||||
/**
|
||||
* Get an identifier from an association to match it to others.
|
||||
*/
|
||||
associationId: AssociationId
|
||||
/**
|
||||
* Info on whether to encode the surrounding of *attention*.
|
||||
*
|
||||
* Whether attention (emphasis, strong, strikethrough) forms
|
||||
* depends on the characters inside and outside them.
|
||||
* The characters inside can be handled by *attention* itself.
|
||||
* However the outside characters are already handled.
|
||||
* Or handled afterwards.
|
||||
* This field can be used to signal from *attention* that some parent
|
||||
* function (practically `containerPhrasing`) has to handle the surrounding.
|
||||
*/
|
||||
attentionEncodeSurroundingInfo: EncodeSurrounding | undefined
|
||||
/**
|
||||
* List marker currently in use.
|
||||
*/
|
||||
bulletCurrent: string | undefined
|
||||
/**
|
||||
* List marker previously in use.
|
||||
*/
|
||||
bulletLastUsed: string | undefined
|
||||
/**
|
||||
* Compile an unsafe pattern to a regex.
|
||||
*/
|
||||
compilePattern: CompilePattern
|
||||
/**
|
||||
* Serialize the children of a parent that contains phrasing children.
|
||||
*/
|
||||
containerPhrasing: ContainerPhrasing
|
||||
/**
|
||||
* Serialize the children of a parent that contains flow children.
|
||||
*/
|
||||
containerFlow: ContainerFlow
|
||||
/**
|
||||
* Track positional info in the output.
|
||||
*/
|
||||
createTracker: CreateTracker
|
||||
/**
|
||||
* Enter a construct (returns a corresponding exit function).
|
||||
*/
|
||||
enter: Enter
|
||||
/**
|
||||
* Applied handlers.
|
||||
*/
|
||||
handlers: Handlers
|
||||
/**
|
||||
* Call the configured handler for the given node.
|
||||
*/
|
||||
handle: Handle
|
||||
/**
|
||||
* Pad serialized markdown.
|
||||
*/
|
||||
indentLines: IndentLines
|
||||
/**
|
||||
* Positions of child nodes in their parents.
|
||||
*/
|
||||
indexStack: Array<number>
|
||||
/**
|
||||
* Applied join handlers.
|
||||
*/
|
||||
join: Array<Join>
|
||||
/**
|
||||
* Applied user configuration.
|
||||
*/
|
||||
options: Options
|
||||
/**
|
||||
* Serialize the children of a parent that contains flow children.
|
||||
*/
|
||||
safe: Safe
|
||||
/**
|
||||
* Stack of constructs we’re in.
|
||||
*/
|
||||
stack: Array<ConstructName>
|
||||
/**
|
||||
* Applied unsafe patterns.
|
||||
*/
|
||||
unsafe: Array<Unsafe>
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current tracked info.
|
||||
*
|
||||
* @returns
|
||||
* Current tracked info.
|
||||
*/
|
||||
export type TrackCurrent = () => TrackFields
|
||||
|
||||
/**
|
||||
* Info on where we are in the document we are generating.
|
||||
*/
|
||||
export interface TrackFields {
|
||||
/**
|
||||
* Number of columns each line will be shifted by wrapping nodes.
|
||||
*/
|
||||
lineShift: number
|
||||
/**
|
||||
* Current point.
|
||||
*/
|
||||
now: Point
|
||||
}
|
||||
|
||||
/**
|
||||
* Move past some generated markdown.
|
||||
*
|
||||
* @param value
|
||||
* Generated markdown.
|
||||
* @returns
|
||||
* Given markdown.
|
||||
*/
|
||||
export type TrackMove = (value: string | null | undefined) => string
|
||||
|
||||
/**
|
||||
* Define a relative increased line shift (the typical indent for lines).
|
||||
*
|
||||
* @param value
|
||||
* Relative increment in how much each line will be padded.
|
||||
* @returns
|
||||
* Nothing.
|
||||
*/
|
||||
export type TrackShift = (value: number) => undefined
|
||||
|
||||
/**
|
||||
* Track positional info in the output.
|
||||
*
|
||||
* This info isn’t used yet but such functionality will allow line wrapping,
|
||||
* source maps, etc.
|
||||
*/
|
||||
export interface Tracker {
|
||||
/**
|
||||
* Get the current tracked info.
|
||||
*/
|
||||
current: TrackCurrent
|
||||
/**
|
||||
* Move past some generated markdown.
|
||||
*/
|
||||
move: TrackMove
|
||||
/**
|
||||
* Define an increased line shift (the typical indent for lines).
|
||||
*/
|
||||
shift: TrackShift
|
||||
}
|
||||
|
||||
/**
|
||||
* Schema that defines when a character cannot occur.
|
||||
*/
|
||||
export interface Unsafe {
|
||||
/**
|
||||
* The unsafe pattern (this whole object) compiled as a regex (do not use).
|
||||
*
|
||||
* This is internal and must not be defined.
|
||||
*/
|
||||
_compiled?: RegExp | null | undefined
|
||||
/**
|
||||
* `character` is bad when this is after it (optional).
|
||||
*/
|
||||
after?: string | null | undefined
|
||||
/**
|
||||
* `character` is bad at a break (cannot be used together with `before`) (optional).
|
||||
*/
|
||||
atBreak?: boolean | null | undefined
|
||||
/**
|
||||
* `character` is bad when this is before it (cannot be used together with
|
||||
* `atBreak`) (optional).
|
||||
*/
|
||||
before?: string | null | undefined
|
||||
/**
|
||||
* Single unsafe character.
|
||||
*/
|
||||
character: string
|
||||
/**
|
||||
* Constructs where this is bad (optional).
|
||||
*/
|
||||
inConstruct?: Array<ConstructName> | ConstructName | null | undefined
|
||||
/**
|
||||
* Constructs where this is fine again (optional).
|
||||
*/
|
||||
notInConstruct?: Array<ConstructName> | ConstructName | null | undefined
|
||||
}
|
2
node_modules/mdast-util-to-markdown/lib/types.js
generated
vendored
Normal file
2
node_modules/mdast-util-to-markdown/lib/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Note: types exposed from `types.d.ts`.
|
||||
export {}
|
4
node_modules/mdast-util-to-markdown/lib/unsafe.d.ts
generated
vendored
Normal file
4
node_modules/mdast-util-to-markdown/lib/unsafe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/** @type {Array<Unsafe>} */
|
||||
export const unsafe: Array<Unsafe>;
|
||||
import type { Unsafe } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=unsafe.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unsafe.d.ts","sourceRoot":"","sources":["unsafe.js"],"names":[],"mappings":"AAqBA,4BAA4B;AAC5B,qBADW,KAAK,CAAC,MAAM,CAAC,CA4HvB;4BAhJuC,wBAAwB"}
|
146
node_modules/mdast-util-to-markdown/lib/unsafe.js
generated
vendored
Normal file
146
node_modules/mdast-util-to-markdown/lib/unsafe.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* List of constructs that occur in phrasing (paragraphs, headings), but cannot
|
||||
* contain things like attention (emphasis, strong), images, or links.
|
||||
* So they sort of cancel each other out.
|
||||
* Note: could use a better name.
|
||||
*
|
||||
* @type {Array<ConstructName>}
|
||||
*/
|
||||
const fullPhrasingSpans = [
|
||||
'autolink',
|
||||
'destinationLiteral',
|
||||
'destinationRaw',
|
||||
'reference',
|
||||
'titleQuote',
|
||||
'titleApostrophe'
|
||||
]
|
||||
|
||||
/** @type {Array<Unsafe>} */
|
||||
export const unsafe = [
|
||||
{character: '\t', after: '[\\r\\n]', inConstruct: 'phrasing'},
|
||||
{character: '\t', before: '[\\r\\n]', inConstruct: 'phrasing'},
|
||||
{
|
||||
character: '\t',
|
||||
inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']
|
||||
},
|
||||
{
|
||||
character: '\r',
|
||||
inConstruct: [
|
||||
'codeFencedLangGraveAccent',
|
||||
'codeFencedLangTilde',
|
||||
'codeFencedMetaGraveAccent',
|
||||
'codeFencedMetaTilde',
|
||||
'destinationLiteral',
|
||||
'headingAtx'
|
||||
]
|
||||
},
|
||||
{
|
||||
character: '\n',
|
||||
inConstruct: [
|
||||
'codeFencedLangGraveAccent',
|
||||
'codeFencedLangTilde',
|
||||
'codeFencedMetaGraveAccent',
|
||||
'codeFencedMetaTilde',
|
||||
'destinationLiteral',
|
||||
'headingAtx'
|
||||
]
|
||||
},
|
||||
{character: ' ', after: '[\\r\\n]', inConstruct: 'phrasing'},
|
||||
{character: ' ', before: '[\\r\\n]', inConstruct: 'phrasing'},
|
||||
{
|
||||
character: ' ',
|
||||
inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde']
|
||||
},
|
||||
// An exclamation mark can start an image, if it is followed by a link or
|
||||
// a link reference.
|
||||
{
|
||||
character: '!',
|
||||
after: '\\[',
|
||||
inConstruct: 'phrasing',
|
||||
notInConstruct: fullPhrasingSpans
|
||||
},
|
||||
// A quote can break out of a title.
|
||||
{character: '"', inConstruct: 'titleQuote'},
|
||||
// A number sign could start an ATX heading if it starts a line.
|
||||
{atBreak: true, character: '#'},
|
||||
{character: '#', inConstruct: 'headingAtx', after: '(?:[\r\n]|$)'},
|
||||
// Dollar sign and percentage are not used in markdown.
|
||||
// An ampersand could start a character reference.
|
||||
{character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'},
|
||||
// An apostrophe can break out of a title.
|
||||
{character: "'", inConstruct: 'titleApostrophe'},
|
||||
// A left paren could break out of a destination raw.
|
||||
{character: '(', inConstruct: 'destinationRaw'},
|
||||
// A left paren followed by `]` could make something into a link or image.
|
||||
{
|
||||
before: '\\]',
|
||||
character: '(',
|
||||
inConstruct: 'phrasing',
|
||||
notInConstruct: fullPhrasingSpans
|
||||
},
|
||||
// A right paren could start a list item or break out of a destination
|
||||
// raw.
|
||||
{atBreak: true, before: '\\d+', character: ')'},
|
||||
{character: ')', inConstruct: 'destinationRaw'},
|
||||
// An asterisk can start thematic breaks, list items, emphasis, strong.
|
||||
{atBreak: true, character: '*', after: '(?:[ \t\r\n*])'},
|
||||
{character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
|
||||
// A plus sign could start a list item.
|
||||
{atBreak: true, character: '+', after: '(?:[ \t\r\n])'},
|
||||
// A dash can start thematic breaks, list items, and setext heading
|
||||
// underlines.
|
||||
{atBreak: true, character: '-', after: '(?:[ \t\r\n-])'},
|
||||
// A dot could start a list item.
|
||||
{atBreak: true, before: '\\d+', character: '.', after: '(?:[ \t\r\n]|$)'},
|
||||
// Slash, colon, and semicolon are not used in markdown for constructs.
|
||||
// A less than can start html (flow or text) or an autolink.
|
||||
// HTML could start with an exclamation mark (declaration, cdata, comment),
|
||||
// slash (closing tag), question mark (instruction), or a letter (tag).
|
||||
// An autolink also starts with a letter.
|
||||
// Finally, it could break out of a destination literal.
|
||||
{atBreak: true, character: '<', after: '[!/?A-Za-z]'},
|
||||
{
|
||||
character: '<',
|
||||
after: '[!/?A-Za-z]',
|
||||
inConstruct: 'phrasing',
|
||||
notInConstruct: fullPhrasingSpans
|
||||
},
|
||||
{character: '<', inConstruct: 'destinationLiteral'},
|
||||
// An equals to can start setext heading underlines.
|
||||
{atBreak: true, character: '='},
|
||||
// A greater than can start block quotes and it can break out of a
|
||||
// destination literal.
|
||||
{atBreak: true, character: '>'},
|
||||
{character: '>', inConstruct: 'destinationLiteral'},
|
||||
// Question mark and at sign are not used in markdown for constructs.
|
||||
// A left bracket can start definitions, references, labels,
|
||||
{atBreak: true, character: '['},
|
||||
{character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
|
||||
{character: '[', inConstruct: ['label', 'reference']},
|
||||
// A backslash can start an escape (when followed by punctuation) or a
|
||||
// hard break (when followed by an eol).
|
||||
// Note: typical escapes are handled in `safe`!
|
||||
{character: '\\', after: '[\\r\\n]', inConstruct: 'phrasing'},
|
||||
// A right bracket can exit labels.
|
||||
{character: ']', inConstruct: ['label', 'reference']},
|
||||
// Caret is not used in markdown for constructs.
|
||||
// An underscore can start emphasis, strong, or a thematic break.
|
||||
{atBreak: true, character: '_'},
|
||||
{character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
|
||||
// A grave accent can start code (fenced or text), or it can break out of
|
||||
// a grave accent code fence.
|
||||
{atBreak: true, character: '`'},
|
||||
{
|
||||
character: '`',
|
||||
inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent']
|
||||
},
|
||||
{character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans},
|
||||
// Left brace, vertical bar, right brace are not used in markdown for
|
||||
// constructs.
|
||||
// A tilde can start code (fenced).
|
||||
{atBreak: true, character: '~'}
|
||||
]
|
2
node_modules/mdast-util-to-markdown/lib/util/association.d.ts
generated
vendored
Normal file
2
node_modules/mdast-util-to-markdown/lib/util/association.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function association(node: import("mdast").Association): string;
|
||||
//# sourceMappingURL=association.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/association.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/association.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"association.d.ts","sourceRoot":"","sources":["association.js"],"names":[],"mappings":""}
|
33
node_modules/mdast-util-to-markdown/lib/util/association.js
generated
vendored
Normal file
33
node_modules/mdast-util-to-markdown/lib/util/association.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @import {AssociationId} from '../types.js'
|
||||
*/
|
||||
|
||||
import {decodeString} from 'micromark-util-decode-string'
|
||||
|
||||
/**
|
||||
* Get an identifier from an association to match it to others.
|
||||
*
|
||||
* Associations are nodes that match to something else through an ID:
|
||||
* <https://github.com/syntax-tree/mdast#association>.
|
||||
*
|
||||
* The `label` of an association is the string value: character escapes and
|
||||
* references work, and casing is intact.
|
||||
* The `identifier` is used to match one association to another:
|
||||
* controversially, character escapes and references don’t work in this
|
||||
* matching: `©` does not match `©`, and `\+` does not match `+`.
|
||||
*
|
||||
* But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb`
|
||||
* matches `a b`.
|
||||
* So, we do prefer the label when figuring out how we’re going to serialize:
|
||||
* it has whitespace, casing, and we can ignore most useless character
|
||||
* escapes and all character references.
|
||||
*
|
||||
* @type {AssociationId}
|
||||
*/
|
||||
export function association(node) {
|
||||
if (node.label || !node.identifier) {
|
||||
return node.label || ''
|
||||
}
|
||||
|
||||
return decodeString(node.identifier)
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
|
||||
*/
|
||||
export function checkBulletOrdered(state: State): Exclude<Options["bulletOrdered"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-bullet-ordered.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-bullet-ordered.d.ts","sourceRoot":"","sources":["check-bullet-ordered.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,0CAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAc/D;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
|
||||
*/
|
||||
export function checkBulletOrdered(state) {
|
||||
const marker = state.options.bulletOrdered || '.'
|
||||
|
||||
if (marker !== '.' && marker !== ')') {
|
||||
throw new Error(
|
||||
'Cannot serialize items with `' +
|
||||
marker +
|
||||
'` for `options.bulletOrdered`, expected `.` or `)`'
|
||||
)
|
||||
}
|
||||
|
||||
return marker
|
||||
}
|
8
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts
generated
vendored
Normal file
8
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bullet'], null | undefined>}
|
||||
*/
|
||||
export function checkBulletOther(state: State): Exclude<Options["bullet"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-bullet-other.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-bullet-other.d.ts","sourceRoot":"","sources":["check-bullet-other.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CA6BxD;2BApCgC,wBAAwB;6BAAxB,wBAAwB"}
|
38
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
generated
vendored
Normal file
38
node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
import {checkBullet} from './check-bullet.js'
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bullet'], null | undefined>}
|
||||
*/
|
||||
export function checkBulletOther(state) {
|
||||
const bullet = checkBullet(state)
|
||||
const bulletOther = state.options.bulletOther
|
||||
|
||||
if (!bulletOther) {
|
||||
return bullet === '*' ? '-' : '*'
|
||||
}
|
||||
|
||||
if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {
|
||||
throw new Error(
|
||||
'Cannot serialize items with `' +
|
||||
bulletOther +
|
||||
'` for `options.bulletOther`, expected `*`, `+`, or `-`'
|
||||
)
|
||||
}
|
||||
|
||||
if (bulletOther === bullet) {
|
||||
throw new Error(
|
||||
'Expected `bullet` (`' +
|
||||
bullet +
|
||||
'`) and `bulletOther` (`' +
|
||||
bulletOther +
|
||||
'`) to be different'
|
||||
)
|
||||
}
|
||||
|
||||
return bulletOther
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bullet'], null | undefined>}
|
||||
*/
|
||||
export function checkBullet(state: State): Exclude<Options["bullet"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-bullet.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-bullet.d.ts","sourceRoot":"","sources":["check-bullet.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,mCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAcxD;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['bullet'], null | undefined>}
|
||||
*/
|
||||
export function checkBullet(state) {
|
||||
const marker = state.options.bullet || '*'
|
||||
|
||||
if (marker !== '*' && marker !== '+' && marker !== '-') {
|
||||
throw new Error(
|
||||
'Cannot serialize items with `' +
|
||||
marker +
|
||||
'` for `options.bullet`, expected `*`, `+`, or `-`'
|
||||
)
|
||||
}
|
||||
|
||||
return marker
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['emphasis'], null | undefined>}
|
||||
*/
|
||||
export function checkEmphasis(state: State): Exclude<Options["emphasis"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-emphasis.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-emphasis.d.ts","sourceRoot":"","sources":["check-emphasis.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,qCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAc1D;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['emphasis'], null | undefined>}
|
||||
*/
|
||||
export function checkEmphasis(state) {
|
||||
const marker = state.options.emphasis || '*'
|
||||
|
||||
if (marker !== '*' && marker !== '_') {
|
||||
throw new Error(
|
||||
'Cannot serialize emphasis with `' +
|
||||
marker +
|
||||
'` for `options.emphasis`, expected `*`, or `_`'
|
||||
)
|
||||
}
|
||||
|
||||
return marker
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['fence'], null | undefined>}
|
||||
*/
|
||||
export function checkFence(state: State): Exclude<Options["fence"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-fence.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-fence.d.ts","sourceRoot":"","sources":["check-fence.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,kCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAcvD;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-fence.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-fence.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['fence'], null | undefined>}
|
||||
*/
|
||||
export function checkFence(state) {
|
||||
const marker = state.options.fence || '`'
|
||||
|
||||
if (marker !== '`' && marker !== '~') {
|
||||
throw new Error(
|
||||
'Cannot serialize code with `' +
|
||||
marker +
|
||||
'` for `options.fence`, expected `` ` `` or `~`'
|
||||
)
|
||||
}
|
||||
|
||||
return marker
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
|
||||
*/
|
||||
export function checkListItemIndent(state: State): Exclude<Options["listItemIndent"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-list-item-indent.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-list-item-indent.d.ts","sourceRoot":"","sources":["check-list-item-indent.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,2CAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAchE;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
|
||||
*/
|
||||
export function checkListItemIndent(state) {
|
||||
const style = state.options.listItemIndent || 'one'
|
||||
|
||||
if (style !== 'tab' && style !== 'one' && style !== 'mixed') {
|
||||
throw new Error(
|
||||
'Cannot serialize items with `' +
|
||||
style +
|
||||
'` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'
|
||||
)
|
||||
}
|
||||
|
||||
return style
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['quote'], null | undefined>}
|
||||
*/
|
||||
export function checkQuote(state: State): Exclude<Options["quote"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-quote.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-quote.d.ts","sourceRoot":"","sources":["check-quote.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,kCAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAcvD;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
21
node_modules/mdast-util-to-markdown/lib/util/check-quote.js
generated
vendored
Normal file
21
node_modules/mdast-util-to-markdown/lib/util/check-quote.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['quote'], null | undefined>}
|
||||
*/
|
||||
export function checkQuote(state) {
|
||||
const marker = state.options.quote || '"'
|
||||
|
||||
if (marker !== '"' && marker !== "'") {
|
||||
throw new Error(
|
||||
'Cannot serialize title with `' +
|
||||
marker +
|
||||
'` for `options.quote`, expected `"`, or `\'`'
|
||||
)
|
||||
}
|
||||
|
||||
return marker
|
||||
}
|
11
node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts
generated
vendored
Normal file
11
node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @import {Options, State} from 'mdast-util-to-markdown'
|
||||
*/
|
||||
/**
|
||||
* @param {State} state
|
||||
* @returns {Exclude<Options['ruleRepetition'], null | undefined>}
|
||||
*/
|
||||
export function checkRuleRepetition(state: State): Exclude<Options["ruleRepetition"], null | undefined>;
|
||||
import type { State } from 'mdast-util-to-markdown';
|
||||
import type { Options } from 'mdast-util-to-markdown';
|
||||
//# sourceMappingURL=check-rule-repetition.d.ts.map
|
1
node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map
generated
vendored
Normal file
1
node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"check-rule-repetition.d.ts","sourceRoot":"","sources":["check-rule-repetition.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,2CAHW,KAAK,GACH,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,CAchE;2BAnBgC,wBAAwB;6BAAxB,wBAAwB"}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user