(html: str)
| 163 | |
| 164 | |
| 165 | def _html_metrics(html: str) -> dict[str, Any]: |
| 166 | parser = TagCounter() |
| 167 | parser.feed(html) |
| 168 | tags = {tag: parser.tags.get(tag, 0) for tag in _TAGS} |
| 169 | return { |
| 170 | "tags": tags, |
| 171 | "data_chars": parser.data_chars, |
| 172 | "max_depth": parser.max_depth, |
| 173 | "chars": {ch: parser.char_hist.get(ch, 0) for ch in _SENSITIVE_CHARS}, |
| 174 | } |
| 175 | |
| 176 | |
| 177 | def _filtered_metrics(markdown: str) -> dict[str, Any]: |