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.

280 B
Raw Blame
// Skip code spans and fenced code blocks — backslashes inside them are literals, not escapes.
export const unescapeMarkdown = (str: string): string =>
  str.replaceAll(
    /(```[\s\S]*?```|`[^`\n]*`)|\\([\\`*_{}[\]()#+\-.!])/g,
    (_, code, escaped) => code ?? escaped,
  );