- Prop
source- Type
string | undefined- Default
- —
- Requirement
- optional
Docs Components Uncategorized
Markdown
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Markdown } from "@grassroot/ui-react"; const source = `## Release notes The renderer keeps **structure** and \`code\` safe. > [!NOTE]> This callout is parsed into a semantic render part. - [x] CommonMark and GFM- [ ] Editor round-trip | Layer | Responsibility || --- | --- || Core | AST and diagnostics || Adapter | Framework markup | [^1]: Footnotes stay addressable after rendering.`; export default function MarkdownDemo() { return <Markdown source={source} options={{ gfm: true, footnotes: true, callouts: true }} />;}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { Markdown } from "@grassroot/ui-vue"; const source = `## Release notes The renderer keeps **structure** and \`code\` safe. > [!NOTE]> This callout is parsed into a semantic render part. - [x] CommonMark and GFM- [ ] Editor round-trip | Layer | Responsibility || --- | --- || Core | AST and diagnostics || Adapter | Framework markup | [^1]: Footnotes stay addressable after rendering.`; const options = { gfm: true, footnotes: true, callouts: true };</script> <template> <Markdown :source="source" :options="options" /></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";import { GrassrootMarkdown } from "@grassroot/ui-angular"; @Component({ selector: "app-markdown-demo", standalone: true, imports: [GrassrootMarkdown], host: { style: "display: contents" }, template: `<grassroot-markdown [source]="source" [options]="options" />`,})export class MarkdownDemoComponent { protected readonly source = `## Release notes The renderer keeps **structure** and \`code\` safe. > [!NOTE]> This callout is parsed into a semantic render part. - [x] CommonMark and GFM- [ ] Editor round-trip | Layer | Responsibility || --- | --- || Core | AST and diagnostics || Adapter | Framework markup | [^1]: Footnotes stay addressable after rendering.`; protected readonly options = { gfm: true, footnotes: true, callouts: true };} export default MarkdownDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { Markdown } from "@grassroot/ui-svelte"; const source = `## Release notes The renderer keeps **structure** and \`code\` safe. > [!NOTE]> This callout is parsed into a semantic render part. - [x] CommonMark and GFM- [ ] Editor round-trip | Layer | Responsibility || --- | --- || Core | AST and diagnostics || Adapter | Framework markup | [^1]: Footnotes stay addressable after rendering.`; const options = { gfm: true, footnotes: true, callouts: true };</script> <Markdown {source} {options} />- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Markdown } from "@grassroot/ui-solid"; const source = `## Release notes The renderer keeps **structure** and \`code\` safe. > [!NOTE]> This callout is parsed into a semantic render part. - [x] CommonMark and GFM- [ ] Editor round-trip | Layer | Responsibility || --- | --- || Core | AST and diagnostics || Adapter | Framework markup | [^1]: Footnotes stay addressable after rendering.`; export default function MarkdownDemo() { return <Markdown source={source} options={{ gfm: true, footnotes: true, callouts: true }} />;}Installation
API Reference
Import
import { Markdown } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
sourcestring | undefined—
optional
astimport("@grassroot/ui-headless-core").MarkdownDocument | undefined—
optional
optionsimport("@grassroot/ui-headless-core").ParseOptions | undefined—
optional
componentsPartial<Record<import("@grassroot/ui-headless-core").MarkdownNodeType, React.ComponentType<MarkdownComponentProps>>> | undefined—
optional
codeReadonly<Record<string, React.ComponentType<MarkdownComponentProps>>> | undefined—
optional
highlight((code: string, lang: string | undefined) => readonly import("@grassroot/ui-headless-core").HighlightToken[]) | undefined—
optional
dir"auto" | "ltr" | "rtl" | undefined—
optional
classNamestring | undefined—
optional
- Prop
ast- Type
import("@grassroot/ui-headless-core").MarkdownDocument | undefined- Default
- —
- Requirement
- optional
- Prop
options- Type
import("@grassroot/ui-headless-core").ParseOptions | undefined- Default
- —
- Requirement
- optional
- Prop
components- Type
Partial<Record<import("@grassroot/ui-headless-core").MarkdownNodeType, React.ComponentType<MarkdownComponentProps>>> | undefined- Default
- —
- Requirement
- optional
- Prop
code- Type
Readonly<Record<string, React.ComponentType<MarkdownComponentProps>>> | undefined- Default
- —
- Requirement
- optional
- Prop
highlight- Type
((code: string, lang: string | undefined) => readonly import("@grassroot/ui-headless-core").HighlightToken[]) | undefined- Default
- —
- Requirement
- optional
- Prop
dir- Type
"auto" | "ltr" | "rtl" | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Import
import { Markdown } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
sourcestring | undefined""optional
astMarkdownDocument | undefined—
optional
optionsParseOptions | undefined—
optional
componentsPartial<Record<MarkdownNodeType, Component>> | undefined—
optional
codeReadonly<Record<string, Component>> | undefined—
optional
highlight((code: string, lang: string | undefined) => readonly HighlightToken[]) | undefined—
optional
dir"ltr" | "rtl" | "auto" | undefined—
optional
classNamestring | undefined—
optional
- Prop
source- Type
string | undefined- Default
""- Requirement
- optional
- Prop
ast- Type
MarkdownDocument | undefined- Default
- —
- Requirement
- optional
- Prop
options- Type
ParseOptions | undefined- Default
- —
- Requirement
- optional
- Prop
components- Type
Partial<Record<MarkdownNodeType, Component>> | undefined- Default
- —
- Requirement
- optional
- Prop
code- Type
Readonly<Record<string, Component>> | undefined- Default
- —
- Requirement
- optional
- Prop
highlight- Type
((code: string, lang: string | undefined) => readonly HighlightToken[]) | undefined- Default
- —
- Requirement
- optional
- Prop
dir- Type
"ltr" | "rtl" | "auto" | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Import
import { Component } from "@angular/core";
import { GrassrootMarkdown } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
sourcestring""optional
astMarkdownDocument—
optional
optionsParseOptions—
optional
componentsPartial<Record<MarkdownNodeType, unknown>>—
optional
codeReadonly<Record<string, unknown>>—
optional
highlight(code: string, lang: string | undefined) => readonly HighlightToken[]—
optional
dir"ltr" | "rtl" | "auto"—
optional
classNamestring—
optional
- Prop
source- Type
string- Default
""- Requirement
- optional
- Prop
ast- Type
MarkdownDocument- Default
- —
- Requirement
- optional
- Prop
options- Type
ParseOptions- Default
- —
- Requirement
- optional
- Prop
components- Type
Partial<Record<MarkdownNodeType, unknown>>- Default
- —
- Requirement
- optional
- Prop
code- Type
Readonly<Record<string, unknown>>- Default
- —
- Requirement
- optional
- Prop
highlight- Type
(code: string, lang: string | undefined) => readonly HighlightToken[]- Default
- —
- Requirement
- optional
- Prop
dir- Type
"ltr" | "rtl" | "auto"- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Import
import { Markdown } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
sourcestring""optional
astMarkdownDocument—
optional
optionsParseOptions—
optional
componentsPartial<Record<MarkdownNodeType, unknown>>—
optional
codeReadonly<Record<string, unknown>>—
optional
highlight(code: string, lang: string | undefined) => readonly HighlightToken[]—
optional
dir"ltr" | "rtl" | "auto"—
optional
classNamestring—
optional
- Prop
source- Type
string- Default
""- Requirement
- optional
- Prop
ast- Type
MarkdownDocument- Default
- —
- Requirement
- optional
- Prop
options- Type
ParseOptions- Default
- —
- Requirement
- optional
- Prop
components- Type
Partial<Record<MarkdownNodeType, unknown>>- Default
- —
- Requirement
- optional
- Prop
code- Type
Readonly<Record<string, unknown>>- Default
- —
- Requirement
- optional
- Prop
highlight- Type
(code: string, lang: string | undefined) => readonly HighlightToken[]- Default
- —
- Requirement
- optional
- Prop
dir- Type
"ltr" | "rtl" | "auto"- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Import
import { Markdown } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
sourcestring—
optional
astMarkdownAst—
optional
optionsMarkdownOptions—
optional
componentsHeadlessMarkdownProps["components"]—
optional
codeHeadlessMarkdownProps["code"]—
optional
highlightHeadlessMarkdownProps["highlight"]—
optional
dir"ltr" | "rtl" | "auto"—
optional
classNamestring—
optional
- Prop
source- Type
string- Default
- —
- Requirement
- optional
- Prop
ast- Type
MarkdownAst- Default
- —
- Requirement
- optional
- Prop
options- Type
MarkdownOptions- Default
- —
- Requirement
- optional
- Prop
components- Type
HeadlessMarkdownProps["components"]- Default
- —
- Requirement
- optional
- Prop
code- Type
HeadlessMarkdownProps["code"]- Default
- —
- Requirement
- optional
- Prop
highlight- Type
HeadlessMarkdownProps["highlight"]- Default
- —
- Requirement
- optional
- Prop
dir- Type
"ltr" | "rtl" | "auto"- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional