npm i turndown
htmlToMarkdown() {
let down = new turndown()
let md = down.turndown(this.html)
let blob = new Blob([md], {
type: 'text/markdown'
})
let url = URL.createObjectURL(blob)
let a = document.createElement("a")
a.href = url
a.download = 'markdown.md'
a.click()
URL.revokeObjectURL(url)
}
参考:github