fix: 保留 Markdown 格式不过滤
This commit is contained in:
@@ -248,13 +248,6 @@ URL:{url}
|
||||
# 提取各部分(使用正则)
|
||||
lines = analysis_text.split('\n')
|
||||
|
||||
# 清理 Markdown 符号的辅助函数
|
||||
def clean_markdown(text):
|
||||
text = re.sub(r'\*\*([^*]+)\*\*', r'\1', text)
|
||||
text = re.sub(r'\*([^*]+)\*', r'\1', text)
|
||||
text = re.sub(r'#+\s*', '', text)
|
||||
return text.strip()
|
||||
|
||||
# 简单解析:按 ## 标题分割
|
||||
current_section = ""
|
||||
in_section = None
|
||||
@@ -287,10 +280,6 @@ URL:{url}
|
||||
if not content:
|
||||
return
|
||||
|
||||
# 清理 content 中的 Markdown
|
||||
content = re.sub(r'\*\*([^*]+)\*\*', r'\1', content)
|
||||
content = re.sub(r'\*([^*]+)\*', r'\1', content)
|
||||
|
||||
section_lower = section_name.lower()
|
||||
|
||||
if '摘要' in section_lower:
|
||||
@@ -467,11 +456,8 @@ def main():
|
||||
print(f"[Main] 开始分析...")
|
||||
result = analyzer.analyze(metadata, content)
|
||||
|
||||
# 清理 Markdown 符号
|
||||
# 使用 AI 生成的原始内容(保留 Markdown 格式)
|
||||
full_analysis = result.full_analysis
|
||||
full_analysis = re.sub(r'^#+\s*', '', full_analysis, flags=re.MULTILINE)
|
||||
full_analysis = re.sub(r'\*\*([^*]+)\*\*', r'\1', full_analysis)
|
||||
full_analysis = re.sub(r'\*([^*]+)\*', r'\1', full_analysis)
|
||||
|
||||
# 删除内容中的"标签" section(只保留 frontmatter 中的 tags)
|
||||
# 匹配 ## 标签 或 标签(无##)到下一个 ## 或文件结尾之间的内容
|
||||
|
||||
Reference in New Issue
Block a user