npm:
npm install turndown
npm install turndown-plugin-gfm
Browser:
<script src="https://unpkg.com/turndown/dist/turndown.js"></script>
<script src="https://unpkg.com/turndown-plugin-gfm/dist/turndown-plugin-gfm.js"></script>
import TurndownService from 'turndown';
import { gfm, tables, strikethrough } from "turndown-plugin-gfm";
const turndownService = new TurndownService({
headingStyle: "atx",
bulletListMarker: "-",
preformattedCode: true,
})
turndownService.use([gfm, tables, strikethrough])
let markdown = turndownService.turndown("<h1>Hello world!</h1>")