# @ryan-liu/wechat-to-markdown

> 解析微信文章 URL 为 markdown

Latest version **1.2.2** (published 2022-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ryan-liu/wechat-to-markdown
pnpm add @ryan-liu/wechat-to-markdown
yarn add @ryan-liu/wechat-to-markdown
bun add @ryan-liu/wechat-to-markdown
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2022-06-11 |
| First published | 2021-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 29.2 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Ryan-liu |
| Maintainers | ryan-liu |
| Keywords | wechat to markdown, markdown |

## Links

- npm: https://www.npmjs.com/package/@ryan-liu/wechat-to-markdown
- npm.io page: https://npm.io/package/@ryan-liu/wechat-to-markdown

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.22.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.10
- [turndown](https://npm.io/package/turndown.md) ^7.1.1
- [turndown-plugin-gfm](https://npm.io/package/turndown-plugin-gfm.md) ^1.0.2

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2022-06-11
- 1.2.1 — 2022-06-11
- 1.2.0 — 2022-06-11
- 1.1.9 — 2022-01-03
- 1.1.8 — 2021-12-30
- 1.1.7 — 2021-11-16
- 1.1.6 — 2021-11-15
- 1.1.5 — 2021-11-15
- 1.1.4 — 2021-11-15
- 1.1.3 — 2021-11-02
- 1.1.2 — 2021-10-30
- 1.1.1 — 2021-10-30
- 1.1.0 — 2021-10-30
- 1.0.0 — 2021-10-30

## README

## description

Enter the WeChat public address to convert it to markdown format

English | [简体中文](README.zh-CN.md)

## return options

```ts
interface TurnDownResult {
    success: boolean
    code: number
    data?: {
        title?: string
        author?: string
        content?: string
    }
    msg?: string
}

```

## Basic Usage

## CommonJs

```javascript
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**
```javascript
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**

```js
...
server: {
    proxy: {
        '/api': {
            target: 'https://mp.weixin.qq.com',
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/api/, ''),
        },
    },
},
...
```


## Packages

[axios](http://www.axios-js.com/)

[cheerio](https://github.com/cheeriojs/cheerio)

[turndown (html to markdown)](https://github.com/mixmark-io/turndown)

[turndown-plugin-gfm (turndown parsing partial html element plugin)](https://github.com/mixmark-io/turndown-plugin-gfm)

## Reference

[html2md (A very well developed url to markdown project)](https://github.com/helloworld-Co/html2md)

---
_Source: https://npm.io/package/@ryan-liu/wechat-to-markdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
