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

    Function createMarkdownItParser

    • Creates a MarkdownParser that delegates to a markdown-it instance's render method.

      The consumer must install markdown-it themselves and pass in the bound render function — this library never imports markdown-it directly.

      Parameters

      • renderFn: (markdown: string) => string

        A function that takes a Markdown string and returns an HTML string. Typically (md) => md.render(md) where md is a configured MarkdownIt instance.

      Returns MarkdownParser

      A MarkdownParser instance.

      import MarkdownIt from 'markdown-it';
      import { MARKDOWN_PARSER, createMarkdownItParser } from '@theredhead/lucid-kit';

      const mdit = new MarkdownIt();

      providers: [
      {
      provide: MARKDOWN_PARSER,
      useValue: createMarkdownItParser(md => mdit.render(md)),
      },
      ]