# serene-leaf-parser

> A lightweight parser for leaf nodes

Latest version **1.0.4** (published 2024-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install serene-leaf-parser
pnpm add serene-leaf-parser
yarn add serene-leaf-parser
bun add serene-leaf-parser
```

## 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.4 |
| Published | 2024-04-17 |
| First published | 2024-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | batboy999 |
| Keywords | parser, leaf, nodes |

## Links

- npm: https://www.npmjs.com/package/serene-leaf-parser
- Repository: https://github.com/batboy999/serene-leaf-parser
- Homepage: https://github.com/batboy999/serene-leaf-parser#readme
- Issues: https://github.com/batboy999/serene-leaf-parser/issues
- npm.io page: https://npm.io/package/serene-leaf-parser

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [marked](https://npm.io/package/marked.md) ^3.0.0
- [cheerio](https://npm.io/package/cheerio.md) ^1.0.0-rc.10

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2024-04-17
- 1.0.3 — 2024-03-20
- 1.0.2 — 2024-03-20
- 1.0.0 — 2024-03-18

## README

# serene-leaf-parser

A comprehensive library for parsing HTML and converting markdown to HTML in Node.js, with added functionalities for
fetching web content, sanitizing it, and extracting text.

## Features

- Fetch and parse HTML from a URL
- Sanitize HTML content to prevent XSS attacks
- Convert markdown to HTML with customizable options
- Extract plain text from HTML content

## Installation

Install serene-leaf-parser using npm:

```
npm install serene-leaf-parser
```

## Usage

### Fetch and Parse HTML from URL

```javascript
const { fetchAndParseHTML } = require('serene-leaf-parser');

async function demoFetch () {
  const html = await fetchAndParseHTML('https://example.com');
  console.log(html);
}

demoFetch();
```

### Sanitize and Parse HTML

```javascript
const { parseHTML } = require('serene-leaf-parser');

// Assume `html` contains the HTML string to be sanitized and parsed
const sanitizedHtml = parseHTML(html);
console.log(sanitizedHtml);
```

### Convert Markdown to HTML

```javascript
const { markdownToHTML } = require('serene-leaf-parser');

const html = markdownToHTML('# Hello World');
console.log(html);
```

### Extract Text from HTML

```javascript
const { extractTextFromHTML } = require('serene-leaf-parser');

// Assume `html` contains the HTML string
const text = extractTextFromHTML(html);
console.log(text);
```

## Contributing

Contributions, issues, and feature requests are welcome!

## License

MIT

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