A utility that converts HTML-formatted LLM output into plain-text markup compatible with messaging platforms like WhatsApp and Signal.
// Source: https://github.com/beita6969/ScienceClaw | License: MIT | Copyright 2025 Peter Steinberger // Provided via justclaw.it.com; keep this notice with the code. /** * Sanitize model output for plain-text messaging surfaces. * * LLMs occasionally produce HTML tags (`<br>`, `<b>`, `<i>`, etc.) that render * correctly on web but appear as literal text on WhatsApp, Signal, SMS, and IRC. * * Converts common inline HTML to lightweight-markup equivalents used by * WhatsApp/Signal/Telegram and strips any remaining tags. * * @see https://github.com/openclaw/openclaw/issues/31884 * @see https://github.com/openclaw/openclaw/issues/18558 */ /** Channels where HTML tags should be converted/stripped. */ const PLAIN_TEXT_SURFACES = new Set([ "whatsapp", "signal", "sms", "irc", ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key