@vscode/markdown-editor 0.0.2-117 → 0.0.2-119

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/markdown-editor",
3
- "version": "0.0.2-117",
3
+ "version": "0.0.2-119",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -96,7 +96,8 @@
96
96
  "micromark-extension-gfm-strikethrough": "^2.1.0",
97
97
  "micromark-extension-gfm-table": "^2.1.1",
98
98
  "micromark-extension-gfm-task-list-item": "^2.1.0",
99
- "micromark-extension-math": "^3.1.0"
99
+ "micromark-extension-math": "^3.1.0",
100
+ "micromark-util-decode-string": "^2.0.1"
100
101
  },
101
102
  "devDependencies": {
102
103
  "@playwright/test": "1.56.1",
@@ -119,5 +120,5 @@
119
120
  "vitest": "^4.1.0",
120
121
  "zod": "^4.3.6"
121
122
  },
122
- "gitHead": "40666b73de7efda9a0b0b487a56342b4cbd33be9"
123
+ "gitHead": "efe1bb2fbeea60dd3b22314db182c8f4fdc2ea92"
123
124
  }
@@ -27,6 +27,9 @@
27
27
  .md-editor {
28
28
  --md-marker-font-family: 'Cascadia Code', 'Fira Code', monospace;
29
29
  --md-marker-font-scale: 0.85;
30
+ --md-readonly-toggle-width: 58px;
31
+ --md-readonly-toggle-height: 32px;
32
+ --md-readonly-toggle-inset: 8px;
30
33
  display: flow-root;
31
34
  outline: none;
32
35
  /* The editor paints its own cursor (`.md-cursor`); hide the native caret. */
@@ -64,28 +67,34 @@
64
67
  * edge, independent of the first block's theme margins.
65
68
  */
66
69
  .md-editor-content {
67
- --md-editor-content-inline-start-padding: 48px;
68
- --md-readonly-toggle-width: 58px;
69
- --md-readonly-toggle-height: 32px;
70
- /* Leaves 16px of optical separation beyond the active block's 8px outset glow. */
71
- --md-readonly-toggle-gap: 24px;
72
- --md-readonly-toggle-inset: 4px;
70
+ --md-editor-min-inline-padding: 8px;
71
+ --md-editor-content-inline-start-padding: var(--md-editor-min-inline-padding);
73
72
  --md-editor-content-inline-end-padding: var(--md-editor-content-inline-start-padding);
74
73
  position: relative;
74
+ display: flow-root;
75
75
  margin-inline: auto;
76
- padding-block: 24px 0;
76
+ padding-block: 32px 0;
77
77
  padding-inline: var(--md-editor-content-inline-start-padding) var(--md-editor-content-inline-end-padding);
78
78
  }
79
79
 
80
- .md-editor-content-with-readonly-toggle {
81
- --md-editor-content-inline-end-padding: calc(var(--md-readonly-toggle-width) + var(--md-readonly-toggle-gap) + var(--md-readonly-toggle-inset));
80
+ .md-editor-medium-margins > .md-editor-content {
81
+ --md-editor-content-inline-start-padding: max(var(--md-editor-min-inline-padding), 48px);
82
82
  }
83
83
 
84
- .md-editor-content-with-readonly-toggle>.md-document :is(.md-heading, .md-paragraph) {
84
+ .md-editor-content:has(> .md-document > .md-heading) {
85
+ --md-editor-min-inline-padding: 2em;
86
+ }
87
+
88
+ .md-editor-content>.md-document :is(.md-heading, .md-paragraph) {
85
89
  overflow-wrap: anywhere;
86
90
  }
87
91
 
88
- .md-block-active {
92
+ .md-editor .md-document > :first-child,
93
+ .md-editor .md-blockquote > :nth-child(1 of .md-block) {
94
+ margin-block-start: 0;
95
+ }
96
+
97
+ :where(.md-editor:not(.md-no-active-block-highlight)) .md-block-active {
89
98
  background: var(--md-block-active-background, #f8f8f8);
90
99
  border-radius: 4px;
91
100
  box-shadow: 0 0 0 8px var(--md-block-active-background, #f8f8f8);
@@ -148,7 +157,7 @@
148
157
  .md-rich-link {
149
158
  display: inline-flex;
150
159
  align-items: baseline;
151
- max-width: min(100%, 52rem);
160
+ max-width: min(100%, var(--md-rich-link-line-width, 52rem));
152
161
  box-sizing: border-box;
153
162
  gap: 0.24em;
154
163
  padding: 1px 0.3em;
@@ -199,11 +208,19 @@
199
208
  }
200
209
 
201
210
  .md-rich-link-title {
202
- max-width: 200px;
211
+ max-width: var(--md-rich-link-title-width, 200px);
212
+ }
213
+
214
+ .md-rich-link-label {
215
+ max-width: var(--md-rich-link-title-width, none);
203
216
  }
204
217
 
205
218
  .md-rich-link[data-md-rich-link-kind='session'] :is(.md-rich-link-label, .md-rich-link-title) {
206
- max-width: 150px;
219
+ max-width: var(--md-rich-link-title-width, 150px);
220
+ }
221
+
222
+ .md-rich-link-line-end {
223
+ --md-rich-link-title-width: none;
207
224
  }
208
225
 
209
226
  .md-rich-link-label[hidden],
@@ -426,7 +443,7 @@
426
443
  ) :is(.md-rich-link-label, .md-rich-link-title) {
427
444
  position: relative;
428
445
  top: 0.25px;
429
- max-width: 200px;
446
+ max-width: var(--md-rich-link-title-width, 200px);
430
447
  color: inherit;
431
448
  font-weight: 400;
432
449
  }
@@ -841,7 +858,7 @@ pre.md-unhandled-scroll.md-code-block {
841
858
  left: 0;
842
859
  right: 0;
843
860
  text-align: center;
844
- color: #b0b0b0;
861
+ color: var(--md-whitespace-foreground, #b0b0b0);
845
862
  pointer-events: none;
846
863
  }
847
864
 
@@ -855,7 +872,7 @@ pre.md-unhandled-scroll.md-code-block {
855
872
 
856
873
  .md-ws-newline::before {
857
874
  content: '↵';
858
- color: #b0b0b0;
875
+ color: var(--md-whitespace-foreground, #b0b0b0);
859
876
  pointer-events: none;
860
877
  }
861
878
 
@@ -1028,6 +1045,10 @@ pre.md-unhandled-scroll.md-code-block {
1028
1045
  margin-inline-start: calc(-1 * var(--md-list-indent-step, 2em));
1029
1046
  }
1030
1047
 
1048
+ .md-source-editing .md-list > li > .md-empty-block {
1049
+ padding-inline-start: calc(var(--md-list-label-reserve) + var(--md-list-source-padding));
1050
+ }
1051
+
1031
1052
  .md-source-editing .md-glue-emptyLine {
1032
1053
  white-space: pre-wrap;
1033
1054
  visibility: visible;
@@ -1157,7 +1178,7 @@ pre.md-unhandled-scroll.md-code-block {
1157
1178
  * and drop it from the table, which keeps `md-block-active` purely for the
1158
1179
  * per-theme source-pipe styling.
1159
1180
  */
1160
- .md-table-wrapper:has(> .md-table.md-block-active) {
1181
+ :where(.md-editor:not(.md-no-active-block-highlight)) .md-table-wrapper:has(> .md-table.md-block-active) {
1161
1182
  background: var(--md-block-active-background, #f8f8f8);
1162
1183
  border-radius: 4px;
1163
1184
  box-shadow: 0 0 0 8px var(--md-block-active-background, #f8f8f8);
@@ -1250,7 +1271,7 @@ pre.md-unhandled-scroll.md-code-block {
1250
1271
  display: inline-flex;
1251
1272
  align-items: center;
1252
1273
  justify-content: flex-end;
1253
- transform: scale(0.85);
1274
+ transform: scale(var(--md-heading-marker-scale, 0.85));
1254
1275
  transform-origin: right center;
1255
1276
  }
1256
1277
 
@@ -1517,7 +1538,8 @@ pre.md-unhandled-scroll.md-code-block {
1517
1538
  text-align: center;
1518
1539
  }
1519
1540
 
1520
- .md-marker-listItemMarker:has(> .md-list-marker-symbol) > :is(.md-ws-space, .md-ws-tab) {
1541
+ .md-marker-listItemMarker:has(> .md-list-marker-symbol) > :is(.md-ws-space, .md-ws-tab),
1542
+ .md-source-editing .md-list-continuation-separator {
1521
1543
  font-family: var(--md-marker-font-family);
1522
1544
  word-spacing: calc(0.5em - 1ch + var(--md-list-marker-reserve) / var(--md-list-marker-spaces));
1523
1545
  tab-size: calc(0.5em + var(--md-list-marker-reserve) / var(--md-list-marker-spaces));
@@ -1576,7 +1598,8 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1576
1598
  align-items: center;
1577
1599
  }
1578
1600
 
1579
- .md-source-editing .md-list-gutter > .md-glue-indent {
1601
+ .md-source-editing .md-list-gutter > .md-glue-indent,
1602
+ .md-source-editing .md-list-continuation-indent {
1580
1603
  --md-source-indent-width: calc(var(--md-list-source-indent) * var(--md-list-indent-step, 2em));
1581
1604
  --md-source-space-width: calc(var(--md-source-indent-width) / var(--md-indent-length));
1582
1605
  flex-basis: var(--md-source-indent-width);
@@ -1587,6 +1610,27 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1587
1610
  tab-size: var(--md-source-space-width);
1588
1611
  }
1589
1612
 
1613
+ .md-source-editing .md-task-list-item > .md-list-gutter > .md-glue-indent {
1614
+ --md-source-indent-width: calc(var(--md-list-source-indent) * var(--md-list-indent-step, 2em) / 2);
1615
+ }
1616
+
1617
+ .md-source-editing .md-list-continuation-prefix {
1618
+ font-family: var(--md-marker-font-family);
1619
+ white-space: pre;
1620
+ }
1621
+
1622
+ .md-source-editing .md-list-continuation-prefix > span {
1623
+ display: inline;
1624
+ }
1625
+
1626
+ .md-source-editing .md-list-continuation-symbol {
1627
+ word-spacing: calc(1em - 1ch);
1628
+ }
1629
+
1630
+ .md-source-editing .md-list-continuation-outside {
1631
+ margin-inline-start: calc((var(--md-list-level) - var(--md-list-source-indent)) * var(--md-list-indent-step, 2em) - 1.5em - var(--md-list-marker-reserve));
1632
+ }
1633
+
1590
1634
  .md-source-editing .md-list-gutter > .md-marker-listItemMarker.md-marker-hidden {
1591
1635
  display: inline-flex;
1592
1636
  visibility: hidden;
@@ -1661,16 +1705,9 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1661
1705
  .md-task-list-item {
1662
1706
  list-style: none;
1663
1707
  position: relative;
1664
- /*
1665
- * Width of the checkbox / `[x]` source column. Single-sourced so the marker
1666
- * reservation on the first paragraph and the left indent of any following
1667
- * block (loose task items) stay in lockstep — keeping every block's text in
1668
- * one vertical column under the marker.
1669
- */
1670
1708
  }
1671
1709
 
1672
1710
  .md-list > li {
1673
- --md-task-marker-width: 1.75em;
1674
1711
  --md-list-label-reserve: 0em;
1675
1712
  --md-list-marker-reserve: var(--md-list-label-reserve);
1676
1713
  --md-list-source-padding: 0em;
@@ -1684,23 +1721,23 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1684
1721
  --md-list-marker-reserve: 0em;
1685
1722
  }
1686
1723
 
1687
- .md-source-editing .md-list-with-task-items > li:not(.md-empty-block) {
1724
+ .md-list-with-task-items > li:not(.md-empty-block) {
1688
1725
  --md-list-label-reserve: 0.5em;
1689
1726
  }
1690
1727
 
1691
- .md-source-editing .md-list > li > .md-paragraph {
1728
+ .md-editor .md-list > li > .md-paragraph {
1692
1729
  padding-inline-start: calc(var(--md-list-label-reserve) + var(--md-list-source-padding));
1693
1730
  }
1694
1731
 
1695
- .md-source-editing .md-list > li > .md-list-item-line-anchor {
1732
+ .md-editor .md-list > li > .md-list-item-line-anchor {
1696
1733
  margin-inline-start: calc(var(--md-list-label-reserve) + var(--md-list-source-padding));
1697
1734
  }
1698
1735
 
1699
- .md-source-editing .md-list > li > .md-marker-listItemMarker {
1736
+ .md-editor .md-list > li > .md-marker-listItemMarker {
1700
1737
  right: calc(100% - (var(--md-list-label-reserve) + var(--md-list-source-padding)) / var(--md-marker-font-scale));
1701
1738
  }
1702
1739
 
1703
- .md-source-editing .md-list-gutter {
1740
+ .md-editor .md-list-gutter {
1704
1741
  right: calc(100% - var(--md-list-label-reserve) - var(--md-list-source-padding));
1705
1742
  }
1706
1743
 
@@ -1715,7 +1752,7 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1715
1752
  tab-size: calc((0.5em + var(--md-list-marker-reserve) / var(--md-list-marker-spaces)) / var(--md-marker-font-scale));
1716
1753
  }
1717
1754
 
1718
- .md-source-editing .md-task-separator {
1755
+ .md-task-separator {
1719
1756
  position: absolute;
1720
1757
  left: calc(var(--md-list-source-padding) - 1em + 1.5ch * var(--md-marker-font-scale));
1721
1758
  top: 0;
@@ -1725,60 +1762,76 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1725
1762
  tab-size: calc((1.5em - 1.5ch * var(--md-marker-font-scale)) / var(--md-separator-length));
1726
1763
  }
1727
1764
 
1728
- /*
1729
- * Reserve the marker column on the paragraph rather than only on its first
1730
- * inline child. This gives every wrapped line the same content edge. The
1731
- * source marker glue is positioned over that reserved column, as is the
1732
- * rendered checkbox, so activating the item does not shift its text (see the
1733
- * compare fixture's `checkMarkedTextX` assertion).
1734
- */
1735
- .md-task-list-item>.md-paragraph {
1736
- padding-left: var(--md-task-marker-width);
1737
- }
1738
-
1739
1765
  .md-task-list-item>.md-paragraph>.md-glue-taskListCheck {
1740
1766
  position: absolute;
1741
1767
  top: 0;
1742
- left: 0;
1743
- width: var(--md-task-marker-width);
1768
+ font-family: var(--md-marker-font-family);
1769
+ font-size: calc(1em * var(--md-marker-font-scale));
1770
+ left: calc((var(--md-list-source-padding) - 1em) / var(--md-marker-font-scale) - 1.5ch);
1771
+ width: 3ch;
1744
1772
  }
1745
1773
 
1746
- /*
1747
- * Following blocks in a loose task item (the second paragraph etc.) carry no
1748
- * marker glue, so indent them by the marker column to line their text up under
1749
- * the first paragraph's text rather than under the checkbox.
1750
- */
1751
- .md-task-list-item>.md-block+.md-block {
1752
- padding-left: var(--md-task-marker-width);
1774
+ .md-source-editing .md-task-list-item > .md-paragraph > .md-glue-taskListCheck {
1775
+ position: static;
1776
+ display: inline-block;
1777
+ margin-inline-start: calc((-1em - var(--md-list-label-reserve)) / var(--md-marker-font-scale) - 1.5ch);
1778
+ }
1779
+
1780
+ .md-source-editing .md-task-separator {
1781
+ position: static;
1782
+ }
1783
+
1784
+ .md-source-editing .md-list li > .md-paragraph > .md-list-continuation-prefix {
1785
+ right: calc(100% - var(--md-list-label-reserve) - var(--md-list-source-padding));
1786
+ }
1787
+
1788
+ .md-source-editing .md-list .md-code-block-container:has(> .md-code-list-source) {
1789
+ display: block;
1790
+ --md-list-prefix-width: calc(var(--md-list-source-indent) * var(--md-list-indent-step, 2em) + 1em + var(--md-list-marker-spaces) * 0.5em + var(--md-list-label-reserve));
1791
+ margin-inline-start: calc(var(--md-list-label-reserve) + var(--md-list-source-padding) - var(--md-list-prefix-width));
1753
1792
  }
1754
1793
 
1755
- .md-source-editing .md-task-list-item > .md-list-gutter {
1794
+ .md-source-editing .md-list .md-code-list-source {
1795
+ position: relative;
1796
+ font-size: inherit;
1797
+ border-inline-start-width: 0;
1798
+ padding-inline-start: var(--md-list-prefix-width);
1799
+ }
1800
+
1801
+ .md-source-editing .md-list li > .md-code-block-container > .md-code-list-source > .md-list-continuation-prefix:first-child {
1802
+ right: calc(100% - var(--md-list-prefix-width));
1803
+ top: auto;
1804
+ }
1805
+
1806
+ .md-code-source-line {
1807
+ position: relative;
1808
+ }
1809
+
1810
+ .md-code-source-line > .md-list-continuation-prefix {
1811
+ position: absolute;
1812
+ right: 100%;
1813
+ }
1814
+
1815
+ .md-editor .md-task-list-item > .md-list-gutter {
1756
1816
  right: calc(100% - var(--md-list-source-padding));
1757
1817
  }
1758
1818
 
1759
- .md-source-editing .md-task-list-item > .md-list-gutter::after {
1819
+ .md-task-list-item > .md-list-gutter::after {
1760
1820
  content: '';
1761
1821
  font-family: var(--md-marker-font-family);
1762
1822
  font-size: calc(1em * var(--md-marker-font-scale));
1763
1823
  flex: 0 0 calc(1em / var(--md-marker-font-scale) + 1.5ch);
1764
1824
  }
1765
1825
 
1766
- .md-source-editing .md-task-list-item > .md-paragraph > .md-glue-taskListCheck {
1767
- font-family: var(--md-marker-font-family);
1768
- font-size: calc(1em * var(--md-marker-font-scale));
1769
- left: calc((var(--md-list-source-padding) - 1em) / var(--md-marker-font-scale) - 1.5ch);
1770
- width: 3ch;
1771
- }
1772
-
1773
- .md-source-editing .md-task-list-item > .md-block + .md-block:not(.md-list) {
1826
+ .md-task-list-item > .md-block + .md-block:not(.md-list) {
1774
1827
  padding-left: calc(var(--md-list-label-reserve) + var(--md-list-source-padding));
1775
1828
  }
1776
1829
 
1777
- .md-source-editing .md-task-list-item > .md-list {
1830
+ .md-task-list-item > .md-list {
1778
1831
  padding-left: var(--md-list-indent-step, 2em);
1779
1832
  }
1780
1833
 
1781
- .md-source-editing .md-checkbox {
1834
+ .md-task-list-item > .md-checkbox {
1782
1835
  font-family: var(--md-marker-font-family);
1783
1836
  font-size: calc(1em * var(--md-marker-font-scale));
1784
1837
  left: calc((var(--md-list-source-padding) - 1em) / var(--md-marker-font-scale) - 8px);
@@ -1941,17 +1994,15 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1941
1994
  /*
1942
1995
  * Edit / read-only lock toggle.
1943
1996
  *
1944
- * The asymmetric content padding reserves a real rail for the control:
1945
- * button width + gap + edge inset. The zero-height sticky host spans the
1946
- * document column and that rail, keeping the button beside (never over) the
1947
- * rendered document as it scrolls. Colors use local `--md-readonly-*` custom
1997
+ * The sticky overlay never changes text flow or the symmetric content margins.
1998
+ * Narrow margins let the control overlap content rather than reserving a rail.
1999
+ * Colors use local `--md-readonly-*` custom
1948
2000
  * properties with literal fallbacks so this base file stays theme-agnostic
1949
2001
  * (themes may override them).
1950
2002
  */
1951
2003
  .md-readonly-toggle-host {
1952
2004
  position: sticky;
1953
- top: 0;
1954
- width: calc(100% + var(--md-editor-content-inline-end-padding));
2005
+ top: var(--md-readonly-toggle-inset);
1955
2006
  height: 0;
1956
2007
  z-index: 10;
1957
2008
  pointer-events: none;
@@ -1985,17 +2036,6 @@ ol.md-list>.md-list-item-active>.md-list-gutter>.md-marker-listItemMarker,
1985
2036
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
1986
2037
  }
1987
2038
 
1988
- /*
1989
- * Below this width there is not enough document column for the side rail to be
1990
- * useful. Give the host its own row and stop it from sticking, so neither long
1991
- * unbreakable content nor later content scrolled through the viewport can ever
1992
- * pass underneath the button.
1993
- */
1994
- .md-editor-narrow .md-readonly-toggle-host {
1995
- position: relative;
1996
- height: calc(var(--md-readonly-toggle-height) + var(--md-readonly-toggle-inset) + var(--md-readonly-toggle-inset));
1997
- }
1998
-
1999
2039
  .md-readonly-toggle::after {
2000
2040
  content: '';
2001
2041
  position: absolute;
@@ -49,6 +49,7 @@
49
49
  * stays visible on dark color themes.
50
50
  */
51
51
  --md-cursor-background: var(--vscode-editorCursor-foreground, #000);
52
+ --md-whitespace-foreground: var(--vscode-editorWhitespace-foreground, #b0b0b0);
52
53
  --md-html-comment-foreground: var(--vscode-descriptionForeground, #616161);
53
54
  --md-html-comment-hover-foreground: var(--vscode-editor-foreground, #1f2328);
54
55
  --md-html-comment-font-family: var(--vscode-editor-font-family, ui-monospace, SFMono-Regular,
@@ -58,6 +58,7 @@
58
58
  * stays visible on dark color themes.
59
59
  */
60
60
  --md-cursor-background: var(--vscode-editorCursor-foreground, #000);
61
+ --md-whitespace-foreground: var(--vscode-editorWhitespace-foreground, #b0b0b0);
61
62
  --md-html-comment-foreground: var(--vscode-descriptionForeground, #59636e);
62
63
  --md-html-comment-hover-foreground: var(--vscode-editor-foreground, #1f2328);
63
64
  --md-html-comment-font-family: var(--vscode-editor-font-family, ui-monospace, SFMono-Regular,