完成世界书、骰子、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,6 @@
/**
* Remove all lines starting with `%%` from the text that don't contain a `%%{`
* @param text - The text to remove comments from
* @returns cleaned text
*/
export declare const cleanupComments: (text: string) => string;

View File

@@ -0,0 +1,42 @@
import type { MermaidConfig } from '../config.type.js';
import type { DetectorRecord, DiagramDetector, DiagramLoader, ExternalDiagramDefinition } from './types.js';
export declare const detectors: Record<string, DetectorRecord>;
/**
* Detects the type of the graph text.
*
* Takes into consideration the possible existence of an `%%init` directive
*
* @param text - The text defining the graph. For example:
*
* ```mermaid
* %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* ```
*
* @param config - The mermaid config.
* @returns A graph definition key
*/
export declare const detectType: (text: string, config?: MermaidConfig) => string;
/**
* Registers lazy-loaded diagrams to Mermaid.
*
* The diagram function is loaded asynchronously, so that diagrams are only loaded
* if the diagram is detected.
*
* @remarks
* Please note that the order of diagram detectors is important.
* The first detector to return `true` is the diagram that will be loaded
* and used, so put more specific detectors at the beginning!
*
* @param diagrams - Diagrams to lazy load, and their detectors, in order of importance.
*/
export declare const registerLazyLoadedDiagrams: (...diagrams: ExternalDiagramDefinition[]) => void;
export declare const addDetector: (key: string, detector: DiagramDetector, loader?: DiagramLoader) => void;
export declare const getDiagramLoader: (key: string) => DiagramLoader | undefined;

View File

@@ -0,0 +1,29 @@
import type { DiagramDefinition, DiagramDetector } from './types.js';
import * as _commonDb from '../diagrams/common/commonDb.js';
export declare const log: Record<import("../logger.js").LogLevel, {
(...data: any[]): void;
(message?: any, ...optionalParams: any[]): void;
}>;
export declare const setLogLevel: (level?: keyof typeof import("../logger.js").LEVELS | number) => void;
export declare const getConfig: () => import("../config.type.js").MermaidConfig;
export declare const setConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
export declare const defaultConfig: import("../config.type.js").MermaidConfig;
export declare const setSiteConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
export declare const sanitizeText: (text: string) => string;
export declare const setupGraphViewbox: (graph: any, svgElem: any, padding: any, useMaxWidth: any) => void;
export declare const getCommonDb: () => typeof _commonDb;
export type Detectors = Record<string, DiagramDetector>;
/**
* Registers the given diagram with Mermaid.
*
* Can be used for third-party custom diagrams.
*
* @param id - A unique ID for the given diagram.
* @param diagram - The diagram definition.
* @param detector - Function that returns `true` if a given mermaid text is this diagram definition.
*/
export declare const registerDiagram: (id: string, diagram: DiagramDefinition, detector?: DiagramDetector) => void;
export declare const getDiagram: (name: string) => DiagramDefinition;
export declare class DiagramNotFoundError extends Error {
constructor(name: string);
}