完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

View 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
}

View 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"}

View 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
}

View 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"}

View 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
}

View 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"}

View 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"}

View 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

View File

@@ -0,0 +1,21 @@
/**
* @import {Options, State} from 'mdast-util-to-markdown'
*/
/**
* @param {State} state
* @returns {Exclude<Options['ruleRepetition'], null | undefined>}
*/
export function checkRuleRepetition(state) {
const repetition = state.options.ruleRepetition || 3
if (repetition < 3) {
throw new Error(
'Cannot serialize rules with repetition `' +
repetition +
'` for `options.ruleRepetition`, expected `3` or more'
)
}
return repetition
}

View File

@@ -0,0 +1,11 @@
/**
* @import {Options, State} from 'mdast-util-to-markdown'
*/
/**
* @param {State} state
* @returns {Exclude<Options['rule'], null | undefined>}
*/
export function checkRule(state: State): Exclude<Options["rule"], null | undefined>;
import type { State } from 'mdast-util-to-markdown';
import type { Options } from 'mdast-util-to-markdown';
//# sourceMappingURL=check-rule.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"check-strong.d.ts","sourceRoot":"","sources":["check-strong.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"}

View File

@@ -0,0 +1,21 @@
/**
* @import {Options, State} from 'mdast-util-to-markdown'
*/
/**
* @param {State} state
* @returns {Exclude<Options['strong'], null | undefined>}
*/
export function checkStrong(state) {
const marker = state.options.strong || '*'
if (marker !== '*' && marker !== '_') {
throw new Error(
'Cannot serialize strong with `' +
marker +
'` for `options.strong`, expected `*`, or `_`'
)
}
return marker
}

View File

@@ -0,0 +1,19 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {FlowChildren, FlowParents, TrackFields} from '../types.js'
*/
/**
* @param {FlowParents} parent
* Parent of flow nodes.
* @param {State} state
* Info passed around about the current state.
* @param {TrackFields} info
* Info on where we are in the document we are generating.
* @returns {string}
* Serialized children, joined by (blank) lines.
*/
export function containerFlow(parent: FlowParents, state: State, info: TrackFields): string;
import type { FlowParents } from '../types.js';
import type { State } from 'mdast-util-to-markdown';
import type { TrackFields } from '../types.js';
//# sourceMappingURL=container-flow.d.ts.map

View File

@@ -0,0 +1,84 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {FlowChildren, FlowParents, TrackFields} from '../types.js'
*/
/**
* @param {FlowParents} parent
* Parent of flow nodes.
* @param {State} state
* Info passed around about the current state.
* @param {TrackFields} info
* Info on where we are in the document we are generating.
* @returns {string}
* Serialized children, joined by (blank) lines.
*/
export function containerFlow(parent, state, info) {
const indexStack = state.indexStack
const children = parent.children || []
const tracker = state.createTracker(info)
/** @type {Array<string>} */
const results = []
let index = -1
indexStack.push(-1)
while (++index < children.length) {
const child = children[index]
indexStack[indexStack.length - 1] = index
results.push(
tracker.move(
state.handle(child, parent, state, {
before: '\n',
after: '\n',
...tracker.current()
})
)
)
if (child.type !== 'list') {
state.bulletLastUsed = undefined
}
if (index < children.length - 1) {
results.push(
tracker.move(between(child, children[index + 1], parent, state))
)
}
}
indexStack.pop()
return results.join('')
}
/**
* @param {FlowChildren} left
* @param {FlowChildren} right
* @param {FlowParents} parent
* @param {State} state
* @returns {string}
*/
function between(left, right, parent, state) {
let index = state.join.length
while (index--) {
const result = state.join[index](left, right, parent, state)
if (result === true || result === 1) {
break
}
if (typeof result === 'number') {
return '\n'.repeat(1 + result)
}
if (result === false) {
return '\n\n<!---->\n\n'
}
}
return '\n\n'
}

View File

@@ -0,0 +1,7 @@
/**
* @this {State}
* @returns {'*' | '_'}
*/
export function emphasisStrongMarker(this: State): "*" | "_";
import type { State } from '../types.js';
//# sourceMappingURL=emphasis-strong-marker.d.ts.map

View File

@@ -0,0 +1,10 @@
/**
* Encode a code point as a character reference.
*
* @param {number} code
* Code point to encode.
* @returns {string}
* Encoded character reference.
*/
export function encodeCharacterReference(code: number): string;
//# sourceMappingURL=encode-character-reference.d.ts.map

View File

@@ -0,0 +1,11 @@
/**
* Encode a code point as a character reference.
*
* @param {number} code
* Code point to encode.
* @returns {string}
* Encoded character reference.
*/
export function encodeCharacterReference(code) {
return '&#x' + code.toString(16).toUpperCase() + ';'
}

View File

@@ -0,0 +1,13 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {Code} from 'mdast'
*/
/**
* @param {Code} node
* @param {State} state
* @returns {boolean}
*/
export function formatCodeAsIndented(node: Code, state: State): boolean;
import type { Code } from 'mdast';
import type { State } from 'mdast-util-to-markdown';
//# sourceMappingURL=format-code-as-indented.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"format-heading-as-setext.d.ts","sourceRoot":"","sources":["format-heading-as-setext.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,4CAJW,OAAO,SACP,KAAK,GACH,OAAO,CAsBnB;6BA/ByB,OAAO;2BADT,wBAAwB"}

View File

@@ -0,0 +1,34 @@
/**
* @import {State} from 'mdast-util-to-markdown'
* @import {Heading} from 'mdast'
*/
import {EXIT, visit} from 'unist-util-visit'
import {toString} from 'mdast-util-to-string'
/**
* @param {Heading} node
* @param {State} state
* @returns {boolean}
*/
export function formatHeadingAsSetext(node, state) {
let literalWithBreak = false
// Look for literals with a line break.
// Note that this also
visit(node, function (node) {
if (
('value' in node && /\r?\n|\r/.test(node.value)) ||
node.type === 'break'
) {
literalWithBreak = true
return EXIT
}
})
return Boolean(
(!node.depth || node.depth < 3) &&
toString(node) &&
(state.options.setext || literalWithBreak)
)
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"format-link-as-autolink.d.ts","sourceRoot":"","sources":["format-link-as-autolink.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,2CAJW,IAAI,SACJ,KAAK,GACH,OAAO,CAuBnB;0BA/BsB,OAAO;2BADN,wBAAwB"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"indent-lines.d.ts","sourceRoot":"","sources":["indent-lines.js"],"names":[],"mappings":""}

View File

@@ -0,0 +1,12 @@
/**
* @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'
*/
/**
* @param {Array<ConstructName>} stack
* @param {Unsafe} pattern
* @returns {boolean}
*/
export function patternInScope(stack: Array<ConstructName>, pattern: Unsafe): boolean;
import type { ConstructName } from 'mdast-util-to-markdown';
import type { Unsafe } from 'mdast-util-to-markdown';
//# sourceMappingURL=pattern-in-scope.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["track.js"],"names":[],"mappings":""}