Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

backOpen Source→string-strip-html→Examples

Table of Contents

  • Quick Take
  • Ignores code tags and their contents
  • A bypass callback and a do-nothing callback
  • Strip an entire CDATA section
  • Decode HTML entities before recognising and stripping encoded tags
  • Keep a link destination next to its label
  • Put a retained link destination on a new paragraph
  • Extract HTML <head> contents
  • Strip an HTML comment and prevent adjacent text from joining
  • Preserve selected tags while stripping the rest
  • Strip a JSX component tag from surrounding text
  • Retain href and link label
  • Leave only HTML
  • Leave only opening td tags
  • Leave only td tags
  • Minimal example using Ranges
  • Preserve indentation while collapsing whitespace around stripped tags
  • Leave JSP scriptlets intact while stripping HTML
  • Preserve punctuation around removed inline tags
  • Preserve literal comparison brackets in plain text
  • Insert spaces when removing tags between adjacent text
  • Map progress reporting into a custom percentage range
  • Remove all HTML from a string
  • Strip script tags but retain their text when paired-content removal is disabled
  • Strip HTML from a raw JSON string
  • Remove a selected tag pair together with its contents
  • Preserve custom elements while stripping recognised HTML tags
  • Set the title case using title package
  • Trim ordinary spaces while preserving tabs and line breaks
  • Orphan removal from text within HTML
  • Wrap a retained link destination with custom markers
↑ back to top

Quick Take

↑ back to top

Ignores code tags and their contents

↑ back to top

A bypass callback and a do-nothing callback

↑ back to top

Strip an entire CDATA section

↑ back to top

Decode HTML entities before recognising and stripping encoded tags

↑ back to top

Keep a link destination next to its label

↑ back to top

Put a retained link destination on a new paragraph

↑ back to top

Extract HTML <head> contents

↑ back to top

Strip an HTML comment and prevent adjacent text from joining

↑ back to top

Preserve selected tags while stripping the rest

↑ back to top

Strip a JSX component tag from surrounding text

↑ back to top

Retain href and link label

↑ back to top

Leave only HTML

↑ back to top

Leave only opening td tags

↑ back to top

Leave only td tags

↑ back to top

Minimal example using Ranges

↑ back to top

Preserve indentation while collapsing whitespace around stripped tags

↑ back to top

Leave JSP scriptlets intact while stripping HTML

↑ back to top

Preserve punctuation around removed inline tags

↑ back to top

Preserve literal comparison brackets in plain text

↑ back to top

Insert spaces when removing tags between adjacent text

↑ back to top

Map progress reporting into a custom percentage range

↑ back to top

Remove all HTML from a string

↑ back to top

Strip script tags but retain their text when paired-content removal is disabled

↑ back to top

Strip HTML from a raw JSON string

↑ back to top

Remove a selected tag pair together with its contents

↑ back to top

Preserve custom elements while stripping recognised HTML tags

↑ back to top

Set the title case using title package

↑ back to top

Trim ordinary spaces while preserving tabs and line breaks

↑ back to top

Orphan removal from text within HTML

↑ back to top

Wrap a retained link destination with custom markers

↑ back to top
back 

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab