srs-document/node_modules/@unified-latex/unified-latex-prettier/libs/printer/common.d.ts
2025-03-24 15:42:48 +07:00

62 lines
2.2 KiB
TypeScript

import { builders } from "prettier/doc";
import type { Doc } from "prettier";
import * as Ast from "@unified-latex/unified-latex-types";
import * as PrettierTypes from "./prettier-types";
import { ReferenceMap } from "../reference-map";
/**
* Computes the environment name, start/end, and args.
* E.g., for "\begin{x}abc\end{x}", it returns
* ```
* {
* envName: "x",
* start: "\\begin{x}",
* end: "\\end{x}",
* }
* ```
*
* @param {*} node
* @returns
*/
export declare function formatEnvSurround(node: Ast.Environment): {
envName: string;
start: string;
end: string;
};
/**
* Join an array with `softline`. However, if a `line` is
* found, do not insert an additional softline. For example
* `[a, b, c]` -> `[a, softline, b, softline, c]`
*
* but
*
* `[a, line, b, c]` -> `[a, line, b, softline, c]`
*
* @param {*} arr
* @returns
*/
export declare function joinWithSoftline(arr: Doc[]): builders.Doc[];
export declare function getNodeInfo(node: any, options: PrettierTypes.Options & {
referenceMap?: ReferenceMap;
}): {
renderInfo: Record<string, any>;
renderCache?: object;
previousNode?: Ast.Node;
nextNode?: Ast.Node;
referenceMap?: ReferenceMap;
};
export declare const ESCAPE = "\\";
export declare const group: typeof builders.group, fill: typeof builders.fill, ifBreak: typeof builders.ifBreak, line: builders.Line, softline: builders.Softline, hardline: builders.Hardline, lineSuffix: typeof builders.lineSuffix, lineSuffixBoundary: builders.LineSuffixBoundary, breakParent: builders.BreakParent, indent: typeof builders.indent, markAsRoot: typeof builders.markAsRoot, join: typeof builders.join;
/**
* Given an array of nodes and the corresponding printed versions, prepares
* a final Doc array. This function does things like ensures there are `hardlines`
* around environments and that there aren't excess hardlines at the start or end.
* It also unwraps `inParMode` macro contents.
*
* @export
* @param {Ast.Node[]} nodes
* @param {Doc[]} docArray
* @param {*} options
* @returns {Doc[]}
*/
export declare function formatDocArray(nodes: Ast.Node[], docArray: Doc[], options: any): Doc[];
//# sourceMappingURL=common.d.ts.map