Skip to content

inkdropapp/html2markdown

Repository files navigation

html2markdown

It converts HTML to Markdown using remark and rehype.

install

npm install @inkdropapp/html2markdown

How to use

Say we have the following markdown file, example.md:

<h1>Hello, world!</h1>

And our script, example.js, looks as follows:

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:

# Hello, world!

API

html2Markdown(html, options)

Converts the given HTML to Markdown.

Options

License

MIT © Takuya Matsuyama