test02/node_modules/@vuepress/plugin-prismjs/lib/node/parser/getCodeParser.d.ts
罗佳鸿 6aa1ebe342
Some checks are pending
部署文档 / deploy-gh-pages (push) Waiting to run
first commit
2024-08-13 10:11:19 +08:00

34 lines
823 B
TypeScript

/**
* This module processes the output of prismjs by wrapping each line of code
* with a `<span class="line">` and provides simple operations for the line node.
*/
export interface OpenTag {
/**
* @example <tag
*/
before: string;
classList: string[];
/**
* @example >
*/
after: string;
content: string;
toString(): string;
}
type LineHandler = (node: OpenTag, index: number) => void;
export interface CodeParser {
pre: OpenTag;
code: OpenTag;
lines: OpenTag[];
/**
* Add a handler for each the line `<span class="line">`
*/
line: (handler: LineHandler) => void;
/**
* Get the string representation of the parsed code
*/
stringify: () => string;
}
export declare const getCodeParser: (html: string) => CodeParser;
export {};