@@ -143,6 +143,9 @@ export class ChatPanel {
143143 color: white !important;
144144 background-color: transparent !important;
145145 }
146+ .katex-display > .katex {
147+ padding: 1em 0;
148+ }
146149 #input-container {
147150 position: fixed;
148151 bottom: 0;
@@ -208,6 +211,8 @@ export class ChatPanel {
208211 // 解析Markdown
209212 targetDiv.innerHTML = marked.parse(targetDiv.dataset.markdownContent, {
210213 breaks: true,
214+ mangle: false,
215+ headerIds: false,
211216 highlight: (code, lang) => {
212217 const validLang = hljs.getLanguage(lang) ? lang : 'plaintext';
213218 return hljs.highlight(code, { language: validLang }).value;
@@ -218,10 +223,24 @@ export class ChatPanel {
218223 renderMathInElement(targetDiv, {
219224 delimiters: [
220225 { left: '$$', right: '$$', display: true },
221- { left: '$', right: '$', display: false }
226+ { left: '$', right: '$', display: false },
227+ { left: '\\[', right: '\\]', display: true },
228+ { left: '\\(', right: '\\)', display: false }
222229 ],
223230 throwOnError: false
224231 });
232+ setTimeout(() => {
233+ renderMathInElement(targetDiv, {
234+ delimiters: [
235+ { left: '$$', right: '$$', display: true },
236+ { left: '$', right: '$', display: false },
237+ { left: '\\[', right: '\\]', display: true },
238+ { left: '\\(', right: '\\)', display: false }
239+ ],
240+ throwOnError: false
241+ });
242+ hljs.highlightAll();
243+ }, 0);
225244
226245 // 重新高亮代码块
227246 hljs.highlightAll();
0 commit comments