Wajahat698 commited on
Commit
7d5c9b1
·
verified ·
1 Parent(s): fe85f8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2066,12 +2066,12 @@ def clean_and_format_markdown(raw_text):
2066
  text = match.group(1)
2067
  url = match.group(2).strip() # Remove leading/trailing spaces
2068
  encoded_url = quote(url, safe=':/') # Encode the URL while keeping : and /
2069
- corrected_url = encoded_url.replace("+", "%20")
2070
 
2071
- return f"[{text}]({corrected_url})"
2072
 
2073
  # Fix Markdown links dynamically
2074
- formatted_text = re.sub(pattern, corrected_url, raw_text)
2075
 
2076
  # Replace single newlines with spaces to avoid breaking Markdown rendering
2077
  formatted_text = re.sub(r'(?<!\n)\n(?!\n)', ' ', formatted_text)
 
2066
  text = match.group(1)
2067
  url = match.group(2).strip() # Remove leading/trailing spaces
2068
  encoded_url = quote(url, safe=':/') # Encode the URL while keeping : and /
2069
+ encoded_url = encoded_url.replace("+", "%20")
2070
 
2071
+ return f"[{text}]({encoded_url})"
2072
 
2073
  # Fix Markdown links dynamically
2074
+ formatted_text = re.sub(pattern, encoded_url, raw_text)
2075
 
2076
  # Replace single newlines with spaces to avoid breaking Markdown rendering
2077
  formatted_text = re.sub(r'(?<!\n)\n(?!\n)', ' ', formatted_text)