UniAST - API
Version 1.1 by Manuel Leduc on 2025/09/17 10:24
Description
Developper
Reference
import type { EntityReference } from '@xwiki/cristal-model-api';
// @beta (undocumented)
export type Alignment = "left" | "center" | "right" | "justify";
// @beta (undocumented)
export type Block = {
type: "paragraph";
styles: BlockStyles;
content: InlineContent[];
} | {
type: "heading";
level: 1 | 2 | 3 | 4 | 5 | 6;
content: InlineContent[];
styles: BlockStyles;
} | {
type: "list";
items: ListItem[];
styles: BlockStyles;
} | {
type: "quote";
content: Block[];
styles: BlockStyles;
} | {
type: "code";
language?: string;
content: string;
} | {
type: "table";
columns: TableColumn[];
rows: TableCell[][];
styles: BlockStyles;
} | ({
type: "image";
} & Image_2) | {
type: "break";
} | {
type: "macroBlock";
name: string;
params: Record<string, boolean | number | string>;
};
// @beta (undocumented)
export type BlockStyles = {
textColor?: string;
backgroundColor?: string;
textAlignment?: Alignment;
};
// @beta (undocumented)
type Image_2 = {
target: LinkTarget;
caption?: string;
alt?: string;
widthPx?: number;
heightPx?: number;
styles: {
alignment?: Alignment;
};
};
export { Image_2 as Image }
// @beta (undocumented)
export type InlineContent = ({
type: "text";
} & Text_2) | ({
type: "image";
} & Image_2) | ({
type: "link";
} & Link) | {
type: "inlineMacro";
name: string;
params: Record<string, boolean | number | string>;
};
// @beta (undocumented)
export type Link = {
target: LinkTarget;
content: Exclude<InlineContent, {
type: "link";
}>[];
};
// @beta (undocumented)
export type LinkTarget = {
type: "internal";
rawReference: string;
parsedReference: EntityReference | null;
} | {
type: "external";
url: string;
};
// @beta (undocumented)
export type ListItem = {
number?: number;
checked?: boolean;
content: Block[];
styles: BlockStyles;
};
// @beta (undocumented)
export type TableCell = {
content: InlineContent[];
styles: BlockStyles;
rowSpan?: number;
colSpan?: number;
};
// @beta (undocumented)
export type TableColumn = {
headerCell?: TableCell;
widthPx?: number;
};
// @beta (undocumented)
type Text_2 = {
content: string;
styles: TextStyles;
};
export { Text_2 as Text }
// @beta (undocumented)
export type TextStyles = {
bold?: boolean;
italic?: boolean;
strikethrough?: boolean;
underline?: boolean;
code?: boolean;
textColor?: string;
backgroundColor?: string;
};
// @beta (undocumented)
export type UniAst = {
blocks: Block[];
};