Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
| 2070 |
|
| 2071 |
-
return f"[{text}]({
|
| 2072 |
|
| 2073 |
# Fix Markdown links dynamically
|
| 2074 |
-
formatted_text = re.sub(pattern,
|
| 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)
|