Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

stristri

codsen271MIT5.0.25TypeScript support: included

Extracts or deletes HTML, CSS, text and/or templating tags from string

code, css, extract, html, jinja, jsp, nunjucks, qa, remove, separate, strip, tags, text

readme

stristri

Extracts or deletes HTML, CSS, text and/or templating tags from string

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 3.2.0 (npm i stristri@3.2.0).

npm i stristri

Quick Take

import { strict as assert } from "assert";

import { stri } from "stristri";

// strips both HTML and Nunjucks, leaves text only:
assert.equal(
  stri(
    "<html><div>The price is{% if data.price > 100 %} high{% endif %}</div>",
    {
      html: true,
      css: true,
      text: false,
      templatingTags: true,
    },
  ).result,
  "The price is high",
);

Documentation

Please visit codsen.com for a full description of the API.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License.

Copyright © 2010-2024 Roy Revelt and other contributors.

ok codsen star

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

5.0.0 (2022-12-01)

BREAKING CHANGES

  • Minimum supported Node version is v14.18; we're dropping v12 support

4.1.0 (2022-08-12)

Features

4.0.17 (2022-04-18)

Fixed

4.0.0 (2021-09-09)

Features

BREAKING CHANGES

  • programs now are in ES Modules and won't work with Common JS require()

3.2.0 (2021-05-24)

Features

  • config file based major bump blacklisting (e15f9bb)

3.1.7 (2021-04-11)

Reverts

  • Revert "chore: setup refresh" (23cf206)

3.1.0 (2021-03-14)

Features

  • separate the inline <script> contents - add a new option, "js" (b7aac4b)

3.0.1 (2021-01-28)

Fixed

  • add testStats to npmignore (f3c84e9)

3.0.0 (2021-01-23)

Features

BREAKING CHANGES

  • there are no API changes but we're bumping major just in case

2.0.0 (2020-12-09)

Features

  • add opts.reportProgressFunc, remove reported ranges (5021681)
  • report log of time taken (f9b575f)

BREAKING CHANGES

  • ranges are not reported in result any more because it's too resource taxing to calculate the collapsed result ranges on top of del

1.1.0 (2020-12-06)

Features