Markdown Front-End Rendering

Last modified by Manuel Leduc on 2026/03/23 11:23

Reference

Provides the parsers and serializers from Markdown.

Package name: @xwiki/platform-uniast-markdown

Exposed components

  • MarkdownToUniAstConverter with identifier markdownToUniAstConverterName
  • UniAstToMarkdownConverter with identifier uniAstToMarkdownConverterName

Exported interfaces

XWiki 18.2.0+

InternalLinksSerializer

A component that is expected to be implemented by backends, defining how links and images are serialized

Existing implementations:

  • @xwiki/platform-uniast-markdown-xwiki

API Extractor

import { Container } from 'inversify';
import { InlineContent } from '@xwiki/platform-uniast-api';
import { Link } from '@xwiki/platform-uniast-api';
import { LinkTarget } from '@xwiki/platform-uniast-api';
import { UniAst } from '@xwiki/platform-uniast-api';

// @beta (undocumented)
export class ComponentInit {
    constructor(container: Container);
}

// @beta
export interface InternalLinksSerializer {
    serialize(content: Link["content"], target: Extract<LinkTarget, {
        type: "internal";
    }>, uniAstToMarkdownConverter: UniAstToMarkdownConverter): Promise<string>;
    serializeImage(target: Extract<LinkTarget, {
        type: "internal";
    }>, alt?: string): Promise<string>;
}

// @beta
export interface MarkdownToUniAstConverter {
    parseMarkdown(markdown: string): Promise<UniAst | Error>;
}

// @beta (undocumented)
export const markdownToUniAstConverterName = "MarkdownToUniAstConverter";

// @beta
export interface UniAstToMarkdownConverter {
    convertInlineContents(inlineContents: InlineContent[]): Promise<string | Error>;
    toMarkdown(uniAst: UniAst): Promise<string | Error>;
    toMarkdown(uniAst: UniAst): Promise<string | Error>;
}

// @beta (undocumented)
export const uniAstToMarkdownConverterName = "UniAstToMarkdownConverter";

Related

Front-end rendering API reference

Get Connected