HTML.md
No-dependency, ESM ready, in browser HTML to markdown converter.
A library that takes an HTML string or an Element reference and translates it to MarkDown code.
Note, this library works in a browser environment only. This won't work in Node.js
.
Usage
Installation
npm install --save @pawel-up/html.md
Basic example
import HtmlMd from '@pawel-up/html.md';
const parser = new HtmlMd();
const markdown = parser.generate(`<p>This is a <code>markdown</code> output</p>`);
// This is a `markdown` output\n\n
Processing HTML element
import HtmlMd from '@pawel-up/html.md';
const parser = new HtmlMd();
const markdown = parser.generate(document.body);
Note, when passing an element, the most outer element is ignored and treated as a container. The generated markdown only contains child nodes.
Development
git clone https://github.com/jarrodek/html.md
cd html.md
npm install
Running the demo locally
npm start
Running the tests
npm test
License
HTML.md by Pawel Uchida-Psztyc is licensed under CC BY 4.0