How to use the turndown.default function in turndown

To help you get started, we’ve selected a few turndown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / workbooks / Clients / Xamarin.Interactive.Client.Web / ClientApp / utils / DraftSaveLoadUtils.ts View on Github external
export function convertToMarkdown(contentState: Draft.ContentState): string {
    const htmlContent = stateToHTML(contentState);
    const td = new TurndownService.default({
        headingStyle: "atx",
        hr: "***",
        codeBlockStyle: "fenced"
    });
    td.addRule("codeblocks", {
        filter: ["pre"],
        replacement: codeBlocksSerializer
    });
    return td.turndown(htmlContent);
}

turndown

A library that converts HTML to Markdown

MIT
Latest version published 6 months ago

Package Health Score

77 / 100
Full package analysis