javascript
function downLoad(message: Chat) {
const md = new MarkdownIt1();
const htmlContent = md.render(message.text);
const title = extractTitles(message.text);
const temphtml = `<div>
<div style="line-height:2px;width: 638px;border-top: 2px solid #ff0000; margin: 0 auto;">
<span style="font-family:Arial"> </span>
</div>
<p style="margin-top:2.15pt; margin-bottom:0pt; text-align:center; line-height:75%; font-size:21.5pt">
<span style="font-family:'微软雅黑'">
${title}
</span></p><p style="margin-top:11.3pt; margin-bottom:0pt; line-height:93%; font-size:15.5pt">
<span style="font-family:FangSong">${htmlContent}</span></p></div>`
const docx = htmlDocx.asBlob(temphtml)
const fileName = 'my_document.docx'
// 下载导出的文档
const link = document.createElement('a')
link.href = window.URL.createObjectURL(docx)
link.download = fileName
link.click()
}
import MarkdownIt1 from 'markdown-it';
import htmlDocx from 'html-docx-fixed/dist/html-docx';