import { ShikiTransformer, ShikiTransformerContext } from "@shikijs/core"; import { Element } from "hast"; import { ShikiTransformer as ShikiTransformer$1 } from "@shikijs/types"; //#region src/shared/notation-transformer.d.ts type MatchAlgorithm = 'v1' | 'v3'; interface MatchAlgorithmOptions { /** * Match algorithm to use * * @see https://shiki.style/packages/transformers#matching-algorithm * @default 'v3' */ matchAlgorithm?: MatchAlgorithm; } export declare function createCommentNotationTransformer(name: string, regex: RegExp, onMatch: (this: ShikiTransformerContext, match: string[], line: Element, commentNode: Element, lines: Element[], index: number) => boolean, matchAlgorithm: MatchAlgorithm | undefined): ShikiTransformer; //#endregion //#region src/transformers/compact-line-options.d.ts export interface TransformerCompactLineOption { /** * 1-based line number. */ line: number; classes?: string[]; } /** * Transformer for `shiki`'s legacy `lineOptions` */ export declare function transformerCompactLineOptions(lineOptions?: TransformerCompactLineOption[]): ShikiTransformer$1; //#endregion //#region src/transformers/meta-highlight.d.ts export declare function parseMetaHighlightString(meta: string): number[] | null; export interface TransformerMetaHighlightOptions { /** * Class for highlighted lines * * @default 'highlighted' */ className?: string; /** * Interpret line numbers as 0-indexed * * @default false */ zeroIndexed?: boolean; } /** * Allow using `{1,3-5}` in the code snippet meta to mark highlighted lines. */ export declare function transformerMetaHighlight(options?: TransformerMetaHighlightOptions): ShikiTransformer$1; //#endregion //#region src/transformers/meta-highlight-word.d.ts export declare function parseMetaHighlightWords(meta: string): string[]; export interface TransformerMetaWordHighlightOptions { /** * Class for highlighted words * * @default 'highlighted-word' */ className?: string; } /** * Allow using `/word/` in the code snippet meta to mark highlighted words. */ export declare function transformerMetaWordHighlight(options?: TransformerMetaWordHighlightOptions): ShikiTransformer$1; export declare function findAllSubstringIndexes(str: string, substr: string): number[]; //#endregion //#region src/transformers/notation-diff.d.ts export interface TransformerNotationDiffOptions extends MatchAlgorithmOptions { /** * Class for added lines */ classLineAdd?: string; /** * Class for removed lines */ classLineRemove?: string; /** * Class added to the
element when the current code has diff
*/
classActivePre?: string;
/**
* Class added to the element when the current code has diff
*/
classActiveCode?: string;
}
/**
* Use `[!code ++]` and `[!code --]` to mark added and removed lines.
*/
export declare function transformerNotationDiff(options?: TransformerNotationDiffOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/notation-error-level.d.ts
export interface TransformerNotationErrorLevelOptions extends MatchAlgorithmOptions {
classMap?: Record;
/**
* Class added to the element when the current code has diff
*/
classActivePre?: string;
/**
* Class added to the element when the current code has diff
*/
classActiveCode?: string;
}
/**
* Allow using `[!code error]` `[!code warning]` notation in code to mark highlighted lines.
*/
export declare function transformerNotationErrorLevel(options?: TransformerNotationErrorLevelOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/notation-focus.d.ts
export interface TransformerNotationFocusOptions extends MatchAlgorithmOptions {
/**
* Class for focused lines
*/
classActiveLine?: string;
/**
* Class added to the root element when the code has focused lines
*/
classActivePre?: string;
/**
* Class added to the element when the code has focused lines
*/
classActiveCode?: string;
}
/**
* Allow using `[!code focus]` notation in code to mark focused lines.
*/
export declare function transformerNotationFocus(options?: TransformerNotationFocusOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/notation-highlight.d.ts
export interface TransformerNotationHighlightOptions extends MatchAlgorithmOptions {
/**
* Class for highlighted lines
*/
classActiveLine?: string;
/**
* Class added to the root element when the code has highlighted lines
*/
classActivePre?: string;
/**
* Class added to the element when the code has highlighted lines
*/
classActiveCode?: string;
}
/**
* Allow using `[!code highlight]` notation in code to mark highlighted lines.
*/
export declare function transformerNotationHighlight(options?: TransformerNotationHighlightOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/notation-highlight-word.d.ts
export interface TransformerNotationWordHighlightOptions extends MatchAlgorithmOptions {
/**
* Class for highlighted words
*/
classActiveWord?: string;
/**
* Class added to the root element when the code has highlighted words
*/
classActivePre?: string;
/**
* Class added to the element when the code has highlighted words
*/
classActiveCode?: string;
}
export declare function transformerNotationWordHighlight(options?: TransformerNotationWordHighlightOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/notation-map.d.ts
export interface TransformerNotationMapOptions extends MatchAlgorithmOptions {
classMap?: Record;
/**
* Class added to the element when the current code has diff
*/
classActivePre?: string;
/**
* Class added to the element when the current code has diff
*/
classActiveCode?: string;
}
export declare function transformerNotationMap(options?: TransformerNotationMapOptions, name?: string): ShikiTransformer$1;
//#endregion
//#region src/transformers/remove-comments.d.ts
export interface TransformerRemoveCommentsOptions {
/**
* Remove lines that become empty after removing comments.
* @default true
*/
removeEmptyLines?: boolean;
}
/**
* Remove comments from the code.
*/
export declare function transformerRemoveComments(options?: TransformerRemoveCommentsOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/remove-line-breaks.d.ts
/**
* Remove line breaks between lines.
* Useful when you override `display: block` to `.line` in CSS.
*/
export declare function transformerRemoveLineBreak(): ShikiTransformer$1;
//#endregion
//#region src/transformers/remove-notation-escape.d.ts
/**
* Remove notation escapes.
* Useful when you want to write `// [!code` in markdown.
* If you process `// [\!code ...]` expression, you can get `// [!code ...]` in the output.
*/
export declare function transformerRemoveNotationEscape(): ShikiTransformer$1;
//#endregion
//#region src/transformers/render-indent-guides.d.ts
export interface TransformerRenderIndentGuidesOptions {
indent?: number | false;
}
/**
* Render indentations as separate tokens.
* Apply with CSS, it can be used to render indent guides visually.
*/
export declare function transformerRenderIndentGuides(options?: TransformerRenderIndentGuidesOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/render-line-number.d.ts
export interface TransformerRenderLineNumberOptions {
/**
* Class for line number
* @default 'line-number'
*/
classLineNumber?: string;
/**
* Start number
* @default 1
*/
start?: number;
}
/**
* Render line number as separate tokens.
*
* @param options
*/
export declare function transformerRenderLineNumber(options?: TransformerRenderLineNumberOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/render-whitespace.d.ts
export interface TransformerRenderWhitespaceOptions {
/**
* Class for tab
*
* @default 'tab'
*/
classTab?: string;
/**
* Class for space
*
* @default 'space'
*/
classSpace?: string;
/**
* Position of rendered whitespace
* @default all position
*/
position?: 'all' | 'boundary' | 'trailing' | 'leading';
}
/**
* Render whitespaces as separate tokens.
* Apply with CSS, it can be used to render tabs and spaces visually.
*/
export declare function transformerRenderWhitespace(options?: TransformerRenderWhitespaceOptions): ShikiTransformer$1;
//#endregion
//#region src/transformers/style-to-class.d.ts
export interface TransformerStyleToClassOptions {
/**
* Prefix for class names.
* @default '__shiki_'
*/
classPrefix?: string;
/**
* Suffix for class names.
* @default ''
*/
classSuffix?: string;
/**
* Callback to replace class names.
* @default (className) => className
*/
classReplacer?: (className: string) => string;
}
export interface ShikiTransformerStyleToClass extends ShikiTransformer$1 {
getClassRegistry: () => Map | string>;
getCSS: () => string;
clearRegistry: () => void;
}
/**
* Remove line breaks between lines.
* Useful when you override `display: block` to `.line` in CSS.
*/
export declare function transformerStyleToClass(options?: TransformerStyleToClassOptions): ShikiTransformerStyleToClass;
//#endregion