@huyooo/ai-chat-shared 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +42 -12
- package/dist/index.js +335 -36
- package/dist/index.js.map +1 -1
- package/dist/styles.css +274 -22
- package/package.json +7 -3
- package/src/index.ts +15 -2
- package/src/markdown.ts +262 -6
- package/src/parser.ts +60 -30
- package/src/styles.css +274 -22
- package/src/types.ts +0 -13
- package/src/visual.ts +68 -0
package/src/styles.css
CHANGED
|
@@ -295,6 +295,8 @@
|
|
|
295
295
|
overflow-x: auto;
|
|
296
296
|
margin: 1em 0;
|
|
297
297
|
border-radius: 8px;
|
|
298
|
+
/* 确保滚动条始终可见(内容超出时) */
|
|
299
|
+
scrollbar-gutter: stable;
|
|
298
300
|
}
|
|
299
301
|
|
|
300
302
|
/* 统一滚动条样式 */
|
|
@@ -316,9 +318,10 @@
|
|
|
316
318
|
background: var(--chat-scrollbar-hover, rgba(255, 255, 255, 0.3));
|
|
317
319
|
}
|
|
318
320
|
|
|
319
|
-
/*
|
|
320
|
-
.markdown-table {
|
|
321
|
-
width: 100%;
|
|
321
|
+
/* 表格(仅在 markdown 容器内生效,避免影响业务里其它同名 class) */
|
|
322
|
+
.markdown-content .markdown-table {
|
|
323
|
+
min-width: 100%;
|
|
324
|
+
width: max-content;
|
|
322
325
|
border-collapse: separate;
|
|
323
326
|
border-spacing: 0;
|
|
324
327
|
margin: 0;
|
|
@@ -329,11 +332,11 @@
|
|
|
329
332
|
}
|
|
330
333
|
|
|
331
334
|
/* 表头样式 */
|
|
332
|
-
.markdown-table thead {
|
|
335
|
+
.markdown-content .markdown-table thead {
|
|
333
336
|
display: table-header-group;
|
|
334
337
|
}
|
|
335
338
|
|
|
336
|
-
.markdown-table th {
|
|
339
|
+
.markdown-content .markdown-table th {
|
|
337
340
|
padding: 0.875em 1em;
|
|
338
341
|
text-align: left;
|
|
339
342
|
font-weight: 600;
|
|
@@ -344,16 +347,16 @@
|
|
|
344
347
|
background: transparent;
|
|
345
348
|
}
|
|
346
349
|
|
|
347
|
-
.markdown-table th:last-child {
|
|
350
|
+
.markdown-content .markdown-table th:last-child {
|
|
348
351
|
border-right: none;
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
/* 表格内容样式 */
|
|
352
|
-
.markdown-table tbody {
|
|
355
|
+
.markdown-content .markdown-table tbody {
|
|
353
356
|
display: table-row-group;
|
|
354
357
|
}
|
|
355
358
|
|
|
356
|
-
.markdown-table td {
|
|
359
|
+
.markdown-content .markdown-table td {
|
|
357
360
|
padding: 0.875em 1em;
|
|
358
361
|
text-align: left;
|
|
359
362
|
color: var(--chat-text, #ccc);
|
|
@@ -363,53 +366,53 @@
|
|
|
363
366
|
vertical-align: top;
|
|
364
367
|
}
|
|
365
368
|
|
|
366
|
-
.markdown-table td:last-child {
|
|
369
|
+
.markdown-content .markdown-table td:last-child {
|
|
367
370
|
border-right: none;
|
|
368
371
|
}
|
|
369
372
|
|
|
370
|
-
.markdown-table tbody tr:last-child td {
|
|
373
|
+
.markdown-content .markdown-table tbody tr:last-child td {
|
|
371
374
|
border-bottom: none;
|
|
372
375
|
}
|
|
373
376
|
|
|
374
377
|
/* 表格行悬停效果(可选,保持简洁) */
|
|
375
|
-
.markdown-table tbody tr {
|
|
378
|
+
.markdown-content .markdown-table tbody tr {
|
|
376
379
|
transition: opacity 0.15s ease;
|
|
377
380
|
}
|
|
378
381
|
|
|
379
382
|
/* 表格中的图标和特殊内容 */
|
|
380
|
-
.markdown-table td img,
|
|
381
|
-
.markdown-table td svg,
|
|
382
|
-
.markdown-table th img,
|
|
383
|
-
.markdown-table th svg {
|
|
383
|
+
.markdown-content .markdown-table td img,
|
|
384
|
+
.markdown-content .markdown-table td svg,
|
|
385
|
+
.markdown-content .markdown-table th img,
|
|
386
|
+
.markdown-content .markdown-table th svg {
|
|
384
387
|
vertical-align: middle;
|
|
385
388
|
margin-right: 0.5em;
|
|
386
389
|
display: inline-block;
|
|
387
390
|
}
|
|
388
391
|
|
|
389
392
|
/* 表格中的进度条、星级等 */
|
|
390
|
-
.markdown-table td .progress,
|
|
391
|
-
.markdown-table td .stars {
|
|
393
|
+
.markdown-content .markdown-table td .progress,
|
|
394
|
+
.markdown-content .markdown-table td .stars {
|
|
392
395
|
display: inline-flex;
|
|
393
396
|
align-items: center;
|
|
394
397
|
gap: 0.25em;
|
|
395
398
|
}
|
|
396
399
|
|
|
397
400
|
/* 表格中的代码块 */
|
|
398
|
-
.markdown-table td code,
|
|
399
|
-
.markdown-table th code {
|
|
401
|
+
.markdown-content .markdown-table td code,
|
|
402
|
+
.markdown-content .markdown-table th code {
|
|
400
403
|
font-size: 0.85em;
|
|
401
404
|
padding: 0.15em 0.35em;
|
|
402
405
|
}
|
|
403
406
|
|
|
404
407
|
/* 表格响应式 */
|
|
405
408
|
@media (max-width: 768px) {
|
|
406
|
-
.markdown-table {
|
|
409
|
+
.markdown-content .markdown-table {
|
|
407
410
|
font-size: 13px;
|
|
408
411
|
border-radius: 6px;
|
|
409
412
|
}
|
|
410
413
|
|
|
411
|
-
.markdown-table th,
|
|
412
|
-
.markdown-table td {
|
|
414
|
+
.markdown-content .markdown-table th,
|
|
415
|
+
.markdown-content .markdown-table td {
|
|
413
416
|
padding: 0.6em 0.8em;
|
|
414
417
|
}
|
|
415
418
|
}
|
|
@@ -503,3 +506,252 @@
|
|
|
503
506
|
user-select: none;
|
|
504
507
|
opacity: 0.5;
|
|
505
508
|
}
|
|
509
|
+
|
|
510
|
+
/* ============================================
|
|
511
|
+
LaTeX 数学公式样式
|
|
512
|
+
============================================ */
|
|
513
|
+
|
|
514
|
+
/* 块级公式 */
|
|
515
|
+
.latex-block {
|
|
516
|
+
display: block;
|
|
517
|
+
margin: 1em 0;
|
|
518
|
+
padding: 0.75em 1em;
|
|
519
|
+
overflow-x: auto;
|
|
520
|
+
background: var(--chat-latex-bg, rgba(255, 255, 255, 0.02));
|
|
521
|
+
border-radius: 8px;
|
|
522
|
+
border: 1px solid var(--chat-border, rgba(255, 255, 255, 0.08));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* LaTeX fenced 代码块渲染:嵌在代码块容器内时由外层负责卡片与 padding,避免套娃 */
|
|
526
|
+
.code-block-wrapper .latex-rendered {
|
|
527
|
+
margin: 0;
|
|
528
|
+
padding: 14px 18px;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.code-block-wrapper .latex-rendered .latex-block {
|
|
532
|
+
margin: 0;
|
|
533
|
+
padding: 0;
|
|
534
|
+
background: transparent;
|
|
535
|
+
border: none;
|
|
536
|
+
border-radius: 0;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.latex-block .katex-display {
|
|
540
|
+
margin: 0;
|
|
541
|
+
overflow-x: auto;
|
|
542
|
+
overflow-y: hidden;
|
|
543
|
+
text-align: left;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.latex-block .katex {
|
|
547
|
+
text-align: left;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/* 行内公式 */
|
|
551
|
+
.latex-inline {
|
|
552
|
+
display: inline;
|
|
553
|
+
padding: 0 0.15em;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/* 公式错误提示 */
|
|
557
|
+
.latex-error {
|
|
558
|
+
color: var(--chat-error, #ef4444);
|
|
559
|
+
background: rgba(239, 68, 68, 0.1);
|
|
560
|
+
padding: 0.2em 0.4em;
|
|
561
|
+
border-radius: 4px;
|
|
562
|
+
font-family: monospace;
|
|
563
|
+
font-size: 0.9em;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/* KaTeX 样式覆盖 - 适配暗色主题 */
|
|
567
|
+
.katex {
|
|
568
|
+
font-size: 1.1em;
|
|
569
|
+
color: var(--chat-text, #e5e7eb);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.katex .mord,
|
|
573
|
+
.katex .mop,
|
|
574
|
+
.katex .mrel,
|
|
575
|
+
.katex .mbin,
|
|
576
|
+
.katex .mpunct,
|
|
577
|
+
.katex .mopen,
|
|
578
|
+
.katex .mclose,
|
|
579
|
+
.katex .minner {
|
|
580
|
+
color: inherit;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/* KaTeX 分数线颜色 */
|
|
584
|
+
.katex .frac-line {
|
|
585
|
+
background: var(--chat-text, #e5e7eb);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/* KaTeX 根号 */
|
|
589
|
+
.katex .sqrt > .sqrt-sign {
|
|
590
|
+
color: var(--chat-text, #e5e7eb);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/* KaTeX 矩阵边框 */
|
|
594
|
+
.katex .mord.mtight,
|
|
595
|
+
.katex .delimsizing {
|
|
596
|
+
color: var(--chat-text, #e5e7eb);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/* ==================== Markdown 滚动条样式(与系统 chat-scrollbar 对齐) ==================== */
|
|
600
|
+
/* 说明:
|
|
601
|
+
* - table/pre/code/latex/mermaid 等在 markdown 中都会产生横向/纵向滚动
|
|
602
|
+
* - 这里统一使用系统变量 --chat-scrollbar / --chat-scrollbar-hover
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
.markdown-content pre::-webkit-scrollbar,
|
|
606
|
+
.text-block pre::-webkit-scrollbar,
|
|
607
|
+
.markdown-code-block::-webkit-scrollbar,
|
|
608
|
+
.markdown-content .markdown-table-wrapper::-webkit-scrollbar,
|
|
609
|
+
.text-block .markdown-table-wrapper::-webkit-scrollbar,
|
|
610
|
+
.latex-block::-webkit-scrollbar,
|
|
611
|
+
.mermaid-rendered::-webkit-scrollbar,
|
|
612
|
+
.mermaid-source::-webkit-scrollbar {
|
|
613
|
+
width: 6px;
|
|
614
|
+
height: 6px;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.markdown-content pre::-webkit-scrollbar-track,
|
|
618
|
+
.text-block pre::-webkit-scrollbar-track,
|
|
619
|
+
.markdown-code-block::-webkit-scrollbar-track,
|
|
620
|
+
.markdown-content .markdown-table-wrapper::-webkit-scrollbar-track,
|
|
621
|
+
.text-block .markdown-table-wrapper::-webkit-scrollbar-track,
|
|
622
|
+
.latex-block::-webkit-scrollbar-track,
|
|
623
|
+
.mermaid-rendered::-webkit-scrollbar-track,
|
|
624
|
+
.mermaid-source::-webkit-scrollbar-track {
|
|
625
|
+
background: transparent;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.markdown-content pre::-webkit-scrollbar-thumb,
|
|
629
|
+
.text-block pre::-webkit-scrollbar-thumb,
|
|
630
|
+
.markdown-code-block::-webkit-scrollbar-thumb,
|
|
631
|
+
.markdown-content .markdown-table-wrapper::-webkit-scrollbar-thumb,
|
|
632
|
+
.text-block .markdown-table-wrapper::-webkit-scrollbar-thumb,
|
|
633
|
+
.latex-block::-webkit-scrollbar-thumb,
|
|
634
|
+
.mermaid-rendered::-webkit-scrollbar-thumb,
|
|
635
|
+
.mermaid-source::-webkit-scrollbar-thumb {
|
|
636
|
+
background: var(--chat-scrollbar, rgba(255, 255, 255, 0.2));
|
|
637
|
+
border-radius: 3px;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.markdown-content pre::-webkit-scrollbar-thumb:hover,
|
|
641
|
+
.text-block pre::-webkit-scrollbar-thumb:hover,
|
|
642
|
+
.markdown-code-block::-webkit-scrollbar-thumb:hover,
|
|
643
|
+
.markdown-content .markdown-table-wrapper::-webkit-scrollbar-thumb:hover,
|
|
644
|
+
.text-block .markdown-table-wrapper::-webkit-scrollbar-thumb:hover,
|
|
645
|
+
.latex-block::-webkit-scrollbar-thumb:hover,
|
|
646
|
+
.mermaid-rendered::-webkit-scrollbar-thumb:hover,
|
|
647
|
+
.mermaid-source::-webkit-scrollbar-thumb:hover {
|
|
648
|
+
background: var(--chat-scrollbar-hover, rgba(255, 255, 255, 0.3));
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/* ==================== Mermaid 图表样式 ==================== */
|
|
652
|
+
|
|
653
|
+
/* Mermaid 占位符(加载中) */
|
|
654
|
+
.mermaid-placeholder {
|
|
655
|
+
margin: 1em 0;
|
|
656
|
+
padding: 2em;
|
|
657
|
+
background: var(--chat-muted, #2a2a2a);
|
|
658
|
+
border: 1px solid var(--chat-border, rgba(255, 255, 255, 0.1));
|
|
659
|
+
border-radius: 8px;
|
|
660
|
+
text-align: center;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
.mermaid-loading {
|
|
664
|
+
color: var(--chat-text-muted, #888);
|
|
665
|
+
font-size: 0.9em;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/* Mermaid 嵌在代码块容器内时:外层已有边框/圆角,这里只做内容区对齐 */
|
|
669
|
+
.code-block-wrapper .mermaid-placeholder,
|
|
670
|
+
.code-block-wrapper .mermaid-rendered,
|
|
671
|
+
.code-block-wrapper .mermaid-error-container {
|
|
672
|
+
margin: 0;
|
|
673
|
+
border: none;
|
|
674
|
+
border-radius: 0;
|
|
675
|
+
background: transparent;
|
|
676
|
+
padding: 14px 18px;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/* 错误态仍然需要明显提示 */
|
|
680
|
+
.code-block-wrapper .mermaid-error-container {
|
|
681
|
+
background: rgba(239, 68, 68, 0.1);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/* Mermaid 渲染后容器 */
|
|
685
|
+
.mermaid-rendered {
|
|
686
|
+
/* Mermaid 通常嵌在消息的代码块容器里,外层已有卡片/边框。
|
|
687
|
+
这里保持最小必要样式:只负责滚动与尺寸适配,避免“套娃边框/多余背景”。 */
|
|
688
|
+
margin: 0.75em 0;
|
|
689
|
+
padding: 0;
|
|
690
|
+
background: transparent;
|
|
691
|
+
border: none;
|
|
692
|
+
border-radius: 0;
|
|
693
|
+
overflow-x: auto;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
.mermaid-rendered svg {
|
|
697
|
+
max-width: 100%;
|
|
698
|
+
height: auto;
|
|
699
|
+
display: block;
|
|
700
|
+
margin: 0 auto;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/* Mermaid 错误状态 */
|
|
704
|
+
.mermaid-error-container {
|
|
705
|
+
margin: 1em 0;
|
|
706
|
+
padding: 1em;
|
|
707
|
+
background: rgba(239, 68, 68, 0.1);
|
|
708
|
+
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
709
|
+
border-radius: 8px;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
.mermaid-error {
|
|
713
|
+
color: #ef4444;
|
|
714
|
+
font-size: 0.9em;
|
|
715
|
+
margin-bottom: 0.5em;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
.mermaid-source {
|
|
719
|
+
margin: 0;
|
|
720
|
+
padding: 0.75em;
|
|
721
|
+
background: var(--chat-muted, #1a1a1a);
|
|
722
|
+
border-radius: 4px;
|
|
723
|
+
font-size: 0.8em;
|
|
724
|
+
color: var(--chat-text-muted, #888);
|
|
725
|
+
white-space: pre-wrap;
|
|
726
|
+
word-break: break-all;
|
|
727
|
+
max-height: 200px;
|
|
728
|
+
overflow: auto;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/* Mermaid 深色主题覆盖 */
|
|
732
|
+
.mermaid-rendered .node rect,
|
|
733
|
+
.mermaid-rendered .node circle,
|
|
734
|
+
.mermaid-rendered .node ellipse,
|
|
735
|
+
.mermaid-rendered .node polygon,
|
|
736
|
+
.mermaid-rendered .node path {
|
|
737
|
+
fill: var(--chat-muted, #3a3a3a);
|
|
738
|
+
stroke: var(--chat-border, #555);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
.mermaid-rendered .node .label {
|
|
742
|
+
color: var(--chat-text, #e4e4e7);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.mermaid-rendered .edgeLabel {
|
|
746
|
+
background-color: var(--chat-muted, #2a2a2a);
|
|
747
|
+
color: var(--chat-text, #e4e4e7);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.mermaid-rendered .edgePath path {
|
|
751
|
+
stroke: var(--chat-text-muted, #888);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
.mermaid-rendered .marker {
|
|
755
|
+
fill: var(--chat-text-muted, #888);
|
|
756
|
+
stroke: var(--chat-text-muted, #888);
|
|
757
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -30,19 +30,6 @@ export interface CodeBlock extends ContentBlockBase {
|
|
|
30
30
|
/** 内容块联合类型 */
|
|
31
31
|
export type ContentBlock = TextBlock | CodeBlock
|
|
32
32
|
|
|
33
|
-
// ============ 工具渲染器类型 ============
|
|
34
|
-
|
|
35
|
-
/** 工具渲染器 Props */
|
|
36
|
-
export interface ToolRendererProps {
|
|
37
|
-
/** 工具名称 */
|
|
38
|
-
toolName: string
|
|
39
|
-
/** 工具参数 */
|
|
40
|
-
toolArgs: Record<string, unknown>
|
|
41
|
-
/** 工具返回结果 */
|
|
42
|
-
toolResult: unknown
|
|
43
|
-
/** 执行状态 */
|
|
44
|
-
status: 'running' | 'completed' | 'error'
|
|
45
|
-
}
|
|
46
33
|
|
|
47
34
|
// ============ 内置工具结果数据类型 ============
|
|
48
35
|
|
package/src/visual.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { renderMarkdown } from './markdown'
|
|
2
|
+
|
|
3
|
+
function normalizeLanguage(lang?: string): string {
|
|
4
|
+
return (lang || '').trim().toLowerCase()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isMermaidLanguage(lang?: string): boolean {
|
|
8
|
+
return normalizeLanguage(lang) === 'mermaid'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function isLatexLanguage(lang?: string): boolean {
|
|
12
|
+
const l = normalizeLanguage(lang)
|
|
13
|
+
return l === 'latex' || l === 'katex' || l === 'tex'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isLatexDocument(code: string): boolean {
|
|
17
|
+
const t = (code || '').trim()
|
|
18
|
+
return /\\documentclass\b|\\usepackage\b|\\begin\{document\}|\\end\{document\}/.test(t)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function canVisualizeLatex(code: string): boolean {
|
|
22
|
+
const t = (code || '').trim()
|
|
23
|
+
if (!t) return false
|
|
24
|
+
if (isLatexDocument(t)) return false
|
|
25
|
+
return true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function hasLatexDelimiters(code: string): boolean {
|
|
29
|
+
const t = (code || '').trim()
|
|
30
|
+
if (!t) return false
|
|
31
|
+
return (
|
|
32
|
+
/\$\$[\s\S]*\$\$/.test(t) ||
|
|
33
|
+
/\\\[[\s\S]*\\\]/.test(t) ||
|
|
34
|
+
/\\\([\s\S]*\\\)/.test(t) ||
|
|
35
|
+
/(?<!\$)\$(?!\$)[\s\S]*?\$(?!\$)/.test(t)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function shouldShowVisualToggle(lang?: string, code?: string): boolean {
|
|
40
|
+
if (isMermaidLanguage(lang)) return true
|
|
41
|
+
if (isLatexLanguage(lang)) return canVisualizeLatex(code || '')
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 将 fenced 的 latex/katex/tex 代码块渲染成 HTML(复用 shared 的 renderMarkdown + latex 预处理)。
|
|
47
|
+
* - 如果是完整 LaTeX 文档:返回提示 + code block(避免 KaTeX 报错)
|
|
48
|
+
* - 如果已经带分隔符:直接渲染(避免二次包裹)
|
|
49
|
+
* - 否则:自动包一层 $$...$$ 作为 display 公式渲染
|
|
50
|
+
*/
|
|
51
|
+
export function renderFencedLatexToHtml(code: string): string {
|
|
52
|
+
const t = (code || '').trim()
|
|
53
|
+
if (!t) return ''
|
|
54
|
+
|
|
55
|
+
if (!canVisualizeLatex(t)) {
|
|
56
|
+
return renderMarkdown(
|
|
57
|
+
`> 不支持将完整 LaTeX 文档作为公式渲染,请切换到代码视图查看。\n\n\`\`\`latex\n${t}\n\`\`\``
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (hasLatexDelimiters(t)) {
|
|
62
|
+
return renderMarkdown(t)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return renderMarkdown(`$$\n${t}\n$$`)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|