MCPcopy Create free account
hub / github.com/Alibaba-NLP/DeepResearch / clean_markdown

Function clean_markdown

WebAgent/WebWalker/src/utils.py:17–34  ·  view source on GitHub ↗

Args: res (str): markdown content Returns: str: cleaned markdown content

(res)

Source from the content-addressed store, hash-verified

15
16
17def clean_markdown(res):
18 """
19 Args:
20 res (str): markdown content
21
22 Returns:
23 str: cleaned markdown content
24 """
25 pattern = r'\[.*?\]\(.*?\)'
26 try:
27 result = re.sub(pattern, '', res)
28 url_pattern = pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
29 result = re.sub(url_pattern, '', result)
30 result = result.replace("* \n","")
31 result = re.sub(r"\n\n+", "\n", result)
32 return result
33 except Exception:
34 return res
35
36async def get_info(url, screenshot = True) -> str:
37 """

Callers 1

get_infoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected