Function parseMarkdownToHtml

  • Converts a markdown formatted string to HTML.

    This function processes the input markdown text and replaces bold, italic, and link syntax with their corresponding HTML tags.

    • Bold: **text** or __text__ is converted to <strong>text</strong>
    • Italic: *text* or _text_ is converted to <em>text</em>
    • Links: [text](url) is converted to <a href="url">text</a>

    Parameters

    • text: string

      The markdown formatted string to be converted to HTML.

    Returns string

    The HTML formatted string.

    const markdown = "**bold** _italic_ [link](http://example.com)";
    const html = parseMarkdownToHtml(markdown);
    console.log(html); // Output: <strong>bold</strong> <em>italic</em> <a href="http://example.com">link</a>