Expand description
Inline markup parser for ChordPro lyrics text.
ChordPro lyrics can contain inline markup tags for formatting:
<bold>text</bold>or<b>text</b>— bold text<italic>text</italic>or<i>text</i>— italic text<highlight>text</highlight>— highlighted text<comment>text</comment>— comment-styled text<span font_family="..." size="..." foreground="...">text</span>— styled text
Tags may be nested: <b><i>text</i></b>.
Unclosed tags wrap all remaining text (per ChordPro spec). Unrecognized or malformed tags are treated as plain text (graceful degradation).
§Examples
use chordsketch_core::inline_markup::{TextSpan, parse_inline_markup};
let spans = parse_inline_markup("<b>Hello</b> world");
assert_eq!(spans, vec![
TextSpan::Bold(vec![TextSpan::Plain("Hello".to_string())]),
TextSpan::Plain(" world".to_string()),
]);Structs§
- Span
Attributes - Attributes for a
<span>inline markup tag.
Enums§
- Text
Span - A segment of text that may contain inline markup formatting.
Functions§
- has_
inline_ markup - Returns
trueif the input text contains any inline markup tags. - parse_
inline_ markup - Parses inline markup tags from text and returns a list of
TextSpans. - spans_
to_ plain_ text - Extracts the plain text content from a list of spans, stripping all markup.