style:spec文档的markdown样式适配

This commit is contained in:
Roe-xin
2026-01-12 14:03:20 +08:00
parent faa7b63aee
commit d08f9a7366

View File

@ -62,9 +62,9 @@ export function getPlanCardStyles(): string {
.plan-summary p { margin: 8px 0; }
.plan-summary ul, .plan-summary ol {
margin: 8px 0;
padding-left: 24px;
padding-left: 0;
}
.plan-summary li { margin: 4px 0; }
.plan-summary li { margin: 4px 0 4px 27px; }
.plan-summary code {
background: var(--vscode-textCodeBlock-background);
padding: 2px 6px;
@ -392,6 +392,12 @@ export function getPlanCardScript(): string {
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
// 标题(必须在转义之后、其他处理之前)
html = html.replace(/^#### (.+)$/gm, '<h4>$1</h4>');
html = html.replace(/^### (.+)$/gm, '<h3>$1</h3>');
html = html.replace(/^## (.+)$/gm, '<h2>$1</h2>');
html = html.replace(/^# (.+)$/gm, '<h1>$1</h1>');
// 代码块 (\`\`\`code\`\`\`)
html = html.replace(/\\x60\\x60\\x60([\\s\\S]*?)\\x60\\x60\\x60/g, '<pre><code>$1</code></pre>');
@ -417,12 +423,6 @@ export function getPlanCardScript(): string {
return table;
});
// 标题
html = html.replace(/^#### (.+)$/gm, '<h4>$1</h4>');
html = html.replace(/^### (.+)$/gm, '<h3>$1</h3>');
html = html.replace(/^## (.+)$/gm, '<h2>$1</h2>');
html = html.replace(/^# (.+)$/gm, '<h1>$1</h1>');
// 粗体和斜体
html = html.replace(/\\*\\*(.+?)\\*\\*/g, '<strong>$1</strong>');
html = html.replace(/\\*(.+?)\\*/g, '<em>$1</em>');