/** * Creole and HTML-like markup used in PlantUML labels, converted into a small * rich-text model that the drawing layer can measure and render. * @module syntax/creole */ export type Run = { text: string; bold?: boolean; italic?: boolean; mono?: boolean; strike?: boolean; underline?: boolean; wave?: boolean; color?: string; background?: string; /** * Absolute font size override. */ size?: number; script?: "sub" | "sup"; link?: string; }; export type Block = { kind: "line" | "bullet" | "numbered" | "heading" | "hr" | "table"; runs: Run[]; /** * Nesting level for lists / heading level. */ level?: number; /** * Item number for numbered lists. */ number?: number; /** * Table rows. */ rows?: { header: boolean; cells: Run[][]; }[]; }; export type RichText = { blocks: Block[]; }; export type Style = Omit; /** * Parse a label into rich text. Plain labels without markup produce one * `line` block per text line with a single run. * @param {string} text * @returns {RichText} * @public */ export declare function parseCreole(text: string): RichText; /** * Parse inline markup into runs. * @param {string} text * @param {Style} [base] * @returns {Run[]} */ export declare function parseInline(text: string, base?: Style): Run[]; /** * Plain text of rich text (markup stripped). * @param {RichText} rich * @returns {string} */ export declare function plainText(rich: RichText): string; /** @param {Run[]} runs */ export declare function runsText(runs: Run[]): string; /** * Strip creole markup from a string (convenience). * @param {string} text */ export declare function stripMarkup(text: string): string;