Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

377 B
Raw Blame
/** Escape text for the XML-like blocks wake prompts are written in; newlines stay on one line. */
export const escapeXmlText = (text: string) =>
  text
    .replaceAll('&', '&')
    .replaceAll('<', '&lt;')
    .replaceAll('>', '&gt;')
    .replaceAll(/\r?\n/g, '&#10;');

export const escapeXmlAttribute = (text: string) => escapeXmlText(text).replaceAll('"', '&quot;');