# @igor.dvlpr/strip-html

> 🥞 Removes HTML code from the given string. Can even extract text-only from the given an HTML string. ✨

Latest version **2.0.0** (published 2024-07-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @igor.dvlpr/strip-html
pnpm add @igor.dvlpr/strip-html
yarn add @igor.dvlpr/strip-html
bun add @igor.dvlpr/strip-html
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-07-28 |
| First published | 2023-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0 |
| Dependencies | 0 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Igor Dimitrijević |
| Maintainers | igor.dvlpr |
| Keywords | html, strip, remove, text, string, text-node, node, nodes, element, igorskyflyer, igor.dvlpr |

## Links

- npm: https://www.npmjs.com/package/@igor.dvlpr/strip-html
- Repository: https://github.com/igorskyflyer/npm-strip-html
- Issues: https://github.com/igorskyflyer/npm-strip-html/issues
- Funding: https://ko-fi.com/igorskyflyer
- npm.io page: https://npm.io/package/@igor.dvlpr/strip-html

## 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

- 2.0.0 (latest) — 2024-07-28
- 1.0.1 — 2023-04-04
- 1.0.0 — 2023-04-03

## README

<h1 align="center">Strip &lt;html&gt;</h1>

<br>

<div align="center">
  🥞 Removes HTML code from the given string. Can even extract text-only from the given an HTML string. ✨
</div>

<br>
<br>

<div align="center">
  <blockquote>
    <br>
    <h4>💖 Support further development</h4>
    <span>I work hard for every project, including this one
    <br>
    and your support means a lot to me!
    <br>
    <br>
    Consider buying me a coffee. ☕
    <br>
    <strong>Thank you for supporting my efforts! 🙏😊</strong></span>
    <br>
    <br>
    <a href="https://ko-fi.com/igorskyflyer" target="_blank"><img src="https://raw.githubusercontent.com/igorskyflyer/igorskyflyer/main/assets/ko-fi.png" alt="Donate to igorskyflyer" width="150"></a>
    <br>
    <br>
    <a href="https://github.com/igorskyflyer"><em>@igorskyflyer</em></a>
    <br>
    <br>
    <br>
  </blockquote>
</div>

<br>
<br>

## 📃 Table of contents

- [Usage](#-usage)
- [API](#-api)
  - [stripHtmlCode](#striphtmlcodehtml-string-string)
  - [stripHtml](#striphtmlhtml-string-string)
- [Examples](#-examples)
- [Changelog](#-changelog)
- [License](#-license)
- [Related](#-related)
- [Author](#-author)

<br>
<br>

## 🕵🏼 Usage

Install it by executing:

```shell
npm i '@igor.dvlpr/strip-html'
```

<br>

## 🤹🏼 API


### `stripHtml(html: string): string`

*Strips HTML tags completely.*  

`html` - The HTML string to process.  

Returns the processed string.

---

### `stripHtmlCode(html: string): string`

*Strips only the HTML code while keeping the text content.*  

`html` - The HTML string to process.  

Returns the processed string.

---

## ✨ Examples

`example.ts`
```ts
import { stripHtmlCode } from '@igor.dvlpr/strip-html'

console.log(
  stripHtmlCode(`
  <div class="container">
    <h1>Title</h1>
    <p>This is a <strong>paragraph</strong> with some <em>emphasis</em> and a <a href="#">link</a>.</p>
    <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
</div>
`))

// Will print

/*
Title
    This is a paragraph with some emphasis and a link.

        Item 1
        Item 2
        Item 3
*/
```

---

## 📝 Changelog

📑 The changelog is available here: [CHANGELOG.md](https://github.com/igorskyflyer/npm-strip-html/blob/main/CHANGELOG.md).

---

## 🪪 License

Licensed under the MIT license which is available here, [MIT license](https://github.com/igorskyflyer/npm-strip-html/blob/main/LICENSE).

---

## 🧬 Related

[@igor.dvlpr/duoscribi](https://www.npmjs.com/package/@igor.dvlpr/duoscribi)

> _✒ DúöScríbî allows you to convert letters with diacritics to regular letters. 🤓_

<br>

[@igor.dvlpr/magic-queryselector](https://www.npmjs.com/package/@igor.dvlpr/magic-queryselector)

> _🪄 A TypeScript-types patch for querySelector/querySelectorAll, make them return types you expect them to! 🔮_

<br>

[@igor.dvlpr/astro-escaped-component](https://www.npmjs.com/package/@igor.dvlpr/astro-escaped-component)

> _🏃🏻‍♂️‍➡️ An Astro component that holds only HTML-encoded content. 📜_

<br>

[@igor.dvlpr/str-is-in](https://www.npmjs.com/package/@igor.dvlpr/str-is-in)

> _🧵 Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. 🔍_

<br>

[@igor.dvlpr/strip-html-headings](https://www.npmjs.com/package/@igor.dvlpr/strip-html-headings)

> _🍛 Strips HTML headings! 🍤_

---

<br>

### 👨🏻‍💻 Author
Created by **Igor Dimitrijević** ([*@igorskyflyer*](https://github.com/igorskyflyer/)).

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