import { Root } from 'mdast'; import { Node } from 'unist'; declare enum DiffType { Ins = "ins", Del = "del" } declare enum DiffNodeType { Ins = "ins", Del = "del", InlineIns = "inlineIns", InlineDel = "inlineDel" } declare enum NodeType { Root = "root", Blockquote = "blockquote", Break = "break", Code = "code", Definition = "definition", Emphasis = "emphasis", Heading = "heading", Html = "html", Image = "image", ImageReference = "imageReference", InlineCode = "inlineCode", Link = "link", LinkReference = "linkReference", List = "list", ListItem = "listItem", Paragraph = "paragraph", Strong = "strong", Text = "text", ThematicBreak = "thematicBreak", Delete = "delete", FootnoteDefinition = "footnoteDefinition", FootnoteReference = "footnoteReference", Table = "table", TableRow = "tableRow", TableCell = "tableCell", ContainerDirective = "containerDirective", LeafDirective = "leafDirective", TextDirective = "textDirective", YAML = "yaml", TOML = "toml", MDXJSEsm = "mdxjsEsm", MDXJSExpression = "mdxJsExpression", MDXFlowExpression = "mdxFlowExpression", MDXTextExpression = "mdxTextExpression", Collapse = "collapse" } /** * Box for id values, allowing subfunctions to modify the value */ interface IdBox { value: number; } interface Options { enableDiffNode?: boolean; contextLines?: number | false; changedLineRanges?: { from: [number, number][]; to: [number, number][]; }; } declare function diffMarkdownAst(nOld?: Root, nNew?: Root, options?: Options): Root; declare const REMARK_DIFF_SEPARATOR = "{{remark_mark_down_diff_separator}}"; declare function remarkMarkdownDiff(options?: Options): (tree: Node) => Node; declare function transformAstWithDiffDataToAstWithDiffNode(ast: Node): Node; /** * * 将 ins 或 del 包裹的普通节点转换为 data.diff 属性的普通节点 * * 示例: * 原始节点: * ```json * { * "type": "del", * "children": [ * { * "type": "text", * "value": "子步骤 2" * } * ] * } * ``` * * 转换后: * ```json * { * "type": "text", * "value": "子步骤 2", * "data": { * "diff": "remove" * } * } * ``` */ declare function transformAstWithDiffNodeToAstWithDiffData(ast: Node): Node; export { DiffNodeType, DiffType, NodeType, REMARK_DIFF_SEPARATOR, diffMarkdownAst, remarkMarkdownDiff, transformAstWithDiffDataToAstWithDiffNode, transformAstWithDiffNodeToAstWithDiffData }; export type { IdBox, Options };