ParsedBody extracts the injection-reduced text (see ParsedView.Text). truncated is true when the cap cut content. maxBytes <= 0 uses DefaultMaxBytes. Retained for callers that only need the text; callers wanting HTML use Parse.
(raw []byte, maxBytes int)
| 86 | // truncated is true when the cap cut content. maxBytes <= 0 uses DefaultMaxBytes. |
| 87 | // Retained for callers that only need the text; callers wanting HTML use Parse. |
| 88 | func ParsedBody(raw []byte, maxBytes int) (text string, truncated bool) { |
| 89 | v := Parse(raw, maxBytes) |
| 90 | return v.Text, v.Truncated |
| 91 | } |
| 92 | |
| 93 | // runeBoundary returns the largest index <= n that doesn't split a UTF-8 rune, |
| 94 | // so truncating at it never yields an invalid encoding. |