- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
DocsAPI referenceHeadlessmarkdown
markdown headless API
The core connector and vanilla mount are always visible. Use the framework choice to inspect native composition, props, outputs, context and hooks for the selected adapter.
@grassroot/ui-headless-core/markdown
Core connector and vanilla API
astToEditorNodes
functiondeclare function astToEditorNodes(document: MarkdownDocument): readonly EditorBridgeNode[];documentMarkdownDocumentreturnreadonly EditorBridgeNode[]- Name
return- Kind
- return value
- Type
readonly EditorBridgeNode[]- Requirement
- n/a
BlockNode
typetype BlockNode = { readonly id: string; readonly type: Exclude<MarkdownNodeType, "document" | "text" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "hard-break">; readonly raw: string; readonly position?: Position; readonly text?: string; readonly level?: number; readonly lang?: string; readonly meta?: string; readonly ordered?: boolean; readonly start?: number; readonly tight?: boolean; readonly checked?: boolean; readonly align?: readonly ("left" | "center" | "right" | null)[]; readonly cells?: readonly (readonly InlineNode[])[]; readonly children?: readonly (BlockNode | InlineNode)[];};alignreadonly ("left" | "center" | "right" | null)[]cellsreadonly (readonly InlineNode[])[]checkedbooleanchildrenreadonly (BlockNode | InlineNode)[]idstringlangstringlevelnumbermetastringorderedbooleanpositionPositionrawstringstartnumbertextstringtightboolean- Name
align- Kind
- property
- Type
readonly ("left" | "center" | "right" | null)[]- Requirement
- optional
- Name
cells- Kind
- property
- Type
readonly (readonly InlineNode[])[]- Requirement
- optional
- Name
checked- Kind
- property
- Type
boolean- Requirement
- optional
- Name
children- Kind
- property
- Type
readonly (BlockNode | InlineNode)[]- Requirement
- optional
- Name
id- Kind
- property
- Type
string- Requirement
- required
- Name
lang- Kind
- property
- Type
string- Requirement
- optional
- Name
level- Kind
- property
- Type
number- Requirement
- optional
- Name
meta- Kind
- property
- Type
string- Requirement
- optional
- Name
ordered- Kind
- property
- Type
boolean- Requirement
- optional
- Name
position- Kind
- property
- Type
Position- Requirement
- optional
- Name
raw- Kind
- property
- Type
string- Requirement
- required
- Name
start- Kind
- property
- Type
number- Requirement
- optional
- Name
text- Kind
- property
- Type
string- Requirement
- optional
- Name
tight- Kind
- property
- Type
boolean- Requirement
- optional
- Name
type- Kind
- property
- Type
Exclude<MarkdownNodeType, "document" | "text" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "hard-break">- Requirement
- required
collectDiagnostics
functiondeclare function collectDiagnostics(document: MarkdownDocument, code?: MarkdownDiagnosticCode | string): readonly MarkdownDiagnostic[];documentMarkdownDocumentcodeMarkdownDiagnosticCode | stringreturnreadonly MarkdownDiagnostic[]- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
code- Kind
- parameter
- Type
MarkdownDiagnosticCode | string- Requirement
- optional
- Name
return- Kind
- return value
- Type
readonly MarkdownDiagnostic[]- Requirement
- n/a
computeBlockId
functiondeclare function computeBlockId(ordinal: number, rawSourceSlice: string): string;ordinalnumberrawSourceSlicestringreturnstring- Name
ordinal- Kind
- parameter
- Type
number- Requirement
- required
- Name
rawSourceSlice- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
string- Requirement
- n/a
EDITOR_MARK_TYPES
valueexport declare const EDITOR_MARK_TYPES: readonly ["bold", "italic", "code", "strike", "link"];EDITOR_NODE_TYPES
valueexport declare const EDITOR_NODE_TYPES: readonly ["doc", "paragraph", "heading", "list", "listItem", "blockquote", "codeBlock", "hr", "image", "text", "hardBreak"];EditorBridgeNode
interfaceinterface EditorBridgeNode { readonly type: string; readonly attrs?: Readonly<Record<string, unknown>>; readonly marks?: readonly { readonly type: string; readonly attrs?: Readonly<Record<string, unknown>>; }[]; readonly text?: string; readonly children?: readonly EditorBridgeNode[];}attrsReadonly<Record<string, unknown>>childrenreadonly EditorBridgeNode[]marksreadonly {
readonly type: string;
readonly attrs?: Readonly<Record<string, unknown>>;
}[]textstringtypestring- Name
attrs- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- optional
- Name
children- Kind
- property
- Type
readonly EditorBridgeNode[]- Requirement
- optional
- Name
marks- Kind
- property
- Type
readonly { readonly type: string; readonly attrs?: Readonly<Record<string, unknown>>; }[]- Requirement
- optional
- Name
text- Kind
- property
- Type
string- Requirement
- optional
- Name
type- Kind
- property
- Type
string- Requirement
- required
editorNodesToAst
functiondeclare function editorNodesToAst(nodes: readonly EditorBridgeNode[]): MarkdownDocument;nodesreadonly EditorBridgeNode[]returnMarkdownDocument- Name
nodes- Kind
- parameter
- Type
readonly EditorBridgeNode[]- Requirement
- required
- Name
return- Kind
- return value
- Type
MarkdownDocument- Requirement
- n/a
fnv1a32
functionFNV-1a 32-bit, used deliberately instead of a dependency for stable ids.
declare function fnv1a32(value: string): string;valuestringreturnstring- Name
value- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
string- Requirement
- n/a
getBlockById
functiondeclare function getBlockById(document: MarkdownDocument, id: string): BlockNode | undefined;documentMarkdownDocumentidstringreturnBlockNode | undefined- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
id- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
BlockNode | undefined- Requirement
- n/a
getBlocksByType
functiondeclare function getBlocksByType(document: MarkdownDocument, type: BlockNode["type"]): readonly BlockNode[];documentMarkdownDocumenttypeBlockNode["type"]returnreadonly BlockNode[]- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
type- Kind
- parameter
- Type
BlockNode["type"]- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly BlockNode[]- Requirement
- n/a
getFootnoteDefinition
functiondeclare function getFootnoteDefinition(document: MarkdownDocument, identifier: string): BlockNode | undefined;documentMarkdownDocumentidentifierstringreturnBlockNode | undefined- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
identifier- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
BlockNode | undefined- Requirement
- n/a
hasInteractiveNodes
functiondeclare function hasInteractiveNodes(document: MarkdownDocument): boolean;documentMarkdownDocumentreturnboolean- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
return- Kind
- return value
- Type
boolean- Requirement
- n/a
HighlightToken
typeHighlighters may return their native `content`/`type` shape or the public CodeBlock `text`/`tone` shape. Both are normalised into render tokens.
type HighlightToken = { readonly text: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;} | { readonly content: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;};IncrementalState
interfaceinterface IncrementalState { readonly source: string; readonly blocks: readonly BlockNode[]; readonly openBlockStart: number;}blocksreadonly BlockNode[]openBlockStartnumbersourcestring- Name
blocks- Kind
- property
- Type
readonly BlockNode[]- Requirement
- required
- Name
openBlockStart- Kind
- property
- Type
number- Requirement
- required
- Name
source- Kind
- property
- Type
string- Requirement
- required
InlineNode
typetype InlineNode = { readonly type: Extract<MarkdownNodeType, "text" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "hard-break" | "html-blocked">; readonly raw: string; readonly position?: Position; readonly text?: string; readonly url?: string; readonly title?: string; readonly label?: string; readonly identifier?: string; readonly children?: readonly InlineNode[];};childrenreadonly InlineNode[]identifierstringlabelstringpositionPositionrawstringtextstringtitlestringtypeExtract<MarkdownNodeType, "text" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "hard-break" | "html-blocked">urlstring- Name
children- Kind
- property
- Type
readonly InlineNode[]- Requirement
- optional
- Name
identifier- Kind
- property
- Type
string- Requirement
- optional
- Name
label- Kind
- property
- Type
string- Requirement
- optional
- Name
position- Kind
- property
- Type
Position- Requirement
- optional
- Name
raw- Kind
- property
- Type
string- Requirement
- required
- Name
text- Kind
- property
- Type
string- Requirement
- optional
- Name
title- Kind
- property
- Type
string- Requirement
- optional
- Name
type- Kind
- property
- Type
Extract<MarkdownNodeType, "text" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "hard-break" | "html-blocked">- Requirement
- required
- Name
url- Kind
- property
- Type
string- Requirement
- optional
listHeadings
functiondeclare function listHeadings(document: MarkdownDocument): readonly { readonly id: string; readonly level: 1 | 2 | 3 | 4 | 5 | 6; readonly text: string;}[];documentMarkdownDocumentreturnreadonly {
readonly id: string;
readonly level: 1 | 2 | 3 | 4 | 5 | 6;
readonly text: string;
}[]- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
return- Kind
- return value
- Type
readonly { readonly id: string; readonly level: 1 | 2 | 3 | 4 | 5 | 6; readonly text: string; }[]- Requirement
- n/a
MarkdownDiagnostic
typetype MarkdownDiagnostic = { readonly code: MarkdownDiagnosticCode; readonly severity: "warning" | "error"; readonly message: string; readonly data?: Readonly<Record<string, unknown>>; readonly position?: Position;};codeMarkdownDiagnosticCodedataReadonly<Record<string, unknown>>messagestringpositionPositionseverity"warning" | "error"- Name
code- Kind
- property
- Type
MarkdownDiagnosticCode- Requirement
- required
- Name
data- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- optional
- Name
message- Kind
- property
- Type
string- Requirement
- required
- Name
position- Kind
- property
- Type
Position- Requirement
- optional
- Name
severity- Kind
- property
- Type
"warning" | "error"- Requirement
- required
type MarkdownDiagnosticCode = "markdown.unsafe-url" | "markdown.unclosed-fence" | "markdown.duplicate-footnote-id" | "markdown.unresolved-footnote-ref" | "markdown.unresolved-reference-link" | "markdown.raw-html-blocked" | "markdown.callout-ambiguous";export declare const markdownDiagnosticMessages: Readonly<Record<MarkdownDiagnosticCode, string>>;MarkdownDocument
typetype MarkdownDocument = { readonly source: string; readonly blocks: readonly BlockNode[]; readonly diagnostics: readonly MarkdownDiagnostic[];};blocksreadonly BlockNode[]diagnosticsreadonly MarkdownDiagnostic[]sourcestring- Name
blocks- Kind
- property
- Type
readonly BlockNode[]- Requirement
- required
- Name
diagnostics- Kind
- property
- Type
readonly MarkdownDiagnostic[]- Requirement
- required
- Name
source- Kind
- property
- Type
string- Requirement
- required
MarkdownMount
interfaceinterface MarkdownMount { readonly document: MarkdownDocument; readonly plan: ReturnType<typeof toRenderPlan>; destroy(): void;}destroy() => voiddocumentMarkdownDocumentplanReturnType<typeof toRenderPlan>- Name
destroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
document- Kind
- property
- Type
MarkdownDocument- Requirement
- required
- Name
plan- Kind
- property
- Type
ReturnType<typeof toRenderPlan>- Requirement
- required
MarkdownNodeType
typetype MarkdownNodeType = "document" | "heading" | "paragraph" | "code-block" | "code-fence-custom" | "list" | "list-item" | "task-item" | "blockquote" | "callout" | "thematic-break" | "table" | "table-row" | "table-cell" | "details" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "footnote-def" | "hard-break" | "html-blocked" | "text";mountMarkdown
functionMounts a static Markdown render plan without a framework or HTML string sinks.
declare function mountMarkdown(container: HTMLElement, source: string, options?: MountMarkdownOptions): MarkdownMount;containerHTMLElementsourcestringoptionsMountMarkdownOptionsreturnMarkdownMount- Name
container- Kind
- parameter
- Type
HTMLElement- Requirement
- required
- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
MountMarkdownOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
MarkdownMount- Requirement
- n/a
MountMarkdownOptions
interfaceinterface MountMarkdownOptions extends ParseOptions, RenderPlanOptions { readonly ast?: MarkdownDocument; readonly dir?: "ltr" | "rtl" | "auto"; readonly className?: string;}astMarkdownDocumentclassNamestringdir"ltr" | "rtl" | "auto"- Name
ast- Kind
- property
- Type
MarkdownDocument- Requirement
- optional
- Name
className- Kind
- property
- Type
string- Requirement
- optional
- Name
dir- Kind
- property
- Type
"ltr" | "rtl" | "auto"- Requirement
- optional
parse
functiondeclare function parse(source: string, options?: ParseOptions): MarkdownDocument;sourcestringoptionsParseOptionsreturnMarkdownDocument- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
MarkdownDocument- Requirement
- n/a
parseIncremental
functiondeclare function parseIncremental(previous: IncrementalState | undefined, source: string, options?: ParseOptions): { readonly document: MarkdownDocument; readonly state: IncrementalState;};previousIncrementalState | undefinedsourcestringoptionsParseOptionsreturn{
readonly document: MarkdownDocument;
readonly state: IncrementalState;
}- Name
previous- Kind
- parameter
- Type
IncrementalState | undefined- Requirement
- required
- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
{ readonly document: MarkdownDocument; readonly state: IncrementalState; }- Requirement
- n/a
ParseOptions
interfaceinterface ParseOptions { readonly gfm?: boolean; readonly footnotes?: boolean; readonly callouts?: boolean; readonly sourcePositions?: boolean; readonly allowDataImage?: boolean;}allowDataImagebooleancalloutsbooleanfootnotesbooleangfmbooleansourcePositionsboolean- Name
allowDataImage- Kind
- property
- Type
boolean- Requirement
- optional
- Name
callouts- Kind
- property
- Type
boolean- Requirement
- optional
- Name
footnotes- Kind
- property
- Type
boolean- Requirement
- optional
- Name
gfm- Kind
- property
- Type
boolean- Requirement
- optional
- Name
sourcePositions- Kind
- property
- Type
boolean- Requirement
- optional
parseToEditorNodes
functiondeclare function parseToEditorNodes(source: string, options?: ParseOptions): readonly EditorBridgeNode[];sourcestringoptionsParseOptionsreturnreadonly EditorBridgeNode[]- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
readonly EditorBridgeNode[]- Requirement
- n/a
Position
typetype Position = { readonly start: PositionPoint; readonly end: PositionPoint;};endPositionPointstartPositionPoint- Name
end- Kind
- property
- Type
PositionPoint- Requirement
- required
- Name
start- Kind
- property
- Type
PositionPoint- Requirement
- required
PositionPoint
typetype PositionPoint = { readonly line: number; readonly column: number; readonly offset: number;};columnnumberlinenumberoffsetnumber- Name
column- Kind
- property
- Type
number- Requirement
- required
- Name
line- Kind
- property
- Type
number- Requirement
- required
- Name
offset- Kind
- property
- Type
number- Requirement
- required
RenderPlan
interfaceinterface RenderPlan { readonly nodes: readonly RenderPlanNode[]; readonly interactive: boolean;}interactivebooleannodesreadonly RenderPlanNode[]- Name
interactive- Kind
- property
- Type
boolean- Requirement
- required
- Name
nodes- Kind
- property
- Type
readonly RenderPlanNode[]- Requirement
- required
RenderPlanNode
interfaceinterface RenderPlanNode { readonly part: MarkdownNodeType; readonly props: Readonly<Record<string, unknown>>; readonly children: readonly RenderPlanNode[]; readonly key: string; readonly text?: string; readonly element?: string;}childrenreadonly RenderPlanNode[]elementstringkeystringpartMarkdownNodeTypepropsReadonly<Record<string, unknown>>textstring- Name
children- Kind
- property
- Type
readonly RenderPlanNode[]- Requirement
- required
- Name
element- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
string- Requirement
- required
- Name
part- Kind
- property
- Type
MarkdownNodeType- Requirement
- required
- Name
props- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- required
- Name
text- Kind
- property
- Type
string- Requirement
- optional
RenderPlanOptions
interfaceinterface RenderPlanOptions { readonly components?: Partial<Record<MarkdownNodeType, unknown>>; readonly code?: Readonly<Record<string, unknown>>; readonly highlight?: (code: string, lang: string | undefined) => readonly HighlightToken[];}codeReadonly<Record<string, unknown>>componentsPartial<Record<MarkdownNodeType, unknown>>highlight(code: string, lang: string | undefined) => readonly HighlightToken[]- Name
code- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- optional
- Name
components- Kind
- property
- Type
Partial<Record<MarkdownNodeType, unknown>>- Requirement
- optional
- Name
highlight- Kind
- property
- Type
(code: string, lang: string | undefined) => readonly HighlightToken[]- Requirement
- optional
RenderToken
typetype RenderToken = { readonly text: string; readonly tone?: CodeBlockTokenTone;};textstringtoneCodeBlockTokenTone- Name
text- Kind
- property
- Type
string- Requirement
- required
- Name
tone- Kind
- property
- Type
CodeBlockTokenTone- Requirement
- optional
sanitizeUrl
functiondeclare function sanitizeUrl(raw: string, options?: { readonly allowDataImage?: boolean;}): UrlSanitizeResult;rawstringoptions{
readonly allowDataImage?: boolean;
}returnUrlSanitizeResult- Name
raw- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
{ readonly allowDataImage?: boolean; }- Requirement
- optional
- Name
return- Kind
- return value
- Type
UrlSanitizeResult- Requirement
- n/a
serializeMarkdown
functiondeclare function serializeMarkdown(document: MarkdownDocument, options?: { readonly lineWidth?: number;}): string;documentMarkdownDocumentoptions{
readonly lineWidth?: number;
}returnstring- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
options- Kind
- parameter
- Type
{ readonly lineWidth?: number; }- Requirement
- optional
- Name
return- Kind
- return value
- Type
string- Requirement
- n/a
toRenderPlan
functiondeclare function toRenderPlan(document: MarkdownDocument, options?: RenderPlanOptions): RenderPlan;documentMarkdownDocumentoptionsRenderPlanOptionsreturnRenderPlan- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
options- Kind
- parameter
- Type
RenderPlanOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
RenderPlan- Requirement
- n/a
UrlSanitizeResult
typetype UrlSanitizeResult = { readonly ok: true; readonly url: string;} | { readonly ok: false; readonly reason: "unsafe-scheme" | "malformed";};Framework adapters
Each panel keeps its adapter's public vocabulary. React compound exports, Vue composables, standalone Angular declarations, Svelte components, and Solid hooks stay native to their framework.
React imports
import { Markdown } from "@grassroot/ui-headless-react/markdown";Vue imports
<script setup lang="ts">import { Markdown } from "@grassroot/ui-headless-vue/markdown";</script>Angular imports
import { Component } from "@angular/core";import { GR_MARKDOWN_DECLARATIONS } from "@grassroot/ui-headless-angular/markdown"; @Component({ standalone: true, imports: [GR_MARKDOWN_DECLARATIONS], template: `<!-- compose the markdown parts here -->` })export class Example {}Svelte imports
<script lang="ts"> import { Markdown } from "@grassroot/ui-headless-svelte/markdown";</script>Solid imports
import { Markdown } from "@grassroot/ui-headless-solid/markdown";@grassroot/ui-headless-react/markdown
React adapter
default
functionPure, SSR-safe Markdown renderer. Interactive nodes are marked in the plan; this adapter owns no service or effects.
declare function Markdown({ source, ast, options, components, code, highlight, dir, className }: MarkdownProps): ReactNode;__0MarkdownPropsreturnReactNode- Name
__0- Kind
- parameter
- Type
MarkdownProps- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
Markdown
functionPure, SSR-safe Markdown renderer. Interactive nodes are marked in the plan; this adapter owns no service or effects.
declare function Markdown({ source, ast, options, components, code, highlight, dir, className }: MarkdownProps): ReactNode;__0MarkdownPropsreturnReactNode- Name
__0- Kind
- parameter
- Type
MarkdownProps- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
type MarkdownComponentProps = Record<string, unknown> & { readonly children?: ReactNode;};childrenReactNode- Name
children- Kind
- property
- Type
ReactNode- Requirement
- optional
MarkdownComponents
typetype MarkdownComponents = Partial<Record<MarkdownNodeType, ComponentType<MarkdownComponentProps>>>;MarkdownProps
interfaceinterface MarkdownProps { readonly source?: string; readonly ast?: MarkdownDocument; readonly options?: ParseOptions; readonly components?: MarkdownComponents; readonly code?: Readonly<Record<string, ComponentType<MarkdownComponentProps>>>; readonly highlight?: (code: string, lang: string | undefined) => readonly HighlightToken[]; readonly dir?: "ltr" | "rtl" | "auto"; readonly className?: string;}astMarkdownDocumentclassNamestringcodeReadonly<Record<string, ComponentType<MarkdownComponentProps>>>componentsMarkdownComponentsdir"ltr" | "rtl" | "auto"highlight(code: string, lang: string | undefined) => readonly HighlightToken[]optionsParseOptionssourcestring- Name
ast- Kind
- property
- Type
MarkdownDocument- Requirement
- optional
- Name
className- Kind
- property
- Type
string- Requirement
- optional
- Name
code- Kind
- property
- Type
Readonly<Record<string, ComponentType<MarkdownComponentProps>>>- Requirement
- optional
- Name
components- Kind
- property
- Type
MarkdownComponents- Requirement
- optional
- Name
dir- Kind
- property
- Type
"ltr" | "rtl" | "auto"- Requirement
- optional
- Name
highlight- Kind
- property
- Type
(code: string, lang: string | undefined) => readonly HighlightToken[]- Requirement
- optional
- Name
options- Kind
- property
- Type
ParseOptions- Requirement
- optional
- Name
source- Kind
- property
- Type
string- Requirement
- optional
@grassroot/ui-headless-vue/markdown
Vue adapter
default
valueexport declare const default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ source: { type: StringConstructor; default: string; }; ast: { type: PropType<MarkdownDocument$1>; default: undefined; }; options: { type: PropType<ParseOptions$1>; default: undefined; }; components: { type: PropType<MarkdownProps["components"]>; default: () => {}; }; code: { type: PropType<MarkdownProps["code"]>; default: () => {}; }; highlight: { type: PropType<MarkdownProps["highlight"]>; default: undefined; }; dir: { type: PropType<MarkdownProps["dir"]>; default: undefined; }; className: { type: StringConstructor; default: undefined; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ source: { type: StringConstructor; default: string; }; ast: { type: PropType<MarkdownDocument$1>; default: undefined; }; options: { type: PropType<ParseOptions$1>; default: undefined; }; components: { type: PropType<MarkdownProps["components"]>; default: () => {}; }; code: { type: PropType<MarkdownProps["code"]>; default: () => {}; }; highlight: { type: PropType<MarkdownProps["highlight"]>; default: undefined; }; dir: { type: PropType<MarkdownProps["dir"]>; default: undefined; }; className: { type: StringConstructor; default: undefined; };}>> & Readonly<{}>, { source: string; ast: MarkdownDocument$1; options: ParseOptions$1; components: Partial<Record<MarkdownNodeType$1, Component>> | undefined; code: Readonly<Record<string, Component>> | undefined; highlight: ((code: string, lang: string | undefined) => readonly HighlightToken$1[]) | undefined; dir: "auto" | "ltr" | "rtl" | undefined; className: string;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;HighlightToken
typeHighlighters may return their native `content`/`type` shape or the public CodeBlock `text`/`tone` shape. Both are normalised into render tokens.
type HighlightToken = { readonly text: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;} | { readonly content: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;};Markdown
valueexport declare const Markdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ source: { type: StringConstructor; default: string; }; ast: { type: PropType<MarkdownDocument$1>; default: undefined; }; options: { type: PropType<ParseOptions$1>; default: undefined; }; components: { type: PropType<MarkdownProps["components"]>; default: () => {}; }; code: { type: PropType<MarkdownProps["code"]>; default: () => {}; }; highlight: { type: PropType<MarkdownProps["highlight"]>; default: undefined; }; dir: { type: PropType<MarkdownProps["dir"]>; default: undefined; }; className: { type: StringConstructor; default: undefined; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ source: { type: StringConstructor; default: string; }; ast: { type: PropType<MarkdownDocument$1>; default: undefined; }; options: { type: PropType<ParseOptions$1>; default: undefined; }; components: { type: PropType<MarkdownProps["components"]>; default: () => {}; }; code: { type: PropType<MarkdownProps["code"]>; default: () => {}; }; highlight: { type: PropType<MarkdownProps["highlight"]>; default: undefined; }; dir: { type: PropType<MarkdownProps["dir"]>; default: undefined; }; className: { type: StringConstructor; default: undefined; };}>> & Readonly<{}>, { source: string; ast: MarkdownDocument$1; options: ParseOptions$1; components: Partial<Record<MarkdownNodeType$1, Component>> | undefined; code: Readonly<Record<string, Component>> | undefined; highlight: ((code: string, lang: string | undefined) => readonly HighlightToken$1[]) | undefined; dir: "auto" | "ltr" | "rtl" | undefined; className: string;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;MarkdownDocument
typetype MarkdownDocument = { readonly source: string; readonly blocks: readonly BlockNode[]; readonly diagnostics: readonly MarkdownDiagnostic[];};blocksreadonly BlockNode[]diagnosticsreadonly MarkdownDiagnostic[]sourcestring- Name
blocks- Kind
- property
- Type
readonly BlockNode[]- Requirement
- required
- Name
diagnostics- Kind
- property
- Type
readonly MarkdownDiagnostic[]- Requirement
- required
- Name
source- Kind
- property
- Type
string- Requirement
- required
MarkdownNodeType
typetype MarkdownNodeType = "document" | "heading" | "paragraph" | "code-block" | "code-fence-custom" | "list" | "list-item" | "task-item" | "blockquote" | "callout" | "thematic-break" | "table" | "table-row" | "table-cell" | "details" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "footnote-def" | "hard-break" | "html-blocked" | "text";MarkdownProps
interfaceinterface MarkdownProps { readonly source?: string; readonly ast?: MarkdownDocument$1; readonly options?: ParseOptions$1; readonly components?: Partial<Record<MarkdownNodeType$1, Component>>; readonly code?: Readonly<Record<string, Component>>; readonly highlight?: (code: string, lang: string | undefined) => readonly HighlightToken$1[]; readonly dir?: "ltr" | "rtl" | "auto"; readonly className?: string;}astMarkdownDocument$1classNamestringcodeReadonly<Record<string, Component>>componentsPartial<Record<MarkdownNodeType$1, Component>>dir"ltr" | "rtl" | "auto"highlight(code: string, lang: string | undefined) => readonly HighlightToken$1[]optionsParseOptions$1sourcestring- Name
ast- Kind
- property
- Type
MarkdownDocument$1- Requirement
- optional
- Name
className- Kind
- property
- Type
string- Requirement
- optional
- Name
code- Kind
- property
- Type
Readonly<Record<string, Component>>- Requirement
- optional
- Name
components- Kind
- property
- Type
Partial<Record<MarkdownNodeType$1, Component>>- Requirement
- optional
- Name
dir- Kind
- property
- Type
"ltr" | "rtl" | "auto"- Requirement
- optional
- Name
highlight- Kind
- property
- Type
(code: string, lang: string | undefined) => readonly HighlightToken$1[]- Requirement
- optional
- Name
options- Kind
- property
- Type
ParseOptions$1- Requirement
- optional
- Name
source- Kind
- property
- Type
string- Requirement
- optional
parse
functiondeclare function parse(source: string, options?: ParseOptions): MarkdownDocument;sourcestringoptionsParseOptionsreturnMarkdownDocument- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
MarkdownDocument- Requirement
- n/a
ParseOptions
interfaceinterface ParseOptions { readonly gfm?: boolean; readonly footnotes?: boolean; readonly callouts?: boolean; readonly sourcePositions?: boolean; readonly allowDataImage?: boolean;}allowDataImagebooleancalloutsbooleanfootnotesbooleangfmbooleansourcePositionsboolean- Name
allowDataImage- Kind
- property
- Type
boolean- Requirement
- optional
- Name
callouts- Kind
- property
- Type
boolean- Requirement
- optional
- Name
footnotes- Kind
- property
- Type
boolean- Requirement
- optional
- Name
gfm- Kind
- property
- Type
boolean- Requirement
- optional
- Name
sourcePositions- Kind
- property
- Type
boolean- Requirement
- optional
RenderPlanNode
interfaceinterface RenderPlanNode { readonly part: MarkdownNodeType; readonly props: Readonly<Record<string, unknown>>; readonly children: readonly RenderPlanNode[]; readonly key: string; readonly text?: string; readonly element?: string;}childrenreadonly RenderPlanNode[]elementstringkeystringpartMarkdownNodeTypepropsReadonly<Record<string, unknown>>textstring- Name
children- Kind
- property
- Type
readonly RenderPlanNode[]- Requirement
- required
- Name
element- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
string- Requirement
- required
- Name
part- Kind
- property
- Type
MarkdownNodeType- Requirement
- required
- Name
props- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- required
- Name
text- Kind
- property
- Type
string- Requirement
- optional
toRenderPlan
functiondeclare function toRenderPlan(document: MarkdownDocument, options?: RenderPlanOptions): RenderPlan;documentMarkdownDocumentoptionsRenderPlanOptionsreturnRenderPlan- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
options- Kind
- parameter
- Type
RenderPlanOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
RenderPlan- Requirement
- n/a
@grassroot/ui-headless-angular/markdown
Angular adapter
GR_MARKDOWN_DECLARATIONS
valueexport declare const GR_MARKDOWN_DECLARATIONS: readonly [typeof GrMarkdown];GrMarkdown
classexport declare class GrMarkdown { readonly source: import("@angular/core").InputSignal<string>; readonly ast: import("@angular/core").InputSignal<MarkdownDocument | undefined>; readonly options: import("@angular/core").InputSignal<ParseOptions | undefined>; readonly dir: import("@angular/core").InputSignal<"rtl" | "ltr" | "auto" | undefined>; readonly className: import("@angular/core").InputSignal<string | undefined>; readonly plan: import("@angular/core").Signal<import("@grassroot/ui-headless-core").RenderPlan>; text(node: RenderPlanNode): string; static ɵfac: i0.ɵɵFactoryDeclaration<GrMarkdown, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GrMarkdown, "gr-markdown", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "ast": { "alias": "ast"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;}astimport("@angular/core").InputSignal<MarkdownDocument | undefined>classNameimport("@angular/core").InputSignal<string | undefined>dirimport("@angular/core").InputSignal<"rtl" | "ltr" | "auto" | undefined>optionsimport("@angular/core").InputSignal<ParseOptions | undefined>ɵcmpi0.ɵɵComponentDeclaration<GrMarkdown, "gr-markdown", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "ast": { "alias": "ast"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>ɵfaci0.ɵɵFactoryDeclaration<GrMarkdown, never>planimport("@angular/core").Signal<import("@grassroot/ui-headless-core").RenderPlan>sourceimport("@angular/core").InputSignal<string>text(node: RenderPlanNode) => string- Name
ast- Kind
- property
- Type
import("@angular/core").InputSignal<MarkdownDocument | undefined>- Requirement
- required
- Name
className- Kind
- property
- Type
import("@angular/core").InputSignal<string | undefined>- Requirement
- required
- Name
dir- Kind
- property
- Type
import("@angular/core").InputSignal<"rtl" | "ltr" | "auto" | undefined>- Requirement
- required
- Name
options- Kind
- property
- Type
import("@angular/core").InputSignal<ParseOptions | undefined>- Requirement
- required
- Name
ɵcmp- Kind
- property
- Type
i0.ɵɵComponentDeclaration<GrMarkdown, "gr-markdown", never, { "source": { "alias": "source"; "required": false; "isSignal": true; }; "ast": { "alias": "ast"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "className": { "alias": "className"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrMarkdown, never>- Requirement
- required
- Name
plan- Kind
- property
- Type
import("@angular/core").Signal<import("@grassroot/ui-headless-core").RenderPlan>- Requirement
- required
- Name
source- Kind
- property
- Type
import("@angular/core").InputSignal<string>- Requirement
- required
- Name
text- Kind
- method
- Type
(node: RenderPlanNode) => string- Requirement
- required
HighlightToken
typeHighlighters may return their native `content`/`type` shape or the public CodeBlock `text`/`tone` shape. Both are normalised into render tokens.
type HighlightToken = { readonly text: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;} | { readonly content: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;};MarkdownDocument
typetype MarkdownDocument = { readonly source: string; readonly blocks: readonly BlockNode[]; readonly diagnostics: readonly MarkdownDiagnostic[];};blocksreadonly BlockNode[]diagnosticsreadonly MarkdownDiagnostic[]sourcestring- Name
blocks- Kind
- property
- Type
readonly BlockNode[]- Requirement
- required
- Name
diagnostics- Kind
- property
- Type
readonly MarkdownDiagnostic[]- Requirement
- required
- Name
source- Kind
- property
- Type
string- Requirement
- required
MarkdownNodeType
typetype MarkdownNodeType = "document" | "heading" | "paragraph" | "code-block" | "code-fence-custom" | "list" | "list-item" | "task-item" | "blockquote" | "callout" | "thematic-break" | "table" | "table-row" | "table-cell" | "details" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "footnote-def" | "hard-break" | "html-blocked" | "text";parse
functiondeclare function parse(source: string, options?: ParseOptions): MarkdownDocument;sourcestringoptionsParseOptionsreturnMarkdownDocument- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
MarkdownDocument- Requirement
- n/a
ParseOptions
interfaceinterface ParseOptions { readonly gfm?: boolean; readonly footnotes?: boolean; readonly callouts?: boolean; readonly sourcePositions?: boolean; readonly allowDataImage?: boolean;}allowDataImagebooleancalloutsbooleanfootnotesbooleangfmbooleansourcePositionsboolean- Name
allowDataImage- Kind
- property
- Type
boolean- Requirement
- optional
- Name
callouts- Kind
- property
- Type
boolean- Requirement
- optional
- Name
footnotes- Kind
- property
- Type
boolean- Requirement
- optional
- Name
gfm- Kind
- property
- Type
boolean- Requirement
- optional
- Name
sourcePositions- Kind
- property
- Type
boolean- Requirement
- optional
RenderPlanNode
interfaceinterface RenderPlanNode { readonly part: MarkdownNodeType; readonly props: Readonly<Record<string, unknown>>; readonly children: readonly RenderPlanNode[]; readonly key: string; readonly text?: string; readonly element?: string;}childrenreadonly RenderPlanNode[]elementstringkeystringpartMarkdownNodeTypepropsReadonly<Record<string, unknown>>textstring- Name
children- Kind
- property
- Type
readonly RenderPlanNode[]- Requirement
- required
- Name
element- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
string- Requirement
- required
- Name
part- Kind
- property
- Type
MarkdownNodeType- Requirement
- required
- Name
props- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- required
- Name
text- Kind
- property
- Type
string- Requirement
- optional
toRenderPlan
functiondeclare function toRenderPlan(document: MarkdownDocument, options?: RenderPlanOptions): RenderPlan;documentMarkdownDocumentoptionsRenderPlanOptionsreturnRenderPlan- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
options- Kind
- parameter
- Type
RenderPlanOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
RenderPlan- Requirement
- n/a
@grassroot/ui-headless-svelte/markdown
Svelte adapter
default
valueexport declare const default: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
HighlightToken
typeHighlighters may return their native `content`/`type` shape or the public CodeBlock `text`/`tone` shape. Both are normalised into render tokens.
type HighlightToken = { readonly text: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;} | { readonly content: string; readonly tone?: CodeBlockTokenTone; readonly type?: string;};Markdown
valueexport declare const Markdown: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
MarkdownDocument
typetype MarkdownDocument = { readonly source: string; readonly blocks: readonly BlockNode[]; readonly diagnostics: readonly MarkdownDiagnostic[];};blocksreadonly BlockNode[]diagnosticsreadonly MarkdownDiagnostic[]sourcestring- Name
blocks- Kind
- property
- Type
readonly BlockNode[]- Requirement
- required
- Name
diagnostics- Kind
- property
- Type
readonly MarkdownDiagnostic[]- Requirement
- required
- Name
source- Kind
- property
- Type
string- Requirement
- required
MarkdownNodeType
typetype MarkdownNodeType = "document" | "heading" | "paragraph" | "code-block" | "code-fence-custom" | "list" | "list-item" | "task-item" | "blockquote" | "callout" | "thematic-break" | "table" | "table-row" | "table-cell" | "details" | "emphasis" | "strong" | "strikethrough" | "code-span" | "link" | "autolink" | "image" | "footnote-ref" | "footnote-def" | "hard-break" | "html-blocked" | "text";parse
functiondeclare function parse(source: string, options?: ParseOptions): MarkdownDocument;sourcestringoptionsParseOptionsreturnMarkdownDocument- Name
source- Kind
- parameter
- Type
string- Requirement
- required
- Name
options- Kind
- parameter
- Type
ParseOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
MarkdownDocument- Requirement
- n/a
ParseOptions
interfaceinterface ParseOptions { readonly gfm?: boolean; readonly footnotes?: boolean; readonly callouts?: boolean; readonly sourcePositions?: boolean; readonly allowDataImage?: boolean;}allowDataImagebooleancalloutsbooleanfootnotesbooleangfmbooleansourcePositionsboolean- Name
allowDataImage- Kind
- property
- Type
boolean- Requirement
- optional
- Name
callouts- Kind
- property
- Type
boolean- Requirement
- optional
- Name
footnotes- Kind
- property
- Type
boolean- Requirement
- optional
- Name
gfm- Kind
- property
- Type
boolean- Requirement
- optional
- Name
sourcePositions- Kind
- property
- Type
boolean- Requirement
- optional
RenderPlanNode
interfaceinterface RenderPlanNode { readonly part: MarkdownNodeType; readonly props: Readonly<Record<string, unknown>>; readonly children: readonly RenderPlanNode[]; readonly key: string; readonly text?: string; readonly element?: string;}childrenreadonly RenderPlanNode[]elementstringkeystringpartMarkdownNodeTypepropsReadonly<Record<string, unknown>>textstring- Name
children- Kind
- property
- Type
readonly RenderPlanNode[]- Requirement
- required
- Name
element- Kind
- property
- Type
string- Requirement
- optional
- Name
key- Kind
- property
- Type
string- Requirement
- required
- Name
part- Kind
- property
- Type
MarkdownNodeType- Requirement
- required
- Name
props- Kind
- property
- Type
Readonly<Record<string, unknown>>- Requirement
- required
- Name
text- Kind
- property
- Type
string- Requirement
- optional
toRenderPlan
functiondeclare function toRenderPlan(document: MarkdownDocument, options?: RenderPlanOptions): RenderPlan;documentMarkdownDocumentoptionsRenderPlanOptionsreturnRenderPlan- Name
document- Kind
- parameter
- Type
MarkdownDocument- Requirement
- required
- Name
options- Kind
- parameter
- Type
RenderPlanOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
RenderPlan- Requirement
- n/a
@grassroot/ui-headless-solid/markdown
Solid adapter
default
functionexport declare function Markdown(props: MarkdownProps): JSX.Element;propsMarkdownPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
MarkdownProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
Markdown
functionexport declare function Markdown(props: MarkdownProps): JSX.Element;propsMarkdownPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
MarkdownProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
MarkdownProps
interfaceexport interface MarkdownProps { source?: string; ast?: MarkdownDocument; options?: ParseOptions; components?: Partial<Record<MarkdownNodeType, Component<{ children?: JSX.Element; }>>>; code?: Readonly<Record<string, Component<{ children?: JSX.Element; }>>>; highlight?: (code: string, lang: string | undefined) => readonly HighlightToken[]; dir?: "ltr" | "rtl" | "auto"; className?: string;}astMarkdownDocumentclassNamestringcodeReadonly<Record<string, Component<{
children?: JSX.Element;
}>>>componentsPartial<Record<MarkdownNodeType, Component<{
children?: JSX.Element;
}>>>dir"ltr" | "rtl" | "auto"highlight(code: string, lang: string | undefined) => readonly HighlightToken[]optionsParseOptionssourcestring- Name
ast- Kind
- property
- Type
MarkdownDocument- Requirement
- optional
- Name
className- Kind
- property
- Type
string- Requirement
- optional
- Name
code- Kind
- property
- Type
Readonly<Record<string, Component<{ children?: JSX.Element; }>>>- Requirement
- optional
- Name
components- Kind
- property
- Type
Partial<Record<MarkdownNodeType, Component<{ children?: JSX.Element; }>>>- Requirement
- optional
- Name
dir- Kind
- property
- Type
"ltr" | "rtl" | "auto"- Requirement
- optional
- Name
highlight- Kind
- property
- Type
(code: string, lang: string | undefined) => readonly HighlightToken[]- Requirement
- optional
- Name
options- Kind
- property
- Type
ParseOptions- Requirement
- optional
- Name
source- Kind
- property
- Type
string- Requirement
- optional