vditor 4.0.0 → 4.0.2-alpha.0

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/README.md CHANGED
@@ -325,6 +325,7 @@ new Vditor('vditor', {
325
325
  | - | - | - |
326
326
  | autoSpace | 自动空格 | false |
327
327
  | callout | Callout 块 | true |
328
+ | inlineMath | 是否解析行内数学公式 `$...$` | true |
328
329
  | gfmAutoLink | 自动链接 | true |
329
330
  | fixTermTypo | 自动矫正术语 | false |
330
331
  | toc | 插入目录 | false |
@@ -29,16 +29,13 @@
29
29
  color: rgba(0, 0, 0, .85);
30
30
  font-size: 14px;
31
31
  line-height: 2;
32
- --callout-note-color: #0969da;
33
- --callout-note-background-color: rgba(9, 105, 218, 0.08);
34
- --callout-tip-color: #1a7f37;
35
- --callout-tip-background-color: rgba(26, 127, 55, 0.08);
36
- --callout-important-color: #8250df;
37
- --callout-important-background-color: rgba(130, 80, 223, 0.08);
38
- --callout-warning-color: #9a6700;
39
- --callout-warning-background-color: rgba(154, 103, 0, 0.08);
40
- --callout-caution-color: #cf222e;
41
- --callout-caution-background-color: rgba(207, 34, 46, 0.08);
32
+ --blockquote-border-color: #e0e0e0;
33
+ --blockquote-text-color: #5f6368;
34
+ --callout-note-color: #3575f0;
35
+ --callout-tip-color: #65b84d;
36
+ --callout-important-color: #8957e5;
37
+ --callout-warning-color: #ff9632;
38
+ --callout-caution-color: #d23f31;
42
39
  }
43
40
 
44
41
  .vditor-reset img {
@@ -179,18 +176,6 @@
179
176
  border: 1px solid #f0f0f0
180
177
  }
181
178
 
182
- .vditor-reset blockquote {
183
- margin: 1em 0;
184
- padding-left: .8em;
185
- color: rgba(0, 0, 0, .45);
186
- font-size: 90%;
187
- border-left: 4px solid #f0f0f0
188
- }
189
-
190
- .vditor-reset blockquote p {
191
- margin: 0;
192
- }
193
-
194
179
  .vditor-reset .vditor-anchor {
195
180
  margin-left: 8px;
196
181
  opacity: 0;
@@ -26,16 +26,13 @@
26
26
  */
27
27
  .vditor-reset {
28
28
  color: #d1d5da;
29
- --callout-note-color: #58a6ff;
30
- --callout-note-background-color: rgba(56, 139, 253, 0.15);
31
- --callout-tip-color: #3fb950;
32
- --callout-tip-background-color: rgba(46, 160, 67, 0.15);
33
- --callout-important-color: #a371f7;
34
- --callout-important-background-color: rgba(163, 113, 247, 0.15);
35
- --callout-warning-color: #d29922;
36
- --callout-warning-background-color: rgba(187, 128, 9, 0.15);
37
- --callout-caution-color: #f85149;
38
- --callout-caution-background-color: rgba(248, 81, 73, 0.15);
29
+ --blockquote-border-color: rgba(230, 230, 230, 0.1);
30
+ --blockquote-text-color: #9aa0a6;
31
+ --callout-note-color: #3575f0;
32
+ --callout-tip-color: #65b84d;
33
+ --callout-important-color: #b388ff;
34
+ --callout-warning-color: #ff9632;
35
+ --callout-caution-color: #d23f31;
39
36
  }
40
37
 
41
38
  .vditor-reset a, .vditor-ir__link {
@@ -51,12 +48,6 @@
51
48
  background-color: #d1d5da
52
49
  }
53
50
 
54
- .vditor-reset blockquote {
55
- padding: 0 1em;
56
- color: #b9b9b9;
57
- border-left: .25em solid #d1d5da
58
- }
59
-
60
51
  .vditor-reset iframe {
61
52
  border: 1px solid #141414
62
53
  }
@@ -25,16 +25,13 @@
25
25
  *
26
26
  */
27
27
  .vditor-reset {
28
- --callout-note-color: #0969da;
29
- --callout-note-background-color: rgba(9, 105, 218, 0.08);
30
- --callout-tip-color: #1a7f37;
31
- --callout-tip-background-color: rgba(26, 127, 55, 0.08);
32
- --callout-important-color: #8250df;
33
- --callout-important-background-color: rgba(130, 80, 223, 0.08);
34
- --callout-warning-color: #9a6700;
35
- --callout-warning-background-color: rgba(154, 103, 0, 0.08);
36
- --callout-caution-color: #cf222e;
37
- --callout-caution-background-color: rgba(207, 34, 46, 0.08);
28
+ --blockquote-border-color: #e0e0e0;
29
+ --blockquote-text-color: #5f6368;
30
+ --callout-note-color: #3575f0;
31
+ --callout-tip-color: #65b84d;
32
+ --callout-important-color: #8957e5;
33
+ --callout-warning-color: #ff9632;
34
+ --callout-caution-color: #d23f31;
38
35
  }
39
36
 
40
37
  .vditor-reset h1, .vditor-reset h2 {
@@ -46,11 +43,6 @@
46
43
  background-color: #eaecef;
47
44
  }
48
45
 
49
- .vditor-reset blockquote {
50
- color: #6a737d;
51
- border-left: .25em solid #eaecef
52
- }
53
-
54
46
  .vditor-reset iframe {
55
47
  border: 1px solid #d1d5da
56
48
  }
@@ -27,16 +27,13 @@
27
27
  .vditor-reset {
28
28
  font-family: "mp-quote", -apple-system-font, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
29
29
  color: rgb(62, 62, 62);
30
- --callout-note-color: #0969da;
31
- --callout-note-background-color: rgba(9, 105, 218, 0.08);
32
- --callout-tip-color: #1a7f37;
33
- --callout-tip-background-color: rgba(26, 127, 55, 0.08);
34
- --callout-important-color: #8250df;
35
- --callout-important-background-color: rgba(130, 80, 223, 0.08);
36
- --callout-warning-color: #9a6700;
37
- --callout-warning-background-color: rgba(154, 103, 0, 0.08);
38
- --callout-caution-color: #cf222e;
39
- --callout-caution-background-color: rgba(207, 34, 46, 0.08);
30
+ --blockquote-border-color: #e0e0e0;
31
+ --blockquote-text-color: #5f6368;
32
+ --callout-note-color: #3575f0;
33
+ --callout-tip-color: #65b84d;
34
+ --callout-important-color: #8957e5;
35
+ --callout-warning-color: #ff9632;
36
+ --callout-caution-color: #d23f31;
40
37
  }
41
38
 
42
39
  .vditor-reset a, .vditor-ir__link {
@@ -73,15 +70,6 @@
73
70
  height: 0;
74
71
  }
75
72
 
76
- .vditor-reset blockquote {
77
- padding: 4px 0 0 10px;
78
- border-left: 3px solid #dbdbdb;
79
- color: #9a9a9a;
80
- line-height: 1.6;
81
- font-size: 15px;
82
- margin: 1em 0;
83
- }
84
-
85
73
  .vditor-reset code {
86
74
  font-size: 14px;
87
75
  border: 1px solid #f0f0f0;
package/dist/index.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v4.0.0 - A markdown editor written in TypeScript.
2
+ * Vditor v4.0.2-alpha.0 - A markdown editor written in TypeScript.
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -25,7 +25,7 @@
25
25
  *
26
26
  */
27
27
  /*!
28
- * Vditor v4.0.0 - A markdown editor written in TypeScript.
28
+ * Vditor v4.0.2-alpha.0 - A markdown editor written in TypeScript.
29
29
  *
30
30
  * MIT License
31
31
  *
@@ -69,16 +69,13 @@
69
69
  --count-background-color: rgba(27, 31, 35, 0.05);
70
70
  --heading-border-color: #eaecef;
71
71
  --blockquote-color: #6a737d;
72
- --callout-note-color: #0969da;
73
- --callout-note-background-color: rgba(9, 105, 218, 0.08);
74
- --callout-tip-color: #1a7f37;
75
- --callout-tip-background-color: rgba(26, 127, 55, 0.08);
76
- --callout-important-color: #8250df;
77
- --callout-important-background-color: rgba(130, 80, 223, 0.08);
78
- --callout-warning-color: #9a6700;
79
- --callout-warning-background-color: rgba(154, 103, 0, 0.08);
80
- --callout-caution-color: #cf222e;
81
- --callout-caution-background-color: rgba(207, 34, 46, 0.08);
72
+ --blockquote-border-color: #e0e0e0;
73
+ --blockquote-text-color: #5f6368;
74
+ --callout-note-color: #3575f0;
75
+ --callout-tip-color: #65b84d;
76
+ --callout-important-color: #8957e5;
77
+ --callout-warning-color: #ff9632;
78
+ --callout-caution-color: #d23f31;
82
79
  --ir-heading-color: #660e7a;
83
80
  --ir-title-color: #808080;
84
81
  --ir-bi-color: #0033b3;
@@ -103,16 +100,13 @@
103
100
  --count-background-color: rgba(66, 133, 244, 0.36);
104
101
  --heading-border-color: var(--textarea-text-color);
105
102
  --blockquote-color: var(--toolbar-icon-color);
106
- --callout-note-color: #58a6ff;
107
- --callout-note-background-color: rgba(56, 139, 253, 0.15);
108
- --callout-tip-color: #3fb950;
109
- --callout-tip-background-color: rgba(46, 160, 67, 0.15);
110
- --callout-important-color: #a371f7;
111
- --callout-important-background-color: rgba(163, 113, 247, 0.15);
112
- --callout-warning-color: #d29922;
113
- --callout-warning-background-color: rgba(187, 128, 9, 0.15);
114
- --callout-caution-color: #f85149;
115
- --callout-caution-background-color: rgba(248, 81, 73, 0.15);
103
+ --blockquote-border-color: rgba(230, 230, 230, 0.1);
104
+ --blockquote-text-color: #9aa0a6;
105
+ --callout-note-color: #3575f0;
106
+ --callout-tip-color: #65b84d;
107
+ --callout-important-color: #b388ff;
108
+ --callout-warning-color: #ff9632;
109
+ --callout-caution-color: #d23f31;
116
110
  --ir-heading-color: #9876aa;
117
111
  --ir-title-color: #808080;
118
112
  --ir-bi-color: #cc7832;
@@ -959,18 +953,38 @@
959
953
  margin-top: 0;
960
954
  margin-bottom: 16px;
961
955
  }
962
- .vditor-reset blockquote {
963
- padding: 0 1em;
964
- color: #6a737d;
965
- border-left: 0.25em solid #eaecef;
956
+ .vditor-reset blockquote:not(.callout) {
957
+ position: relative;
958
+ display: flex;
959
+ flex-direction: column;
960
+ padding: 0 0 0 calc(0.25em + 6px);
961
+ color: var(--blockquote-text-color, #5f6368);
962
+ background-color: transparent;
963
+ border: 0;
966
964
  margin: 0 0 16px 0;
967
965
  }
968
- .vditor-reset blockquote > :first-child {
966
+ .vditor-reset blockquote:not(.callout)::before {
967
+ position: absolute;
968
+ top: 6px;
969
+ bottom: 6px;
970
+ left: 2px;
971
+ width: 0.25em;
972
+ content: "";
973
+ background-color: var(--blockquote-border-color, #e0e0e0);
974
+ border-radius: 6px;
975
+ }
976
+ .vditor-reset blockquote:not(.callout) > :first-child {
969
977
  margin-top: 0;
970
978
  }
971
- .vditor-reset blockquote > :last-child {
979
+ .vditor-reset blockquote:not(.callout) > :last-child {
972
980
  margin-bottom: 0;
973
981
  }
982
+ .vditor-reset blockquote:not(.callout) > p {
983
+ padding: 4px;
984
+ margin: 2px 0;
985
+ line-height: 1.625;
986
+ border-radius: 6px;
987
+ }
974
988
  .vditor-reset ins > iframe {
975
989
  border: 0;
976
990
  }
@@ -1383,39 +1397,46 @@
1383
1397
  .vditor-reset .callout,
1384
1398
  .vditor-wysiwyg blockquote.callout,
1385
1399
  .vditor-ir blockquote.callout {
1386
- --callout-color: var(--callout-note-color, #0969da);
1387
- --callout-background-color: var(--callout-note-background-color, rgba(9, 105, 218, 0.08));
1400
+ --callout-color: var(--callout-note-color, #3575f0);
1388
1401
  position: relative;
1402
+ display: flex;
1403
+ flex-direction: column;
1389
1404
  margin: 0 0 16px;
1390
- padding: 0.75em 1em;
1391
- color: inherit;
1392
- background-color: var(--callout-background-color);
1405
+ padding: 0 0 0 calc(0.25em + 6px);
1406
+ color: var(--blockquote-text-color, #5f6368);
1393
1407
  border: 0;
1394
- border-left: 0.25em solid var(--callout-color);
1408
+ }
1409
+ .vditor-reset .callout::before,
1410
+ .vditor-wysiwyg blockquote.callout::before,
1411
+ .vditor-ir blockquote.callout::before {
1412
+ position: absolute;
1413
+ top: 6px;
1414
+ bottom: 6px;
1415
+ left: 2px;
1416
+ width: 0.25em;
1417
+ content: "";
1418
+ background-color: var(--callout-color);
1419
+ border-radius: 6px;
1395
1420
  }
1396
1421
  .vditor-reset .callout[data-subtype="TIP"],
1397
1422
  .vditor-wysiwyg blockquote.callout[data-subtype="TIP"],
1398
1423
  .vditor-ir blockquote.callout[data-subtype="TIP"] {
1399
- --callout-color: var(--callout-tip-color, #1a7f37);
1400
- --callout-background-color: var(--callout-tip-background-color, rgba(26, 127, 55, 0.08));
1424
+ --callout-color: var(--callout-tip-color, #65b84d);
1401
1425
  }
1402
1426
  .vditor-reset .callout[data-subtype="IMPORTANT"],
1403
1427
  .vditor-wysiwyg blockquote.callout[data-subtype="IMPORTANT"],
1404
1428
  .vditor-ir blockquote.callout[data-subtype="IMPORTANT"] {
1405
- --callout-color: var(--callout-important-color, #8250df);
1406
- --callout-background-color: var(--callout-important-background-color, rgba(130, 80, 223, 0.08));
1429
+ --callout-color: var(--callout-important-color, #8957e5);
1407
1430
  }
1408
1431
  .vditor-reset .callout[data-subtype="WARNING"],
1409
1432
  .vditor-wysiwyg blockquote.callout[data-subtype="WARNING"],
1410
1433
  .vditor-ir blockquote.callout[data-subtype="WARNING"] {
1411
- --callout-color: var(--callout-warning-color, #9a6700);
1412
- --callout-background-color: var(--callout-warning-background-color, rgba(154, 103, 0, 0.08));
1434
+ --callout-color: var(--callout-warning-color, #ff9632);
1413
1435
  }
1414
1436
  .vditor-reset .callout[data-subtype="CAUTION"],
1415
1437
  .vditor-wysiwyg blockquote.callout[data-subtype="CAUTION"],
1416
1438
  .vditor-ir blockquote.callout[data-subtype="CAUTION"] {
1417
- --callout-color: var(--callout-caution-color, #cf222e);
1418
- --callout-background-color: var(--callout-caution-background-color, rgba(207, 34, 46, 0.08));
1439
+ --callout-color: var(--callout-caution-color, #d23f31);
1419
1440
  }
1420
1441
  .vditor-reset .callout > .callout-info,
1421
1442
  .vditor-wysiwyg blockquote.callout > .callout-info,
@@ -1423,21 +1444,38 @@
1423
1444
  display: flex;
1424
1445
  align-items: center;
1425
1446
  min-height: 1.5em;
1426
- margin: 0 0 0.5em;
1447
+ margin: 2px 0;
1448
+ padding: 4px;
1427
1449
  color: var(--callout-color);
1428
- font-weight: 600;
1429
1450
  }
1430
1451
  .vditor-reset .callout > .callout-info .callout-icon,
1431
1452
  .vditor-wysiwyg blockquote.callout > .callout-info .callout-icon,
1432
1453
  .vditor-ir blockquote.callout > .callout-info .callout-icon {
1433
- display: inline-flex;
1454
+ display: flex;
1434
1455
  align-items: center;
1435
- margin-right: 0.35em;
1456
+ justify-content: center;
1457
+ width: 1.2em;
1458
+ height: 1.2em;
1459
+ padding: 4px;
1460
+ line-height: 1.2em;
1461
+ text-align: center;
1462
+ font-variant-emoji: emoji;
1463
+ border-radius: 6px;
1464
+ }
1465
+ .vditor-reset .callout > .callout-info .callout-icon:empty,
1466
+ .vditor-wysiwyg blockquote.callout > .callout-info .callout-icon:empty,
1467
+ .vditor-ir blockquote.callout > .callout-info .callout-icon:empty {
1468
+ display: none;
1436
1469
  }
1437
1470
  .vditor-reset .callout > .callout-info .callout-title,
1438
1471
  .vditor-wysiwyg blockquote.callout > .callout-info .callout-title,
1439
1472
  .vditor-ir blockquote.callout > .callout-info .callout-title {
1473
+ flex: 1;
1440
1474
  min-width: 1px;
1475
+ margin-left: 4px;
1476
+ font-size: 114%;
1477
+ font-weight: 500;
1478
+ opacity: 0.86;
1441
1479
  }
1442
1480
  .vditor-reset .callout > .callout-info .callout-img,
1443
1481
  .vditor-wysiwyg blockquote.callout > .callout-info .callout-img,
@@ -1445,19 +1483,25 @@
1445
1483
  .vditor-reset .callout > .callout-info > .callout-img,
1446
1484
  .vditor-wysiwyg blockquote.callout > .callout-info > .callout-img,
1447
1485
  .vditor-ir blockquote.callout > .callout-info > .callout-img {
1448
- width: 1.2em;
1449
1486
  height: 1.2em;
1450
- margin-right: 0.35em;
1451
- -o-object-fit: contain;
1452
- object-fit: contain;
1453
- }
1454
- .vditor-reset .callout > .callout-content > :last-child,
1455
- .vditor-wysiwyg blockquote.callout > .callout-content > :last-child,
1456
- .vditor-ir blockquote.callout > .callout-content > :last-child,
1457
- .vditor-reset .callout > :last-child,
1458
- .vditor-wysiwyg blockquote.callout > :last-child,
1459
- .vditor-ir blockquote.callout > :last-child {
1460
- margin-bottom: 0;
1487
+ width: 100%;
1488
+ }
1489
+ .vditor-reset .callout > p:not(.callout-info),
1490
+ .vditor-wysiwyg blockquote.callout > p:not(.callout-info),
1491
+ .vditor-ir blockquote.callout > p:not(.callout-info),
1492
+ .vditor-reset .callout > .callout-content > p,
1493
+ .vditor-wysiwyg blockquote.callout > .callout-content > p,
1494
+ .vditor-ir blockquote.callout > .callout-content > p {
1495
+ padding: 4px;
1496
+ margin: 2px 0;
1497
+ line-height: 1.625;
1498
+ border-radius: 6px;
1499
+ }
1500
+ .vditor-wysiwyg blockquote.callout > .callout-info,
1501
+ .vditor-ir blockquote.callout > .callout-info {
1502
+ font-size: 114%;
1503
+ font-weight: 500;
1504
+ opacity: 0.86;
1461
1505
  }
1462
1506
  .vditor-wysiwyg__callout-marker {
1463
1507
  display: none;
@@ -1508,6 +1552,12 @@
1508
1552
  padding-left: 0 !important;
1509
1553
  padding-right: 0 !important;
1510
1554
  }
1555
+ .vditor-wysiwyg__block[data-type="code-block"] > pre:not([style*="display:none"]):not([style*="display: none"]) + .vditor-code__preview {
1556
+ height: 0;
1557
+ min-height: 0;
1558
+ overflow: hidden;
1559
+ visibility: hidden;
1560
+ }
1511
1561
  .vditor-wysiwyg__block pre:first-child {
1512
1562
  margin-bottom: -1em;
1513
1563
  }
@@ -1684,6 +1734,12 @@
1684
1734
  .vditor-ir__node--hidden .vditor-ir__marker {
1685
1735
  visibility: hidden;
1686
1736
  }
1737
+ .vditor-ir__node--expand[data-type="code-block"] > .vditor-code__preview {
1738
+ height: 0;
1739
+ min-height: 0;
1740
+ overflow: hidden;
1741
+ visibility: hidden;
1742
+ }
1687
1743
  .vditor-ir__node--expand .vditor-ir__marker {
1688
1744
  color: var(--second-color);
1689
1745
  display: inline;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v4.0.0 - A markdown editor written in TypeScript.
2
+ * Vditor v4.0.2-alpha.0 - A markdown editor written in TypeScript.
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -2434,6 +2434,7 @@ var md2html = function (mdText, options) {
2434
2434
  var lute = (0,setLute/* setLute */.X)({
2435
2435
  autoSpace: mergedOptions.markdown.autoSpace,
2436
2436
  callout: mergedOptions.markdown.callout,
2437
+ inlineMath: mergedOptions.markdown.inlineMath,
2437
2438
  gfmAutoLink: mergedOptions.markdown.gfmAutoLink,
2438
2439
  codeBlockPreview: mergedOptions.markdown.codeBlockPreview,
2439
2440
  emojiSite: mergedOptions.emojiPath,
@@ -2646,7 +2647,7 @@ var Vditor = /** @class */ (function () {
2646
2647
  /* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
2647
2648
  /* harmony export */ "g": () => (/* binding */ Constants)
2648
2649
  /* harmony export */ });
2649
- var _VDITOR_VERSION = "4.0.0";
2650
+ var _VDITOR_VERSION = "4.0.2-alpha.0";
2650
2651
 
2651
2652
  var Constants = /** @class */ (function () {
2652
2653
  function Constants() {
@@ -2694,10 +2695,11 @@ var Constants = /** @class */ (function () {
2694
2695
  // 别名
2695
2696
  "js", "ts", "html", "toml", "c#", "bat"
2696
2697
  ];
2697
- Constants.CDN = "https://unpkg.com/vditor@".concat("4.0.0");
2698
+ Constants.CDN = "https://unpkg.com/vditor@".concat("4.0.2-alpha.0");
2698
2699
  Constants.MARKDOWN_OPTIONS = {
2699
2700
  autoSpace: false,
2700
2701
  callout: true,
2702
+ inlineMath: true,
2701
2703
  gfmAutoLink: true,
2702
2704
  codeBlockPreview: true,
2703
2705
  fixTermTypo: false,
@@ -3636,13 +3638,17 @@ var mathRender = function (element, options) {
3636
3638
  /* harmony export */ });
3637
3639
  /* harmony import */ var _util_function__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(494);
3638
3640
 
3639
- var videoRender = function (element, url) {
3640
- element.insertAdjacentHTML("afterend", "<video controls=\"controls\" src=\"".concat(url, "\"></video>"));
3641
- element.remove();
3642
- };
3643
- var audioRender = function (element, url) {
3644
- element.insertAdjacentHTML("afterend", "<audio controls=\"controls\" src=\"".concat(url, "\"></audio>"));
3645
- element.remove();
3641
+ var replaceMedia = function (element, tag, url) {
3642
+ var media = element.ownerDocument.createElement(tag);
3643
+ if (tag === "iframe") {
3644
+ media.className = "iframe__video";
3645
+ }
3646
+ else {
3647
+ media.setAttribute("controls", "controls");
3648
+ }
3649
+ // 链接属性经 DOM 解码后可能包含引号,直接设置属性以保留 URL 的数据语义。
3650
+ media.setAttribute("src", url);
3651
+ element.replaceWith(media);
3646
3652
  };
3647
3653
  var iframeRender = function (element, url) {
3648
3654
  var youtubeMatch = url.match(/\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?/);
@@ -3654,29 +3660,23 @@ var iframeRender = function (element, url) {
3654
3660
  var bilibiliMatch = url.match(/(?:www\.|\/\/)bilibili\.com\/video\/(\w+)/);
3655
3661
  var tedMatch = url.match(/(?:www\.|\/\/)ted\.com\/talks\/(\w+)/);
3656
3662
  if (youtubeMatch && youtubeMatch[1].length === 11) {
3657
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\" src=\"//www.youtube.com/embed/".concat(youtubeMatch[1] +
3658
- (youtubeMatch[2] ? "?start=" + youtubeMatch[2] : ""), "\"></iframe>"));
3659
- element.remove();
3663
+ replaceMedia(element, "iframe", "//www.youtube.com/embed/".concat(youtubeMatch[1] +
3664
+ (youtubeMatch[2] ? "?start=" + youtubeMatch[2] : "")));
3660
3665
  }
3661
3666
  else if (youkuMatch && youkuMatch[1]) {
3662
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\" src=\"//player.youku.com/embed/".concat(youkuMatch[1], "\"></iframe>"));
3663
- element.remove();
3667
+ replaceMedia(element, "iframe", "//player.youku.com/embed/".concat(youkuMatch[1]));
3664
3668
  }
3665
3669
  else if (qqMatch && qqMatch[1]) {
3666
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\" src=\"https://v.qq.com/txp/iframe/player.html?vid=".concat(qqMatch[1], "\"></iframe>"));
3667
- element.remove();
3670
+ replaceMedia(element, "iframe", "https://v.qq.com/txp/iframe/player.html?vid=".concat(qqMatch[1]));
3668
3671
  }
3669
3672
  else if (coubMatch && coubMatch[1]) {
3670
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\"\n src=\"//coub.com/embed/".concat(coubMatch[1], "?muted=false&autostart=false&originalSize=true&startWithHD=true\"></iframe>"));
3671
- element.remove();
3673
+ replaceMedia(element, "iframe", "//coub.com/embed/".concat(coubMatch[1], "?muted=false&autostart=false&originalSize=true&startWithHD=true"));
3672
3674
  }
3673
3675
  else if (facebookMatch && facebookMatch[0]) {
3674
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\"\n src=\"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(facebookMatch[0]), "\"></iframe>"));
3675
- element.remove();
3676
+ replaceMedia(element, "iframe", "https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(facebookMatch[0])));
3676
3677
  }
3677
3678
  else if (dailymotionMatch && dailymotionMatch[2]) {
3678
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\"\n src=\"https://www.dailymotion.com/embed/video/".concat(dailymotionMatch[2], "\"></iframe>"));
3679
- element.remove();
3679
+ replaceMedia(element, "iframe", "https://www.dailymotion.com/embed/video/".concat(dailymotionMatch[2]));
3680
3680
  }
3681
3681
  else if (url.indexOf("bilibili.com") > -1 && (url.indexOf("bvid=") > -1 || (bilibiliMatch && bilibiliMatch[1]))) {
3682
3682
  var params_1 = {
@@ -3705,12 +3705,10 @@ var iframeRender = function (element, url) {
3705
3705
  src_1 += "&";
3706
3706
  }
3707
3707
  });
3708
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\" src=\"".concat(src_1, "\"></iframe>"));
3709
- element.remove();
3708
+ replaceMedia(element, "iframe", src_1);
3710
3709
  }
3711
3710
  else if (tedMatch && tedMatch[1]) {
3712
- element.insertAdjacentHTML("afterend", "<iframe class=\"iframe__video\" src=\"//embed.ted.com/talks/".concat(tedMatch[1], "\"></iframe>"));
3713
- element.remove();
3711
+ replaceMedia(element, "iframe", "//embed.ted.com/talks/".concat(tedMatch[1]));
3714
3712
  }
3715
3713
  };
3716
3714
  var mediaRender = function (element) {
@@ -3723,10 +3721,10 @@ var mediaRender = function (element) {
3723
3721
  return;
3724
3722
  }
3725
3723
  if (url.match(/^.+.(mp4|m4v|ogg|ogv|webm)$/)) {
3726
- videoRender(aElement, url);
3724
+ replaceMedia(aElement, "video", url);
3727
3725
  }
3728
3726
  else if (url.match(/^.+.(mp3|wav|flac)$/)) {
3729
- audioRender(aElement, url);
3727
+ replaceMedia(aElement, "audio", url);
3730
3728
  }
3731
3729
  else {
3732
3730
  iframeRender(aElement, url);
@@ -3795,7 +3793,7 @@ var mermaidRender = function (element, cdn, theme) {
3795
3793
  if (mermaidElements.length === 0) {
3796
3794
  return;
3797
3795
  }
3798
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/mermaid/mermaid.min.js?v=11.16.1"), "vditorMermaidScript").then(function () {
3796
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/mermaid/mermaid.min.js?v=11.17.2"), "vditorMermaidScript").then(function () {
3799
3797
  var config = {
3800
3798
  securityLevel: "loose",
3801
3799
  altFontFamily: "sans-serif",
@@ -4135,6 +4133,7 @@ var setLute = function (options) {
4135
4133
  lute.SetInlineMathAllowDigitAfterOpenMarker(options.inlineMathDigit);
4136
4134
  lute.SetAutoSpace(options.autoSpace);
4137
4135
  lute.SetCallout(options.callout);
4136
+ lute.SetInlineMath(options.inlineMath);
4138
4137
  lute.SetToC(options.toc);
4139
4138
  lute.SetFootnotes(options.footnotes);
4140
4139
  lute.SetFixTermTypo(options.fixTermTypo);
@@ -5510,6 +5509,7 @@ var processCodeRender = function (previewPanel, vditor) {
5510
5509
  if (!previewPanel) {
5511
5510
  return;
5512
5511
  }
5512
+ previewPanel.classList.remove("vditor-code__preview");
5513
5513
  if (previewPanel.parentElement.getAttribute("data-type") === "html-block") {
5514
5514
  previewPanel.setAttribute("data-render", "1");
5515
5515
  return;
@@ -5556,6 +5556,7 @@ var processCodeRender = function (previewPanel, vditor) {
5556
5556
  }
5557
5557
  });
5558
5558
  if (!cRender) {
5559
+ previewPanel.classList.add("vditor-code__preview");
5559
5560
  (0,highlightRender/* highlightRender */.s)(Object.assign({}, vditor.options.preview.hljs), previewPanel, vditor.options.cdn);
5560
5561
  (0,codeRender/* codeRender */.O)(previewPanel, vditor.options.preview.hljs);
5561
5562
  }
@@ -13367,7 +13368,7 @@ var exportPDF = function (vditor) {
13367
13368
  vditor.tip.show(window.VditorI18n.generate, 3800);
13368
13369
  var iframe = document.querySelector("#vditorExportIframe");
13369
13370
  iframe.contentDocument.open();
13370
- iframe.contentDocument.write("<link rel=\"stylesheet\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script>\n<div id=\"preview\" style=\"width: 800px\"></div>\n<script>\nwindow.addEventListener(\"message\", (e) => {\n if(!e.data) {\n return;\n }\n Vditor.preview(document.getElementById('preview'), e.data, {\n cdn: \"").concat(vditor.options.cdn, "\",\n markdown: {\n callout: ").concat(JSON.stringify(vditor.options.preview.markdown.callout), ",\n theme: ").concat(JSON.stringify(vditor.options.preview.theme), "\n },\n hljs: {\n style: \"").concat(vditor.options.preview.hljs.style, "\"\n }\n });\n setTimeout(() => {\n window.print();\n }, 3600);\n}, false);\n</script>"));
13371
+ iframe.contentDocument.write("<link rel=\"stylesheet\" href=\"".concat(vditor.options.cdn, "/dist/index.css\"/>\n<script src=\"").concat(vditor.options.cdn, "/dist/method.min.js\"></script>\n<div id=\"preview\" style=\"width: 800px\"></div>\n<script>\nwindow.addEventListener(\"message\", (e) => {\n if(!e.data) {\n return;\n }\n Vditor.preview(document.getElementById('preview'), e.data, {\n cdn: \"").concat(vditor.options.cdn, "\",\n markdown: {\n callout: ").concat(JSON.stringify(vditor.options.preview.markdown.callout), ",\n inlineMath: ").concat(JSON.stringify(vditor.options.preview.markdown.inlineMath), ",\n theme: ").concat(JSON.stringify(vditor.options.preview.theme), "\n },\n hljs: {\n style: \"").concat(vditor.options.preview.hljs.style, "\"\n }\n });\n setTimeout(() => {\n window.print();\n }, 3600);\n}, false);\n</script>"));
13371
13372
  iframe.contentDocument.close();
13372
13373
  setTimeout(function () {
13373
13374
  iframe.contentWindow.postMessage(getMarkdown(vditor), "*");
@@ -16269,6 +16270,7 @@ var Vditor = /** @class */ (function (_super) {
16269
16270
  _this.vditor.lute = (0,setLute/* setLute */.X)({
16270
16271
  autoSpace: _this.vditor.options.preview.markdown.autoSpace,
16271
16272
  callout: _this.vditor.options.preview.markdown.callout,
16273
+ inlineMath: _this.vditor.options.preview.markdown.inlineMath,
16272
16274
  gfmAutoLink: _this.vditor.options.preview.markdown.gfmAutoLink,
16273
16275
  codeBlockPreview: _this.vditor.options.preview.markdown
16274
16276
  .codeBlockPreview,