Wiki source code of Markdown Front-End Rendering

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

Hide last authors
Manuel Leduc 3.2 1 Provides the parsers and serializers from Markdown.
Manuel Leduc 3.1 2
Manuel Leduc 8.1 3 Package name: ##@xwiki/platform-uniast-markdown##
Manuel Leduc 2.1 4
5 == Exposed components ==
6
Manuel Leduc 3.4 7 * ##MarkdownToUniAstConverter## with identifier ##markdownToUniAstConverterName##
8 * ##UniAstToMarkdownConverter## with identifier ##uniAstToMarkdownConverterName##
Manuel Leduc 2.1 9
Manuel Leduc 12.1 10 == Exported interfaces ==
11
12 {{version since='18.2.0RC1'}}
13 === InternalLinksSerializer ===
14 A component that is expected to be implemented by backends, defining how links and images are serialized
15
16 Existing implementations:
17 * ##@xwiki/platform-uniast-markdown-xwiki##
18 {{/version}}
19
20 == API Extractor
21
Manuel Leduc 2.1 22 {{code language="typescript"}}
23 import { Container } from 'inversify';
Manuel Leduc 6.1 24 import { InlineContent } from '@xwiki/platform-uniast-api';
Manuel Leduc 12.1 25 import { Link } from '@xwiki/platform-uniast-api';
26 import { LinkTarget } from '@xwiki/platform-uniast-api';
Manuel Leduc 6.1 27 import { UniAst } from '@xwiki/platform-uniast-api';
Manuel Leduc 2.1 28
Manuel Leduc 12.1 29 // @beta (undocumented)
Manuel Leduc 2.1 30 export class ComponentInit {
31 constructor(container: Container);
32 }
33
34 // @beta
Manuel Leduc 12.1 35 export interface InternalLinksSerializer {
36 serialize(content: Link["content"], target: Extract<LinkTarget, {
37 type: "internal";
38 }>, uniAstToMarkdownConverter: UniAstToMarkdownConverter): Promise<string>;
39 serializeImage(target: Extract<LinkTarget, {
40 type: "internal";
41 }>, alt?: string): Promise<string>;
42 }
43
44 // @beta
Manuel Leduc 2.1 45 export interface MarkdownToUniAstConverter {
46 parseMarkdown(markdown: string): Promise<UniAst | Error>;
47 }
48
Manuel Leduc 12.1 49 // @beta (undocumented)
Manuel Leduc 2.1 50 export const markdownToUniAstConverterName = "MarkdownToUniAstConverter";
51
52 // @beta
53 export interface UniAstToMarkdownConverter {
Clément Eraud 4.1 54 convertInlineContents(inlineContents: InlineContent[]): Promise<string | Error>;
Manuel Leduc 2.1 55 toMarkdown(uniAst: UniAst): Promise<string | Error>;
Manuel Leduc 8.1 56 toMarkdown(uniAst: UniAst): Promise<string | Error>;
Manuel Leduc 2.1 57 }
58
Manuel Leduc 12.1 59 // @beta (undocumented)
Manuel Leduc 2.1 60 export const uniAstToMarkdownConverterName = "UniAstToMarkdownConverter";
61 {{/code}}

Get Connected