Search the documentation

Type to search page titles, component names and descriptions.

    Data Display

    MarkdownContent

    Server-rendered Markdown with safe links and diagrams.

    import { MarkdownContent, MermaidDiagram } from 'faifo-design'

    MarkdownContent renders Markdown on the server with HTML escaped and unsafe links made inert. MermaidDiagram shows a diagram's source until the host's lazy renderer draws it with the shared theme.

    #When to use

    • Use it for guidance and notes written by people, such as screen help.
    • The host bundles and pins Mermaid and registers it with configureMermaidLoader; presentation stays with the design system.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Screen help

    Right-side modeless desktop guidance, fullscreen mobile help, SSR Markdown and the shared Mermaid theme. Hosts supply content and a lazy renderer. Open the connected demo to try the drawer; diagram source remains readable without JavaScript.

    Open screen help demoInspect Mermaid theme
    Order workflow
    View Mermaid source
    flowchart TD
      A[Draft] --> B[Complete]
      class B faifo-positive

    Screen help

    Example screen

    Screen-owned Markdown content
    Show codeHide code
    import { AppSwitcherHelp, HelpDrawer, LinkButton, MermaidDiagram, Stack } from 'faifo-design'
    
    export const Example = () => (
      <Stack
        items={[
          <LinkButton href="/demo2" label="Open screen help demo" />,
          <AppSwitcherHelp label="Screen help in standalone navigation" />,
          <LinkButton href="/help-theme" label="Inspect Mermaid theme" />,
          <MermaidDiagram
            source={'flowchart TD\n  A[Draft] --> B[Complete]\n  class B faifo-positive'}
            labels={{
              diagram: 'Order workflow',
              source: 'View Mermaid source',
              loading: 'Rendering…',
              error: 'Diagram unavailable; view its source.',
            }}
          />,
          <HelpDrawer
            id="catalogue-help-drawer"
            label="Screen help"
            title="Example screen"
            closeLabel="Close help"
            body="Screen-owned Markdown content"
          />,
        ]}
      />
    )

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #configureMermaidLoaderFunction

    A host bundles/pins Mermaid; all presentation and rendering policy stays here.

    function configureMermaidLoader(load: () => Promise<MermaidEngine>): void
    ParameterType
    loadrequired() => Promise<MermaidEngine>
    Returnsvoid

    #MarkdownContentComponent

    SSR Markdown with escaped HTML, safe links and Mermaid source fallback.

    PropertyDescriptionTypeDefault
    sourcerequired–string–
    lexerrequired–(source: string) => readonly MarkdownToken[]–
    labelsrequired–MarkdownLabels–
    headingOffsetOffset Markdown headings inside a named drawer or section.number0

    #MermaidDiagramComponent

    PropertyDescriptionTypeDefault
    sourcerequired–string–
    labelsrequired–Omit<MarkdownLabels, 'table'>–

    #Types

    #MarkdownContentProps

    The properties of MarkdownContent, listed above.

    #MarkdownLabels

    PropertyDescriptionTypeDefault
    diagramrequired–string–
    sourcerequired–string–
    loadingrequired–string–
    errorrequired–string–
    tablerequired–string–

    #MarkdownToken

    Structural lexer contract: a host can supply marked.lexer without coupling the DS to a parser.

    PropertyDescriptionTypeDefault
    typerequired–string–
    raw–string–
    text–string–
    tokens–readonly MarkdownToken[]–
    depth–number–
    lang–string–
    href–string–
    title–string | null–
    ordered–boolean–
    start–number | ''–
    task–boolean–
    checked–boolean–
    items–readonly MarkdownToken[]–
    header–readonly MarkdownCell[]–
    rows–readonly (readonly MarkdownCell[])[]–
    align–readonly (string | null)[]–

    #Hooks

    The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.

    • markdown
    • markdown-table
    • mermaid
    • mermaid-status
    • mermaid-canvas
    • mermaid-source