Commit f5683e1f authored by 水玉婷's avatar 水玉婷
Browse files

feat:优化md引用块

parent e34be04d
......@@ -83,7 +83,13 @@ export const parseMarkdown = (text: string): string => {
}
// 处理引用块(必须在HTML转义之前,避免>被转义为>)
text = text.replace(/^>\s*(.*)$/gim, '<blockquote>$1</blockquote>');
// 改进的多行引用块处理,支持连续引用行
text = text.replace(/^>\s*(.*(?:\n>\s*.*)*)$/gim, (match, content) => {
// 将多行引用内容合并,并用<br>分隔
const lines = content.split(/\n>\s*/);
const processedContent = lines.map(line => line.trim()).join('<br>');
return `<blockquote>${processedContent}</blockquote>`;
});
// 处理图片(必须在任何格式处理之前,避免图片格式被破坏)
text = text.replace(/!\[([^\]]*)\]\(([^\)]+)\)/g, (match, alt, src) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment