@pawel-up/html.md
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

HTML.md by Pawel Uchida-Psztyc is licensed under CC BY 4.0

Readme

Keywords

Package Sidebar

Install

npm i @pawel-up/html.md

Weekly Downloads

3

Version

0.1.0

License

CC-BY-4.0

Unpacked Size

65.5 kB

Total Files

37

Last publish

Collaborators

  • jarrodek