package materialize
import (
"strings"
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown/v2"
"github.com/rivo/uniseg"
"tidepool/internal/ap"
)
// HTML→markdown strategy: Lemmy sends both rendered HTML (`content`) and the
// author's original markdown (`source.content`, mediaType text/markdown) on
// nearly every object. The original markdown is always preferred — it is
// exactly what the author wrote and needs no conversion. Only when `source`
// is absent (some PieFed/Mbin objects, older Lemmy) do we convert the HTML,
// using the established JohannesKaufmann/html-to-markdown library (v2)
// rather than a hand-rolled converter: it handles entity decoding, nested
// lists, blockquotes, and — security-relevant here — drops