@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Interface MarkdownParser

    A pluggable Markdown-to-HTML converter.

    The rich-text editor's MarkdownEditingStrategy uses this interface to convert Markdown source text into an HTML string for the live preview pane.

    The library ships a lightweight built-in converter that covers headings, bold, italic, lists, links, images, code blocks, and blockquotes. For full CommonMark / GFM support, consumers can provide their own implementation backed by a third-party parser such as marked or markdown-it.

    // Using the built-in converter (default — nothing to configure)
    <ui-rich-text-editor mode="markdown" />

    // Plugging in `marked`
    import { marked } from 'marked';
    import { MARKDOWN_PARSER, createMarkedParser } from '@theredhead/lucid-kit';

    providers: [
    { provide: MARKDOWN_PARSER, useValue: createMarkedParser(md => marked.parse(md) as string) }
    ]
    interface MarkdownParser {
        toHtml(markdown: string): string;
    }
    Index

    Methods

    Methods

    • Converts a Markdown string to an HTML string.

      The returned HTML is sanitised by the editor before being rendered in the preview pane, so implementations do not need to worry about XSS.

      Parameters

      • markdown: string

        The raw Markdown source text.

      Returns string

      An HTML string.