1---2name: bun-escape-an-html-string3description: Escape an HTML string4---56# Escape an HTML string78The `Bun.escapeHTML()` utility can be used to escape HTML characters in a string. The following replacements are made.910* `"` becomes `"""`11* `&` becomes `"&"`12* `'` becomes `"'"`13* `<` becomes `"<"`14* `>` becomes `">"`1516This function is optimized for large input. Non-string types will be converted to a string before escaping.1718```ts theme={"theme":{"light":"github-light","dark":"dracula"}}19Bun.escapeHTML("<script>alert('Hello World!')</script>");20// <script>alert('Hello World!')</script>21```2223***2425See [Docs > API > Utils](/runtime/utils) for more useful utilities.
Run npx skillmds@latest add jarle/bun-escape-an-html-string in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Escape an HTML string It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
jarle (@jarle) published this skill. Their other Agent Skills are listed on their SkillMD profile.