code: def normalize_md(txt):
      """Replace newlines *inside paragraphs* with spaces.
  
      Consecutive lines of text are considered part of the same paragraph
      in Markdown. So this function joins those into a single line to make the
      test robust to changes in text wrapping.
  
      NOTE: This function doesn't attempt to be 100% grammatically correct
      Markdown! It's just supposed to be "correct enough" for tests to pass. For
      example, when we guard "\n\n" from being converted, we really should be
      guarding for RegEx("\n\n+") instead. But that doesn't matter for our tests.
      """
      # Two newlines in a row should NOT be replaced with a space.
      txt = txt.replace("\n\n", "OMG_NEWLINE")
  
      # Lists should NOT be replaced with a space.
      txt = txt.replace("\n*", "OMG_STAR")
      txt = txt.replace("\n-", "OMG_HYPHEN")
  
      # Links broken over two lines should not get an extra space.
      txt = txt.replace("]\n(", "OMG_LINK")
  
      # Convert all remaining newlines into spaces.
      txt = txt.replace("\n", " ")
  
      # Restore everything else.
      txt = txt.replace("OMG_NEWLINE", "\n\n")
      txt = txt.replace("OMG_STAR", "\n*")
      txt = txt.replace("OMG_HYPHEN", "\n-")
      txt = txt.replace("OMG_LINK", "](")
  
      return txt.strip()
  
imports: import threading
  import types
  from unittest.mock import Mock, patch
  from parameterized import parameterized
  import streamlit
  from streamlit.elements import exception
  from streamlit.proto.Exception_pb2 import Exception
  from streamlit.runtime.legacy_caching import caching, hashing
  from tests import testutil
  from tests.delta_generator_test_case import DeltaGeneratorTestCase
label_desc: Use image node_id 1 for calling a global function with example usage: normalize_md(txt) and returns: txt