Skip to main content

strip_tags

Function strip_tags 

Source
pub fn strip_tags(input: &str) -> String
Expand description

Strips all BBCode-style tags from input, returning only visible content.

This is a convenience function that creates a parser in TagTransform::Remove mode with UnknownTagBehavior::Strip to remove all tags (both known and unknown).

Useful for measuring the visible width of text that may contain inline markup.

ยงExample

use standout_bbparser::strip_tags;

assert_eq!(strip_tags("[bold]hello[/bold]"), "hello");
assert_eq!(strip_tags("[additions]+32[/additions]/[deletions]-0[/deletions]/32"), "+32/-0/32");
assert_eq!(strip_tags("no tags here"), "no tags here");