export const MARKDOWN_V2_SPECIAL_CHARS = [
  "_", "*", "[", "]", "(", ")", "~", "`", ">", "#", "+", "-", "=", "|", "{", "}", ".", "!",
] as const

export function escapeMarkdownV2(text: string): string {
  let out = ""
  for (const ch of text) {
    if ((MARKDOWN_V2_SPECIAL_CHARS as readonly string[]).includes(ch)) {
      out += "\\" + ch
    } else {
      out += ch
    }
  }
  return out
}