code: def escape_markdown(raw_string: str) -> str:
      r"""Returns a new string which escapes all markdown metacharacters.
  
      Args
      ----
      raw_string : str
          A string, possibly with markdown metacharacters, e.g. "1 * 2"
  
      Returns
      -------
      A string with all metacharacters escaped.
  
      Examples
      --------
      ::
          escape_markdown("1 * 2") -> "1 \\* 2"
      """
      metacharacters = ["\\", "*", "-", "=", "`", "!", "#", "|"]
      result = raw_string
      for character in metacharacters:
          result = result.replace(character, "\\" + character)
      return result
  
file_path: streamlit/lib/streamlit/string_util.py
imports: import re
  import textwrap
  from typing import TYPE_CHECKING, Any, Optional, Tuple, cast
  from streamlit.emojis import ALL_EMOJIS
  from streamlit.errors import StreamlitAPIException
label_desc: Use image node_id 6 for calling a global function with example usage: escape_markdown(raw_string) and returns: result