The five-character minimum
For safely inserting user-provided text into HTML, you only need to escape five characters:
&→&(must come first, or you double-escape later substitutions)<→<>→>"→"(only matters inside double-quoted attributes)'→'(only inside single-quoted attributes — we emit numeric for HTML4 safety)
That's the "Minimal" strategy in the encoder above. It's idiomatic for any modern templating pipeline and matches what frameworks like React, Vue and Astro produce automatically.