Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inkdropapp/html2markdown
It converts HTML to Markdown based on remark and rehype.
https://github.com/inkdropapp/html2markdown
html markdown mdast micromark rehype remark
Last synced: 20 days ago
JSON representation
It converts HTML to Markdown based on remark and rehype.
- Host: GitHub
- URL: https://github.com/inkdropapp/html2markdown
- Owner: inkdropapp
- License: mit
- Created: 2019-02-17T03:07:06.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-06T13:37:04.000Z (10 months ago)
- Last Synced: 2024-08-09T10:53:59.462Z (5 months ago)
- Topics: html, markdown, mdast, micromark, rehype, remark
- Language: HTML
- Homepage: https://www.inkdrop.app/
- Size: 1.38 MB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html2markdown
It converts HTML to Markdown using [remark][] and [rehype][].
## install
```sh
npm install @inkdropapp/html2markdown
```## How to use
Say we have the following markdown file, `example.md`:
```markdown
Hello, world!
```And our script, `example.js`, looks as follows:
```js
import { html2Markdown } from '@inkdropapp/html2markdown'
import fs from 'fs'const doc = fs.readFileSync('example.md')
const md = html2Markdown(doc)
console.log(md)
```Now, running `node example` yields:
```js
# Hello, world!
```## API
### `html2Markdown(html, options)`
Converts the given HTML to Markdown.
#### Options
- `options.toMdast` — The options for [hast-util-to-mdast][]
- `options.stringify` — The formatting options for [mdast-util-to-markdown][]## License
[MIT][license] © [Takuya Matsuyama][author]
[remark]: https://github.com/remarkjs/remark
[rehype]: https://github.com/rehypejs/rehype
[hast-util-to-mdast]: https://github.com/syntax-tree/hast-util-to-mdast
[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown#formatting-options
[license]: LICENSE
[author]: https://www.craftz.dog/