/** * Markdown文档解析器 * 解析Markdown文档结构,提取可翻译内容,保留格式信息 */ export interface DocumentSection { type: "paragraph" | "heading" | "code" | "blockquote" | "list" | "table" | "html" | "link"; content: string; metadata: Record; startLine: number; endLine: number; level?: number; } export interface DocumentStructure { frontmatter: string | null; toc: Array<{ level: number; title: string; anchor: string; }>; metadata: Record; } export interface ParsedContent { sections: DocumentSection[]; structure: DocumentStructure; originalContent: string; } export interface LinkInfo { text: string; url: string; full: string; } export interface ImageInfo { alt: string; src: string; full: string; } export interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; } /** * 解析Markdown文档 */ export declare function parseMarkdown(content: string): ParsedContent; /** * 重构翻译后的文档 */ export declare function reconstructDocument(translatedSections: DocumentSection[], structure: DocumentStructure): string; /** * 生成锚点链接 */ export declare function generateAnchor(text: string): string; /** * 提取文档中的链接 */ export declare function extractLinks(content: string): LinkInfo[]; /** * 提取文档中的图片 */ export declare function extractImages(content: string): ImageInfo[]; /** * 验证Markdown语法 */ export declare function validateMarkdown(content: string): ValidationResult;