Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
fe45f69
1
Parent(s):
a2dfe6a
加回代码高亮,但去除空行,以解决乱码问题。
Browse files
utils.py
CHANGED
|
@@ -95,7 +95,8 @@ def convert_mdtext(md_text):
|
|
| 95 |
non_code = normalize_markdown(non_code)
|
| 96 |
result.append(mdtex2html.convert(non_code, extensions=["tables"]))
|
| 97 |
if code.strip():
|
| 98 |
-
_, code = detect_language(code) # 暂时去除代码高亮功能,因为在大段代码的情况下会出现问题
|
|
|
|
| 99 |
code = f"```{code}\n\n```"
|
| 100 |
code = markdown_to_html_with_syntax_highlight(code)
|
| 101 |
result.append(code)
|
|
|
|
| 95 |
non_code = normalize_markdown(non_code)
|
| 96 |
result.append(mdtex2html.convert(non_code, extensions=["tables"]))
|
| 97 |
if code.strip():
|
| 98 |
+
# _, code = detect_language(code) # 暂时去除代码高亮功能,因为在大段代码的情况下会出现问题
|
| 99 |
+
code = code.replace("\n\n", "\n") # 暂时去除代码中的空行,因为在大段代码的情况下会出现问题
|
| 100 |
code = f"```{code}\n\n```"
|
| 101 |
code = markdown_to_html_with_syntax_highlight(code)
|
| 102 |
result.append(code)
|