# html-markdown

> Convert from Html to Markdown isomorphically By Javascript.

Latest version **1.0.17** (published 2017-05-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install html-markdown
pnpm add html-markdown
yarn add html-markdown
bun add html-markdown
```

Provides the command `html2md`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2017-05-14 |
| First published | 2017-02-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | moyu |
| Maintainers | moyuyc |
| Keywords | html, markdown |

## Links

- npm: https://www.npmjs.com/package/html-markdown
- Repository: https://github.com/moyuyc/html-markdown
- Homepage: https://github.com/moyuyc/html-markdown#readme
- Issues: https://github.com/moyuyc/html-markdown/issues
- npm.io page: https://npm.io/package/html-markdown

## Dependencies (3)

- [he](https://npm.io/package/he.md) ^1.1.1
- [cheerio](https://npm.io/package/cheerio.md) ^0.22.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.17 (latest) — 2017-05-14
- 1.0.16 — 2017-02-10
- 1.0.15 — 2017-02-10
- 1.0.14 — 2017-02-10
- 1.0.13 — 2017-02-07
- 1.0.12 — 2017-02-07
- 1.0.11 — 2017-02-07
- 1.0.10 — 2017-02-07
- 1.0.8 — 2017-02-07
- 1.0.7 — 2017-02-07
- 1.0.6 — 2017-02-07
- 1.0.5 — 2017-02-07
- 1.0.4 — 2017-02-07
- 1.0.3 — 2017-02-06
- 1.0.2 — 2017-02-06
- … 2 more at https://npm.io/package/html-markdown/versions

## README

# html-markdown

Convert from Html to Markdown isomorphically By Javascript.

Branches: master => cheerio;  jsdom => jsdom (isomorphic);

Requirements: [Cheerio](https://github.com/cheeriojs/cheerio) Or [jsDom](https://github.com/tmpvar/jsdom)
Cheerio is Fast HTML parser using like jquery for server.
jsDom is has better performance on browser, don't need import jsdom.
So we can `html-markdown` browser and server(nodejs), that is to say, it's **isomorphic**.

**cheerio version in npm. (Fast)**

- Bash

```bash
npm i -g html-markdown
html2md -h
html2md https://www.npmjs.com/package/html-markdown -s "#readme" > html-markdown-readme.md
# with image
html2md https://www.npmjs.com/package/song-robot -s "#readme" > song-robot-readme.md
html2md https://www.npmjs.com/package/moka-cli -s "#readme" > moka-cli-readme.md

html2md path/to/html/file -s "#markdown"

html2md --eval "<h1>Hello!</h1>"

html2md - # get string from stdin
html2md   # get string from stdin, better REPL

{
    echo "<h1>HEAD1</h1>";
    echo "<h2>HEAD2</h2>";
} | html2md -
```

- Package

```
npm i --save html-markdown
```

```javascript
var html2md = require('html-markdown');

var md1 = html2md.html2mdFromString("<h1>Hello!</h1>");

// https or http, not isomorphic
html2md.html2mdFromURL("https://www.npmjs.com/package/song-robot", "#readme").then(console.log);

// not isomorphic
html2md.html2mdFromPath("path/to/html/file", "#markdown").then(console.log);
```

---
_Source: https://npm.io/package/html-markdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
