@mysticwillz/html-to-string
v1.0.1
Published
Lightweight utility to strip HTML tags from a string
Maintainers
Readme
html-to-string
🪼 A tiny utility that strips HTML tags from a string and returns clean text.
✨ Features
- 🩸 Lightweight – No dependencies
- ⚡ Fast and simple
- ✅ TypeScript support
- 💠 Ideal for frontend & backend use
📦 Installation
npm i @mysticwillz/html-to-stringor
yarn add @mysticwillz/html-to-string🚀 Usage
Basic Example
import { stripHTML } from "@mysticwillz/html-to-string";
const dirty = "<h1>Hello <em>World</em></h1>";
const clean = stripHTML(dirty);
console.log(clean); // "Hello World"🧠 API
stripHTML(html: string): string
| Param | Type | Description | | ----- | ------ | ------------------------------ | | html | string | String containing HTML content | | → | string | Clean string with tags removed |
🧪 Example Inputs
stripHTML("<p>This is <strong>important</strong></p>");
// → "This is important"
stripHTML('<div><a href="#">Link</a></div>');
// → "Link"
stripHTML("");
// → ""📁 Project Structure
html-to-string/
├── src/
│ └── index.ts # Main function
├── dist/ # Compiled output
├── test.js # Example usage
├── package.json
└── README.md📄 License
MIT © 2025 Eze Williams Ezebuilo
💡 Inspiration
This package was built to provide a fast, minimalist solution to convert HTML into plain readable text without unnecessary complexity.
👌 Contributing
Pull requests, suggestions, and ideas are welcome! Open an issue or submit a PR.
