import { LintConfiguration } from './lib/lintConfig'; import { Title } from './lib/title'; import type { Config, ConfigData, LintError, LintConfig, TokenTypes, Parser as ParserBase, Stage, AST } from './base'; import type { TitleOptions } from './lib/title'; import type { LanguageService, QuickFixData } from './lib/lsp'; import type { Token, FunctionHook, TagHook } from './internal'; import type { AstRange } from './lib/range'; declare interface Parser extends ParserBase { default: Parser; /** @since v1.5.1 */ readonly rules: readonly LintError.Rule[]; conversionTable: Map; redirects: Map; /** @since v1.10.0 */ templateDir?: string; /** @since v1.10.0 */ templates: Map; warning: boolean; debugging: boolean; /** * Specify the current time of the parser * * 指定解析器的当前时间 * @since v1.21.2 */ now: Date; configPaths: string[]; /** * Normalize page title * * 规范化页面标题 * @param title title (with or without the namespace prefix) / 标题(含或不含命名空间前缀) * @param defaultNs default namespace number / 命名空间 * @param include whether to be transcluded / 是否嵌入 */ normalizeTitle(title: string, defaultNs?: number, include?: boolean, config?: Config): Title; parse(wikitext: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config, page?: string): Token; parse(wikitext: string, page: string, include?: boolean, maxStage?: number | Stage | Stage[], config?: Config): Token; /** * Create a language server * * 创建语言服务 * @param uri document URI / 文档标识 * @since v1.16.1 */ createLanguageService(uri?: object): LanguageService; /** * print in HTML * * 以HTML格式打印 * @param include whether to be transcluded / 是否嵌入 * @param page page name / 页面名称 * @since v1.32.0 */ print(wikitext: string, include?: boolean, config?: Config, page?: string): string; print(wikitext: string, page: string, include?: boolean, config?: Config): string; /** * get the name of a WMF site from a URL * * 获取一个WMF网站的名称 * @param url script path * @since v1.22.0 */ getWMFSite(url: string): [string, string]; /** * Get the parser configuration for a MediaWiki project with Extension:CodeMirror installed * * 获取一个安装了CodeMirror扩展的MediaWiki项目的解析设置 * @param site site nickname / 网站别名 * @param url script path / 脚本路径 * @param user URI for wiki userpage or email address of the user / 维基用户页面地址或用户的电子邮件地址 * @since v1.18.4 */ fetchConfig(site: string, url: string, user?: string): Promise; /** * Generate HTML * * 生成HTML * @param include whether to be transcluded / 是否嵌入 * @param page page name / 页面名称 * @since v1.32.0 */ toHtml(wikitext: string, include?: boolean, config?: Config, page?: string): string; toHtml(wikitext: string, page: string, include?: boolean, config?: Config): string; /** * Define how to expand a parser function * * 定义如何展开一个解析器函数 * @param name parser function name / 解析器函数名 * @param hook handler function / 处理函数 * @since v1.22.0 */ setFunctionHook(name: string, hook: FunctionHook): void; /** * Define how to convert an extension tag to HTML * * 定义如何将一个扩展标签转换为HTML * @param name tag name / 标签名 * @param hook handler function / 处理函数 * @since v1.22.0 */ setHook(name: string, hook: TagHook): void; /** * Call a parser function * * 调用一个解析器函数 * @param name parser function name / 解析器函数名 * @param args arguments / 参数 * @since v1.31.0 */ callParserFunction(name: string, ...args: string[]): string; callParserFunction(name: string, args: string[] | Record): string; /** * Check if the title is an interwiki link * * 是否是跨维基链接 * @param title title / 链接标题 */ isInterwiki(title: string, config?: Config): RegExpExecArray | null; } declare const Parser: Parser; // @ts-expect-error mixed export styles export = Parser; export default Parser; export type { Config, ConfigData, LintConfig, LintError, TokenTypes, LanguageService, QuickFixData, Title, AST, AstRange, }; export type * from './internal'; declare global { type WikiParserAcceptable = Record; }