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

backOpen Source→string-strip-html→Examples

Permalink to Table of ContentsTable 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
  • Trim ordinary spaces while preserving tabs and line breaks
  • Prevent widow words while preserving HTML
  • Wrap a retained link destination with custom markers
↑ back to top

Permalink to Quick TakeQuick Take

↑ back to top

Permalink to Ignores code tags and their contentsIgnores code tags and their contents

↑ back to top

Permalink to A bypass callback and a do-nothing callbackA bypass callback and a do-nothing callback

↑ back to top

Permalink to Strip an entire CDATA sectionStrip an entire CDATA section

↑ back to top

Permalink to Decode HTML entities before recognising and stripping encoded tagsDecode HTML entities before recognising and stripping encoded tags

↑ back to top

Permalink to Keep a link destination next to its labelKeep a link destination next to its label

↑ back to top

Permalink to Put a retained link destination on a new paragraphPut a retained link destination on a new paragraph

↑ back to top

Permalink to Extract HTML contentsExtract HTML <head> contents

↑ back to top

Permalink to Strip an HTML comment and prevent adjacent text from joiningStrip an HTML comment and prevent adjacent text from joining

↑ back to top

Permalink to Preserve selected tags while stripping the restPreserve selected tags while stripping the rest

↑ back to top

Permalink to Strip a JSX component tag from surrounding textStrip a JSX component tag from surrounding text

↑ back to top

Permalink to Retain href and link labelRetain href and link label

↑ back to top

Permalink to Leave only HTMLLeave only HTML

↑ back to top

Permalink to Leave only opening td tagsLeave only opening td tags

↑ back to top

Permalink to Leave only td tagsLeave only td tags

↑ back to top

Permalink to Minimal example using RangesMinimal example using Ranges

↑ back to top

Permalink to Preserve indentation while collapsing whitespace around stripped tagsPreserve indentation while collapsing whitespace around stripped tags

↑ back to top

Permalink to Leave JSP scriptlets intact while stripping HTMLLeave JSP scriptlets intact while stripping HTML

↑ back to top

Permalink to Preserve punctuation around removed inline tagsPreserve punctuation around removed inline tags

↑ back to top

Permalink to Preserve literal comparison brackets in plain textPreserve literal comparison brackets in plain text

↑ back to top

Permalink to Insert spaces when removing tags between adjacent textInsert spaces when removing tags between adjacent text

↑ back to top

Permalink to Map progress reporting into a custom percentage rangeMap progress reporting into a custom percentage range

↑ back to top

Permalink to Remove all HTML from a stringRemove all HTML from a string

↑ back to top

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

↑ back to top

Permalink to Strip HTML from a raw JSON stringStrip HTML from a raw JSON string

↑ back to top

Permalink to Remove a selected tag pair together with its contentsRemove a selected tag pair together with its contents

↑ back to top

Permalink to Preserve custom elements while stripping recognised HTML tagsPreserve custom elements while stripping recognised HTML tags

↑ back to top

Permalink to Trim ordinary spaces while preserving tabs and line breaksTrim ordinary spaces while preserving tabs and line breaks

↑ back to top

Permalink to Prevent widow words while preserving HTMLPrevent widow words while preserving HTML

↑ back to top

Permalink to Wrap a retained link destination with custom markersWrap 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