Skip to main content

tablo_test/protocol/
rich_text.rs

1//! Reads the rich text values a detail page renders: each one's HTML sits in an element carrying
2//! `data-rich-text-value`.
3
4use super::dom::{attr_value, tags_where};
5
6/// The HTML of each rich text value `html` renders, in document order.
7pub fn rich_text_values(html: &str) -> Vec<String> {
8    tags_where(html, |_, attrs| {
9        attr_value(attrs, "data-rich-text-value").is_some()
10    })
11    .into_iter()
12    .map(|(_, _, inner)| inner)
13    .collect()
14}