0.1.0 • Published 3 years ago

@pawel-up/html.md v0.1.0

Weekly downloads
-
License
CC-BY-4.0
Repository
github
Last release
3 years ago

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.

Published on NPM

Tests and publishing

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