@vscode/markdown-editor 0.0.2-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.
Files changed (62) hide show
  1. package/dist/commands/cursorCommands.d.ts +13 -0
  2. package/dist/commands/editCommands.d.ts +14 -0
  3. package/dist/commands/index.d.ts +4 -0
  4. package/dist/commands/selectionCommands.d.ts +6 -0
  5. package/dist/commands/types.d.ts +26 -0
  6. package/dist/core/geometry.d.ts +37 -0
  7. package/dist/core/index.d.ts +8 -0
  8. package/dist/core/lengthEdit.d.ts +38 -0
  9. package/dist/core/offsetRange.d.ts +26 -0
  10. package/dist/core/selection.d.ts +13 -0
  11. package/dist/core/sourceOffset.d.ts +1 -0
  12. package/dist/core/stringEdit.d.ts +27 -0
  13. package/dist/core/stringValue.d.ts +8 -0
  14. package/dist/core/wordUtils.d.ts +6 -0
  15. package/dist/highlighter/defaultMonacoSyntaxHighlighter.d.ts +20 -0
  16. package/dist/highlighter/index.d.ts +3 -0
  17. package/dist/highlighter/monacoSyntaxHighlighter.d.ts +38 -0
  18. package/dist/highlighter/syntaxHighlighter.d.ts +67 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.js +4274 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/model/cursorNavigation.d.ts +7 -0
  23. package/dist/model/editorModel.d.ts +54 -0
  24. package/dist/model/index.d.ts +4 -0
  25. package/dist/model/measuredLayoutModel.d.ts +50 -0
  26. package/dist/observables.d.ts +1 -0
  27. package/dist/observables.js +463 -0
  28. package/dist/observables.js.map +1 -0
  29. package/dist/parser/_micromarkAdapter.d.ts +7 -0
  30. package/dist/parser/ast.d.ts +274 -0
  31. package/dist/parser/index.d.ts +4 -0
  32. package/dist/parser/parse.d.ts +2 -0
  33. package/dist/parser/parser.d.ts +14 -0
  34. package/dist/parser/reconcile.d.ts +33 -0
  35. package/dist/parser/test/getAnnotatedSource.d.ts +2 -0
  36. package/dist/parser/test/snapshot.d.ts +9 -0
  37. package/dist/parser/visualizeAst.d.ts +33 -0
  38. package/dist/runOnChange-owE1SMC0.js +1514 -0
  39. package/dist/runOnChange-owE1SMC0.js.map +1 -0
  40. package/dist/test/random.d.ts +16 -0
  41. package/dist/view/content/blockView.d.ts +179 -0
  42. package/dist/view/content/documentView.d.ts +41 -0
  43. package/dist/view/content/dom.d.ts +16 -0
  44. package/dist/view/content/katexEditableIdentifiers.d.ts +36 -0
  45. package/dist/view/content/viewNode.d.ts +93 -0
  46. package/dist/view/editorController.d.ts +34 -0
  47. package/dist/view/editorView.d.ts +100 -0
  48. package/dist/view/fixture/astViewerView.d.ts +27 -0
  49. package/dist/view/fixture/cyclingTsHighlighter.d.ts +17 -0
  50. package/dist/view/fixture/debugColors.d.ts +26 -0
  51. package/dist/view/fixture/monacoDebugPanel.d.ts +7 -0
  52. package/dist/view/index.d.ts +9 -0
  53. package/dist/view/measuredLayoutDebugView.d.ts +70 -0
  54. package/dist/view/parts/cursorView.d.ts +29 -0
  55. package/dist/view/parts/selectionView.d.ts +57 -0
  56. package/dist/view/viewData.d.ts +251 -0
  57. package/dist/view/visualLineMap.d.ts +157 -0
  58. package/dist/view/visualizeViewTree.d.ts +5 -0
  59. package/package.json +68 -0
  60. package/src/view/editor.css +517 -0
  61. package/src/view/themes/default.css +235 -0
  62. package/src/view/themes/github.css +308 -0
@@ -0,0 +1,235 @@
1
+ /*
2
+ * Default ("plain") markdown theme.
3
+ *
4
+ * The editor's original typography, extracted out of the functional base and
5
+ * scoped under `.md-theme-default`. Apply it via the editor `classNames`
6
+ * option:
7
+ *
8
+ * new EditorView(model, { classNames: ['md-theme-default'] });
9
+ *
10
+ * Every selector is scoped under the theme class, so importing this file
11
+ * never affects the global page or any editor that did not opt in.
12
+ */
13
+
14
+ .md-editor.md-theme-default {
15
+ font-family: system-ui, -apple-system, sans-serif;
16
+ font-size: 16px;
17
+ line-height: 1.6;
18
+ max-width: 800px;
19
+ }
20
+
21
+ .md-theme-default .md-heading {
22
+ margin: 0.5em 0 0.25em;
23
+ }
24
+
25
+ .md-theme-default .md-paragraph {
26
+ margin: 0.5em 0;
27
+ }
28
+
29
+ .md-theme-default .md-code-block {
30
+ background: #f4f4f4;
31
+ border-radius: 4px;
32
+ padding: 12px 16px;
33
+ margin: 0.5em 0;
34
+ }
35
+
36
+ .md-theme-default .md-code-block code {
37
+ font-family: 'Cascadia Code', 'Fira Code', monospace;
38
+ font-size: 14px;
39
+ }
40
+
41
+ /* Syntax-highlight token colours (VS Code light theme palette). */
42
+ .md-theme-default .md-code-block .tok-keyword {
43
+ color: #0000ff;
44
+ }
45
+
46
+ .md-theme-default .md-code-block .tok-string {
47
+ color: #a31515;
48
+ }
49
+
50
+ .md-theme-default .md-code-block .tok-comment {
51
+ color: #008000;
52
+ }
53
+
54
+ .md-theme-default .md-code-block .tok-number {
55
+ color: #098658;
56
+ }
57
+
58
+ .md-theme-default .md-code-block .tok-regexp {
59
+ color: #811f3f;
60
+ }
61
+
62
+ .md-theme-default .md-code-block .tok-type {
63
+ color: #267f99;
64
+ }
65
+
66
+ .md-theme-default .md-code-block .tok-annotation {
67
+ color: #267f99;
68
+ }
69
+
70
+ .md-theme-default .md-code-block .tok-tag {
71
+ color: #800000;
72
+ }
73
+
74
+ .md-theme-default .md-code-block .tok-attribute {
75
+ color: #e50000;
76
+ }
77
+
78
+ .md-theme-default .md-code-block .tok-delimiter {
79
+ color: #000000;
80
+ }
81
+
82
+ .md-theme-default .md-math-block {
83
+ border-radius: 4px;
84
+ padding: 12px 16px;
85
+ margin: 0.5em 0;
86
+ }
87
+
88
+ .md-theme-default .md-math-block code {
89
+ font-family: 'Cascadia Code', 'Fira Code', monospace;
90
+ font-size: 14px;
91
+ }
92
+
93
+ .md-theme-default .md-inline-math {
94
+ padding: 2px 4px;
95
+ border-radius: 3px;
96
+ }
97
+
98
+ .md-theme-default .md-inline-math .katex {
99
+ line-height: 1;
100
+ }
101
+
102
+ .md-theme-default .md-thematic-break {
103
+ border: none;
104
+ border-top: 2px solid #e0e0e0;
105
+ margin: 1em 0;
106
+ }
107
+
108
+ .md-theme-default .md-blockquote {
109
+ border-left: 4px solid #ddd;
110
+ margin: 0.5em 0;
111
+ padding: 0 0 0 16px;
112
+ /* The left padding the `>` gutter hangs in (matches padding-left). */
113
+ --md-blockquote-pad: 16px;
114
+ color: #666;
115
+ }
116
+
117
+ .md-theme-default .md-list {
118
+ margin: 0.5em 0;
119
+ padding-left: 24px;
120
+ /* The per-level indentation step the list gutter fills (matches padding-left). */
121
+ --md-list-indent-step: 24px;
122
+ }
123
+
124
+ .md-theme-default .md-table {
125
+ border-collapse: collapse;
126
+ margin: 0.5em 0;
127
+ width: auto;
128
+ }
129
+
130
+ .md-theme-default .md-table th,
131
+ .md-theme-default .md-table td {
132
+ border: 1px solid #ddd;
133
+ padding: 6px 12px;
134
+ text-align: left;
135
+ }
136
+
137
+ .md-theme-default .md-table th {
138
+ background: #f4f4f4;
139
+ font-weight: 600;
140
+ }
141
+
142
+ /* Header reserves extra vertical space when inactive; reclaimed when active
143
+ to host the delimiter row, keeping the table height constant. */
144
+ .md-theme-default .md-table tr:first-child td {
145
+ padding-top: 11px;
146
+ padding-bottom: 11px;
147
+ }
148
+
149
+ .md-theme-default .md-table.md-block-active tr:first-child td {
150
+ padding-top: 3px;
151
+ padding-bottom: 3px;
152
+ }
153
+
154
+ .md-theme-default .md-table tbody tr:nth-child(even) {
155
+ background: #fafafa;
156
+ }
157
+
158
+ /* Delimiter row (`| --- | --- |`) is edit-time source: borderless, compact. */
159
+ .md-theme-default .md-table-delimiter-row td {
160
+ border: 0;
161
+ padding: 0 12px;
162
+ background: transparent;
163
+ }
164
+
165
+ /*
166
+ * Active table: the source `|` pipes ARE the outline. Drop the HTML cell
167
+ * borders (kept as transparent so the 1px box geometry — and thus the table's
168
+ * height and first-text X — is unchanged) and clear the header/zebra fills so
169
+ * the table reads as plain source.
170
+ */
171
+ .md-theme-default .md-table.md-block-active td {
172
+ border-color: transparent;
173
+ }
174
+
175
+ .md-theme-default .md-table.md-block-active tr:first-child td {
176
+ background: transparent;
177
+ }
178
+
179
+ .md-theme-default .md-table.md-block-active tbody tr:nth-child(even) td {
180
+ background: transparent;
181
+ }
182
+
183
+ /*
184
+ * Shift each cell's leading pipe onto its left gridline (where the border was)
185
+ * and the last cell's closing pipe onto the right gridline. `position:
186
+ * relative` moves only the painted glyph by the cell's horizontal padding;
187
+ * siblings and the glue's reserved width are untouched, so active/inactive
188
+ * height and first-text X stay pixel-identical. The delimiter row's single
189
+ * `tableDelimiter` marker is shifted the same way to line its leading pipe up.
190
+ */
191
+ .md-theme-default .md-table.md-block-active td>.md-glue-tableCellGlue:first-child,
192
+ .md-theme-default .md-table.md-block-active .md-table-delimiter-row td>.md-marker-tableDelimiter {
193
+ position: relative;
194
+ left: -12px;
195
+ }
196
+
197
+ /*
198
+ * The last cell's closing `|` floats right after the (left-aligned) cell text,
199
+ * so on its own it would be ragged between rows of differing width. Pin it to
200
+ * the column's right gridline (the cell's border edge, 12px past the content
201
+ * box) so the right outline is a straight line. Absolute removes it from flow,
202
+ * but it is the trailing node so no text shifts; the leading pipe still fixes
203
+ * first-text X and the row stays one line tall, keeping the compare invariants.
204
+ */
205
+ .md-theme-default .md-table.md-block-active td:last-child {
206
+ position: relative;
207
+ }
208
+
209
+ .md-theme-default .md-table.md-block-active td:last-child>.md-glue-tableCellGlue:last-child {
210
+ position: absolute;
211
+ right: 0;
212
+ top: 0;
213
+ }
214
+
215
+ /*
216
+ * The delimiter row's last cell carries its closing `|` as a separate
217
+ * `tableDelimiterClose` marker; pin it to the same right gridline as the body
218
+ * rows' closing pipe so the last column's outline stays straight.
219
+ */
220
+ .md-theme-default .md-table.md-block-active .md-table-delimiter-row td:last-child>.md-marker-tableDelimiterClose {
221
+ position: absolute;
222
+ right: 0;
223
+ top: 0;
224
+ }
225
+
226
+ .md-theme-default code {
227
+ font-family: 'Cascadia Code', 'Fira Code', monospace;
228
+ font-size: 0.9em;
229
+ }
230
+
231
+ .md-theme-default :not(pre)>code {
232
+ background: #f0f0f0;
233
+ padding: 2px 4px;
234
+ border-radius: 3px;
235
+ }
@@ -0,0 +1,308 @@
1
+ /*
2
+ * GitHub markdown theme.
3
+ *
4
+ * A faithful port of the GitHub markdown (light) typography used by the VS
5
+ * Code markdown preview (`bierner.markdown-preview-github-styles`), scoped
6
+ * under `.github-markdown-theme`. Apply it via the editor `classNames`
7
+ * option:
8
+ *
9
+ * new EditorView(model, { classNames: ['github-markdown-theme'] });
10
+ *
11
+ * Colors are GitHub Primer "light" values. Every selector is scoped under
12
+ * the theme class, so this file overrides nothing globally and only styles
13
+ * an editor that opted in.
14
+ */
15
+
16
+ .md-editor.github-markdown-theme {
17
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans',
18
+ Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
19
+ font-size: 16px;
20
+ line-height: 1.5;
21
+ color: #1f2328;
22
+ max-width: 800px;
23
+ word-wrap: break-word;
24
+ }
25
+
26
+ .github-markdown-theme .md-heading {
27
+ margin-top: 24px;
28
+ margin-bottom: 16px;
29
+ font-weight: 600;
30
+ line-height: 1.25;
31
+ }
32
+
33
+ .github-markdown-theme h1.md-heading {
34
+ font-size: 2em;
35
+ padding-bottom: 0.3em;
36
+ border-bottom: 1px solid #d1d9e0b3;
37
+ }
38
+
39
+ .github-markdown-theme h2.md-heading {
40
+ font-size: 1.5em;
41
+ padding-bottom: 0.3em;
42
+ border-bottom: 1px solid #d1d9e0b3;
43
+ }
44
+
45
+ .github-markdown-theme h3.md-heading {
46
+ font-size: 1.25em;
47
+ }
48
+
49
+ .github-markdown-theme h4.md-heading {
50
+ font-size: 1em;
51
+ }
52
+
53
+ .github-markdown-theme h5.md-heading {
54
+ font-size: 0.875em;
55
+ }
56
+
57
+ .github-markdown-theme h6.md-heading {
58
+ font-size: 0.85em;
59
+ color: #59636e;
60
+ }
61
+
62
+ .github-markdown-theme .md-paragraph {
63
+ margin-top: 0;
64
+ margin-bottom: 16px;
65
+ }
66
+
67
+ .github-markdown-theme .md-blockquote {
68
+ margin: 0 0 16px 0;
69
+ padding: 0 1em;
70
+ /*
71
+ * The left padding the `>` gutter hangs in (matches padding-left: 1em at
72
+ * the 16px blockquote font). Must be an absolute length, not `1em`: the
73
+ * marker positions itself with this var inside its own (smaller, 0.85em)
74
+ * font context, so an `em` value would resolve against the marker's
75
+ * font-size and pull the `>` ~2px out of alignment with the text.
76
+ */
77
+ --md-blockquote-pad: 16px;
78
+ color: #59636e;
79
+ border-left: 0.25em solid #d1d9e0;
80
+ }
81
+
82
+ .github-markdown-theme .md-list {
83
+ margin-top: 0;
84
+ margin-bottom: 16px;
85
+ padding-left: 2em;
86
+ /* The per-level indentation step the list gutter fills (matches padding-left). */
87
+ --md-list-indent-step: 2em;
88
+ }
89
+
90
+ .github-markdown-theme .md-thematic-break {
91
+ height: 0.25em;
92
+ padding: 0;
93
+ margin: 24px 0;
94
+ background-color: #d1d9e0;
95
+ border: 0;
96
+ }
97
+
98
+ .github-markdown-theme a {
99
+ color: #0969da;
100
+ text-decoration: none;
101
+ }
102
+
103
+ .github-markdown-theme a:hover {
104
+ text-decoration: underline;
105
+ }
106
+
107
+ /* GitHub uses a 600 weight for bold, not the browser default 700. */
108
+ .github-markdown-theme strong {
109
+ font-weight: 600;
110
+ }
111
+
112
+ /* Inline code. */
113
+ .github-markdown-theme :not(pre)>code {
114
+ font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
115
+ 'Liberation Mono', monospace;
116
+ font-size: 85%;
117
+ padding: 0.2em 0.4em;
118
+ margin: 0;
119
+ background-color: #818b981f;
120
+ border-radius: 6px;
121
+ white-space: break-spaces;
122
+ }
123
+
124
+ /* Fenced code block. */
125
+ .github-markdown-theme .md-code-block {
126
+ margin-top: 0;
127
+ margin-bottom: 16px;
128
+ padding: 10px 16px;
129
+ font-size: 85%;
130
+ line-height: 1.45;
131
+ background-color: #f6f8fa;
132
+ border-radius: 6px;
133
+ }
134
+
135
+ .github-markdown-theme .md-code-block code {
136
+ font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
137
+ 'Liberation Mono', monospace;
138
+ padding: 0;
139
+ background-color: transparent;
140
+ border-radius: 0;
141
+ }
142
+
143
+ /* Syntax highlighting tokens (GitHub light / Primer palette). */
144
+ .github-markdown-theme .md-code-block .tok-keyword {
145
+ color: #cf222e;
146
+ }
147
+
148
+ .github-markdown-theme .md-code-block .tok-string {
149
+ color: #0a3069;
150
+ }
151
+
152
+ .github-markdown-theme .md-code-block .tok-comment {
153
+ color: #6e7781;
154
+ }
155
+
156
+ .github-markdown-theme .md-code-block .tok-number {
157
+ color: #0550ae;
158
+ }
159
+
160
+ .github-markdown-theme .md-code-block .tok-regexp {
161
+ color: #0a3069;
162
+ }
163
+
164
+ .github-markdown-theme .md-code-block .tok-type {
165
+ color: #953800;
166
+ }
167
+
168
+ .github-markdown-theme .md-code-block .tok-annotation {
169
+ color: #953800;
170
+ }
171
+
172
+ .github-markdown-theme .md-code-block .tok-tag {
173
+ color: #116329;
174
+ }
175
+
176
+ .github-markdown-theme .md-code-block .tok-attribute {
177
+ color: #0550ae;
178
+ }
179
+
180
+ .github-markdown-theme .md-code-block .tok-delimiter {
181
+ color: #24292f;
182
+ }
183
+
184
+ /*
185
+ * Display math has no container styling on GitHub / the VS Code preview
186
+ * (KaTeX renders it inline-centered). Keep only the block spacing; the
187
+ * horizontal scroll comes from the base stylesheet.
188
+ */
189
+ .github-markdown-theme .md-math-block {
190
+ margin-top: 0;
191
+ margin-bottom: 16px;
192
+ }
193
+
194
+ /*
195
+ * KaTeX renders inline math at 1.21em with its own (larger) line-height, which
196
+ * would inflate the surrounding line box and make the line taller when the math
197
+ * is rendered (inactive) than when its source markers are shown (active).
198
+ * Collapse the KaTeX line-height so the rendered math fits the text line and the
199
+ * paragraph height stays identical active vs inactive.
200
+ */
201
+ .github-markdown-theme .md-inline-math .katex {
202
+ line-height: 1;
203
+ }
204
+
205
+ .github-markdown-theme .md-table {
206
+ border-collapse: collapse;
207
+ margin-top: 0;
208
+ margin-bottom: 16px;
209
+ width: auto;
210
+ }
211
+
212
+ .github-markdown-theme .md-table th,
213
+ .github-markdown-theme .md-table td {
214
+ padding: 6px 13px;
215
+ border: 1px solid #d1d9e0;
216
+ text-align: left;
217
+ }
218
+
219
+ /*
220
+ * The editor renders every cell as <td> in a flat <table> of <tr> (no
221
+ * <thead>/<tbody>/<th>). Row order is: header, delimiter row, body rows. The
222
+ * header is the first row; GitHub zebra-stripes every other body row, which —
223
+ * counting the delimiter row at position 2 — are the even-positioned rows
224
+ * other than the delimiter row itself.
225
+ */
226
+ .github-markdown-theme .md-table tr:first-child td {
227
+ font-weight: 600;
228
+ padding-top: 11px;
229
+ padding-bottom: 11px;
230
+ }
231
+
232
+ /* Active: reclaim the header's extra spacing to host the delimiter row. */
233
+ .github-markdown-theme .md-table.md-block-active tr:first-child td {
234
+ padding-top: 3px;
235
+ padding-bottom: 3px;
236
+ }
237
+
238
+ .github-markdown-theme .md-table tr:nth-child(even):not(.md-table-delimiter-row) {
239
+ background-color: #f6f8fa;
240
+ }
241
+
242
+ /*
243
+ * The delimiter row (`| --- | --- |`) is editor source shown only while
244
+ * editing; render it borderless with no vertical padding so it occupies just
245
+ * the compact 10px reclaimed from the header.
246
+ */
247
+ .github-markdown-theme .md-table-delimiter-row td {
248
+ border: 0;
249
+ padding: 0 13px;
250
+ background: transparent;
251
+ }
252
+
253
+ /*
254
+ * Active table: the source `|` pipes ARE the outline. Drop the HTML cell
255
+ * borders (kept as transparent so the 1px box geometry — and thus the table's
256
+ * height and first-text X — is unchanged) and clear the zebra fill so the
257
+ * table reads as plain source.
258
+ */
259
+ .github-markdown-theme .md-table.md-block-active td {
260
+ border-color: transparent;
261
+ }
262
+
263
+ .github-markdown-theme .md-table.md-block-active tr:nth-child(even):not(.md-table-delimiter-row) td {
264
+ background-color: transparent;
265
+ }
266
+
267
+ /*
268
+ * Shift each cell's leading pipe onto its left gridline (where the border was)
269
+ * and the last cell's closing pipe onto the right gridline. `position:
270
+ * relative` moves only the painted glyph by the cell's horizontal padding;
271
+ * siblings and the glue's reserved width are untouched, so active/inactive
272
+ * height and first-text X stay pixel-identical. The delimiter row's single
273
+ * `tableDelimiter` marker is shifted the same way to line its leading pipe up.
274
+ */
275
+ .github-markdown-theme .md-table.md-block-active td>.md-glue-tableCellGlue:first-child,
276
+ .github-markdown-theme .md-table.md-block-active .md-table-delimiter-row td>.md-marker-tableDelimiter {
277
+ position: relative;
278
+ left: -13px;
279
+ }
280
+
281
+ /*
282
+ * The last cell's closing `|` floats right after the (left-aligned) cell text,
283
+ * so on its own it would be ragged between rows of differing width. Pin it to
284
+ * the column's right gridline (the cell's border edge, 13px past the content
285
+ * box) so the right outline is a straight line. Absolute removes it from flow,
286
+ * but it is the trailing node so no text shifts; the leading pipe still fixes
287
+ * first-text X and the row stays one line tall, keeping the compare invariants.
288
+ */
289
+ .github-markdown-theme .md-table.md-block-active td:last-child {
290
+ position: relative;
291
+ }
292
+
293
+ .github-markdown-theme .md-table.md-block-active td:last-child>.md-glue-tableCellGlue:last-child {
294
+ position: absolute;
295
+ right: 0;
296
+ top: 0;
297
+ }
298
+
299
+ /*
300
+ * The delimiter row's last cell carries its closing `|` as a separate
301
+ * `tableDelimiterClose` marker; pin it to the same right gridline as the body
302
+ * rows' closing pipe so the last column's outline stays straight.
303
+ */
304
+ .github-markdown-theme .md-table.md-block-active .md-table-delimiter-row td:last-child>.md-marker-tableDelimiterClose {
305
+ position: absolute;
306
+ right: 0;
307
+ top: 0;
308
+ }