Front-End Rendering API
Last modified by Manuel Leduc on 2026/02/05 17:22
Content
Reference
Package name @xwiki/platform-uniast-api.
Provides the APIs for the common abstract representation of syntaxes.
import type { EntityReference } from '@xwiki/platform-model-api';
// @beta
export type Alignment = "left" | "center" | "right" | "justify";
// @beta
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";
call: MacroInvocation;
};
// @beta
export type BlockStyles = {
textColor?: string;
backgroundColor?: string;
textAlignment?: Alignment;
};
// @beta
type Image_2 = {
target: LinkTarget;
caption?: string;
alt?: string;
widthPx?: number;
heightPx?: number;
styles: {
alignment?: Alignment;
};
};
export { Image_2 as Image }
// @beta
export type InlineContent = ({
type: "text";
} & Text_2) | ({
type: "image";
} & Image_2) | ({
type: "link";
} & Link) | {
type: "inlineMacro";
call: MacroInvocation;
};
// @beta
export type Link = {
target: LinkTarget;
content: Exclude<InlineContent, {
type: "link";
}>[];
};
// @beta
export type LinkTarget = {
type: "internal";
rawReference: string;
parsedReference: EntityReference | null;
} | {
type: "external";
url: string;
};
// @beta
export type ListItem = {
number?: number;
checked?: boolean;
content: Block[];
styles: BlockStyles;
};
// @beta
export type MacroInvocation = {
id: string;
params: Record<string, boolean | number | string>;
body: {
type: "none";
} | {
type: "raw";
content: string;
} | {
type: "inlineContents";
inlineContents: InlineContent[];
} | {
type: "inlineContent";
inlineContent: InlineContent;
};
};
// @beta
export type TableCell = {
content: InlineContent[];
styles: BlockStyles;
rowSpan?: number;
colSpan?: number;
};
// @beta
export type TableColumn = {
headerCell?: TableCell;
widthPx?: number;
};
// @beta
type Text_2 = {
content: string;
styles: TextStyles;
};
export { Text_2 as Text }
// @beta
export type TextStyles = {
bold?: boolean;
italic?: boolean;
strikethrough?: boolean;
underline?: boolean;
code?: boolean;
textColor?: string;
backgroundColor?: string;
};
// @beta
export type UniAst = {
blocks: Block[];
};