@ryan-liu/wechat-to-markdown
v1.2.2
Published
解析微信文章 URL 为 markdown
Downloads
4
Readme
description
Enter the WeChat public address to convert it to markdown format
English | 简体中文
return options
interface TurnDownResult {
success: boolean
code: number
data?: {
title?: string
author?: string
content?: string
}
msg?: string
}
Basic Usage
CommonJs
const transformHtml2Markdown = require('@ryan-liu/wechat-to-markdown').default
setTimeout(async () => {
const articleData = await transformHtml2Markdown('https://mp.weixin.qq.com/s/9d5DWg7YdMHPvVl-2KLH2w')
const { title, author, content } = articleData.data
console.log('title', title)
console.log('author', author)
console.log('content', content)
}, 0)
vue3
index.ts
import transformHtml2Markdown from '@ryan-liu/wechat-to-markdown'
setup() {
const getData = async () => {
const articleData = await transformHtml2Markdown(
'/api/s/9d5DWg7YdMHPvVl-2KLH2w'
)
const { title, author, content } = articleData.data
console.log('title', title)
console.log('author', author)
console.log('content', content)
}
getData()
return {}
},
vite.config.ts
...
server: {
proxy: {
'/api': {
target: 'https://mp.weixin.qq.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
...
Packages
turndown-plugin-gfm (turndown parsing partial html element plugin)