html-excerpt-extractor
is a handy npm package that allows for extracting excerpts from HTML content. This tool can be very useful for generating content previews or search result snippets where only a portion of the HTML content is displayed.
Install the package using your favorite package manager:
npm install html-excerpt-extractor
# or
pnpm add html-excerpt-extractor
# or
yarn add html-excerpt-extractor
After installation, you can import and use the module in your JavaScript or TypeScript project:
const { extractExcerpt } = require("html-excerpt-extractor");
const htmlContent = "<div>Some <strong>important</strong> content</div>";
const excerpt = extractExcerpt(htmlContent, { length: 100 });
console.log(excerpt); // Outputs: "Some important content"
Interested in contributing to the development of this project? Great! You can clone the repository and install dependencies using pnpm:
git clone https://github.com/gravima/html-excerpt-extractor.git
cd html-excerpt-extractor
pnpm install
Feel free to report issues or submit pull requests if you have suggestions for improvements or have found bugs.
This project is released under the MIT License. Details can be found in the LICENSE file.