MCPcopy Index your code
hub / github.com/idank/explainshell / render_markdown

Function render_markdown

explainshell/web/markdown.py:7–15  ·  view source on GitHub ↗

Convert markdown text to HTML. Falls through to escaped text on error.

(text: str)

Source from the content-addressed store, hash-verified

5
6
7def render_markdown(text: str) -> str:
8 """Convert markdown text to HTML. Falls through to escaped text on error."""
9 try:
10 # Escape bare <word> placeholders (e.g. <newbase>, <file>) so the
11 # markdown library doesn't swallow them as HTML tags.
12 text = re.sub(r"<([^>]+)>", r"&lt;\1&gt;", text)
13 return cmarkgfm.markdown_to_html(text)
14 except Exception:
15 return markupsafe.escape(text)

Callers 8

manpageFunction · 0.90
_handle_explain_cmdFunction · 0.90
explain_programFunction · 0.90
_render_pageFunction · 0.90
test_bold_and_italicMethod · 0.85

Calls

no outgoing calls