@vscode/markdown-editor 0.0.2-12 → 0.0.2-120

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 (77) hide show
  1. package/README.md +571 -0
  2. package/dist/commands.d.ts +67 -0
  3. package/dist/commands.js +185 -0
  4. package/dist/commands.js.map +1 -0
  5. package/dist/config-BGeaJqWk.js +286 -0
  6. package/dist/config-BGeaJqWk.js.map +1 -0
  7. package/dist/config.d.ts +10 -0
  8. package/dist/config.js +6 -0
  9. package/dist/config.js.map +1 -0
  10. package/dist/index.d.ts +1964 -155
  11. package/dist/index.js +8134 -2188
  12. package/dist/index.js.map +1 -1
  13. package/dist/markdown-editor.css +1 -0
  14. package/dist/stringEdit-CVDbCUBY.js +215 -0
  15. package/dist/stringEdit-CVDbCUBY.js.map +1 -0
  16. package/dist/web-editors.d.ts +297 -0
  17. package/dist/web-editors.js +7359 -0
  18. package/dist/web-editors.js.map +1 -0
  19. package/package.json +66 -17
  20. package/src/contrib/comments/commentInput.css +89 -0
  21. package/src/contrib/comments/commentWidget.css +60 -0
  22. package/src/contrib/find/find.css +347 -0
  23. package/src/contrib/rename/rename.css +73 -0
  24. package/src/contrib/suggest/suggest.css +109 -0
  25. package/src/view/editor.css +1603 -66
  26. package/src/view/themes/default.css +21 -4
  27. package/src/view/themes/github.css +25 -13
  28. package/src/view/themes/vscode-default.css +407 -0
  29. package/src/view/themes/{vscode.css → vscode-github.css} +134 -62
  30. package/dist/_observables/assert.d.ts +0 -2
  31. package/dist/_observables/deps.d.ts +0 -28
  32. package/dist/_observables/disposables.d.ts +0 -19
  33. package/dist/_observables/equals.d.ts +0 -32
  34. package/dist/_observables/index.d.ts +0 -2
  35. package/dist/_observables/observableInternal/base.d.ts +0 -172
  36. package/dist/_observables/observableInternal/changeTracker.d.ts +0 -44
  37. package/dist/_observables/observableInternal/commonFacade/cancellation.d.ts +0 -24
  38. package/dist/_observables/observableInternal/commonFacade/deps.d.ts +0 -24
  39. package/dist/_observables/observableInternal/debugLocation.d.ts +0 -21
  40. package/dist/_observables/observableInternal/debugName.d.ts +0 -33
  41. package/dist/_observables/observableInternal/experimental/deferUnobserve.d.ts +0 -16
  42. package/dist/_observables/observableInternal/experimental/reducer.d.ts +0 -37
  43. package/dist/_observables/observableInternal/experimental/utils.d.ts +0 -15
  44. package/dist/_observables/observableInternal/index.d.ts +0 -25
  45. package/dist/_observables/observableInternal/logging/consoleObservableLogger.d.ts +0 -40
  46. package/dist/_observables/observableInternal/logging/debugGetDependencyGraph.d.ts +0 -4
  47. package/dist/_observables/observableInternal/logging/debugger/debuggerRpc.d.ts +0 -4
  48. package/dist/_observables/observableInternal/logging/debugger/devToolsLogger.d.ts +0 -43
  49. package/dist/_observables/observableInternal/logging/debugger/rpc.d.ts +0 -41
  50. package/dist/_observables/observableInternal/logging/debugger/utils.d.ts +0 -13
  51. package/dist/_observables/observableInternal/logging/logging.d.ts +0 -30
  52. package/dist/_observables/observableInternal/map.d.ts +0 -18
  53. package/dist/_observables/observableInternal/observables/baseObservable.d.ts +0 -58
  54. package/dist/_observables/observableInternal/observables/constObservable.d.ts +0 -5
  55. package/dist/_observables/observableInternal/observables/derived.d.ts +0 -46
  56. package/dist/_observables/observableInternal/observables/derivedImpl.d.ts +0 -83
  57. package/dist/_observables/observableInternal/observables/lazyObservableValue.d.ts +0 -27
  58. package/dist/_observables/observableInternal/observables/observableFromEvent.d.ts +0 -37
  59. package/dist/_observables/observableInternal/observables/observableSignal.d.ts +0 -11
  60. package/dist/_observables/observableInternal/observables/observableSignalFromEvent.d.ts +0 -5
  61. package/dist/_observables/observableInternal/observables/observableValue.d.ts +0 -37
  62. package/dist/_observables/observableInternal/observables/observableValueOpts.d.ts +0 -8
  63. package/dist/_observables/observableInternal/reactions/autorun.d.ts +0 -56
  64. package/dist/_observables/observableInternal/reactions/autorunImpl.d.ts +0 -53
  65. package/dist/_observables/observableInternal/set.d.ts +0 -17
  66. package/dist/_observables/observableInternal/transaction.d.ts +0 -27
  67. package/dist/_observables/observableInternal/utils/promise.d.ts +0 -75
  68. package/dist/_observables/observableInternal/utils/runOnChange.d.ts +0 -7
  69. package/dist/_observables/observableInternal/utils/utils.d.ts +0 -43
  70. package/dist/_observables/observableInternal/utils/utilsCancellation.d.ts +0 -10
  71. package/dist/_observables/observableInternal/utils/valueWithChangeEvent.d.ts +0 -10
  72. package/dist/_observables/utils.d.ts +0 -15
  73. package/dist/observables.d.ts +0 -4
  74. package/dist/observables.js +0 -439
  75. package/dist/observables.js.map +0 -1
  76. package/dist/runOnChange-C00UIwqQ.js +0 -1538
  77. package/dist/runOnChange-C00UIwqQ.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,571 @@
1
+ # Markdown editor
2
+
3
+ `@vscode/markdown-editor` is an experimental, browser-based hybrid Markdown
4
+ editor. It keeps Markdown source as the canonical document while presenting
5
+ inactive blocks in rendered form and active blocks in editable source form.
6
+
7
+ ## Package releases
8
+
9
+ The npm release pipelines run `pnpm exec turbo build --filter=@vscode/markdown-editor`.
10
+ The package build depends on the workspace observables, HubRPC, and web-editors
11
+ builds. Fixture-only dependencies (Component Explorer and the cmark WASM compiler)
12
+ remain in the fixture/screenshot task graph, not the library release graph.
13
+ Both stable and nightly release jobs install Chromium before running the package
14
+ tests, which include real-browser clipboard and widget tests.
15
+
16
+ The Markdown test runner is temporarily pinned to Playwright 1.56.1, matching
17
+ Monaco's release tooling. Its Chromium download uses Microsoft's distribution
18
+ endpoint; newer Chrome-for-Testing downloads redirect to Google storage, which
19
+ failed with `EPERM` on the Azure release agent. Keep the exact pin until the newer
20
+ download route is approved and verified on that agent. This affects test tooling,
21
+ not the published editor's runtime dependencies or Component Explorer's renderer.
22
+
23
+ ## Browser tests
24
+
25
+ `pnpm test:e2e` builds the fixture dependencies and runs the Playwright interaction
26
+ suite. Tests use isolated browser contexts and run in parallel, with four workers
27
+ in CI (override with Playwright's `--workers` option). This is separate from
28
+ Component Explorer's screenshot renderer, which already defaults to available
29
+ CPUs capped at eight workers. Screenshot computation remains Turbo-cached.
30
+
31
+ The Playwright `e2e/milestone-one.spec.ts` suite is temporarily skipped to unblock
32
+ CI while its debug-panel-based checks are replaced with fixture-native assertions.
33
+ The milestone fixtures remain in the screenshot pipeline; other E2E and unit
34
+ tests remain enabled.
35
+
36
+ In locked mode, submitting a comment or dismissing it with Escape keeps the input
37
+ hidden for the current selection, including across layout changes. Changing the
38
+ selection makes comment entry available again.
39
+
40
+ ## Editing policies
41
+
42
+ The editor has three independent policies:
43
+
44
+ - `EditorModel.readonlyMode`: disables text editing. The lock/pencil button
45
+ changes only this permission, not parsing, layout, or syntax visibility.
46
+ - `EditorModel.presentation`: `reading` uses conventional Markdown whitespace;
47
+ `editing` preserves source line breaks, blank lines, repeated spaces and tabs
48
+ while keeping rich formatting. Both work while locked or editable.
49
+ - `EditorModel.renderMarkupText`: `none` hides syntax, `selection` uses the
50
+ existing active-block revelation rules, and `all` reveals syntax throughout
51
+ the document. Hidden inline syntax occupies no width in either presentation.
52
+ Find can temporarily reveal hidden source for the current match without
53
+ changing this policy or cursor-navigation rules; closing Find removes the reveal.
54
+
55
+ Non-obvious spaces (leading, trailing, and runs of two or more) show dot
56
+ indicators wherever markup is revealed; tabs show an arrow. Ordinary single
57
+ inter-word spaces remain unmarked. The view-data layer maps markup visibility
58
+ to per-leaf `showWhitespace` booleans, so whitespace rendering does not depend
59
+ on the public policy enum. In editing presentation these are overlays on real
60
+ source whitespace: line breaks, wrapping, source offsets, and clipboard text
61
+ remain unchanged.
62
+
63
+ The model defaults to editable, reading presentation, and selection markup.
64
+ Hosts can initialize presentation with `EditorView`'s `presentation` option.
65
+ Switching presentation reparses without changing source or selection. Locking
66
+ does not reparse the document.
67
+
68
+ The editing preset maps to explicit parser options rather than a parser UI mode:
69
+ `explicitBlankLineBlocks`, `explicitFinalEmptyLine`,
70
+ `preserveTrailingListContinuation`, and `allowEmptyListItemInterrupts`.
71
+ Blank source lines become empty blocks; the final unfinished line stays in its
72
+ list paragraph when it can continue that paragraph. A blank line ends this lazy
73
+ continuation. Empty nested list prefixes are structural before their first text
74
+ character is typed. These narrow recognition deviations avoid structural jumps
75
+ while typing or deleting, without depending on editing history. The reading
76
+ preset leaves these extensions off.
77
+
78
+ Editing presentation recognizes empty task checkboxes (`[ ]`, `[x]`, and `[]`)
79
+ at end-of-file as well as before whitespace or a newline. Enter exits an empty
80
+ task just like an empty list item; a nested empty task first outdents.
81
+
82
+ In editing presentation, Enter continues complete list items and exits/outdents
83
+ empty ones. Elsewhere it inserts a single newline without creating a virtual
84
+ paragraph. Arrow Down also stays within
85
+ the existing source instead of creating a virtual paragraph.
86
+
87
+ At a soft wrap, the end of one visual line and start of the next share a source
88
+ offset. Mouse placement and visual-line navigation retain upstream caret
89
+ affinity when targeting the preceding line, without changing source offsets.
90
+ Explicit newlines and programmatic selections keep their existing behavior.
91
+
92
+ See [Editing property tests](docs/editing-properties.md) for the interactive
93
+ assertion fixtures, CI contracts, deterministic editing corpus, and the
94
+ red/green/visual evidence required for layout fixes.
95
+
96
+ ### Automatic links
97
+
98
+ Bare HTTP(S) URLs, `www.` addresses, and email addresses are detected using GFM
99
+ autolink rules. Angle-bracket autolinks are supported too. They use the same link
100
+ nodes and host presentation provider as explicit Markdown links, so recognized
101
+ GitHub issue URLs can receive VS Code rich presentations without `[label](url)`
102
+ syntax. Active links retain their exact editable source. Code spans and fenced
103
+ code do not auto-link; trailing punctuation is excluded from link targets.
104
+
105
+ Pasting a single HTTP(S) URL over selected inline text turns that selection into
106
+ a Markdown link, preserving inline formatting. Pasting without a selection,
107
+ inside code or an existing link, or across block boundaries keeps ordinary text
108
+ replacement. Ctrl/Cmd+Shift+V bypasses link creation with the async clipboard
109
+ strategy (including VS Code). Typed URLs do not wrap selections.
110
+
111
+ ### Fixture reference rendering
112
+
113
+ The real-editor examples expose **Interactive mode** in the fixture toolbar.
114
+ This live input enables browser typing and cursor blinking without resetting the
115
+ editor, selection, or recording; it defaults off for deterministic screenshots.
116
+
117
+ In the sidebar, **showEditModeToggle** restores the editor's lock button.
118
+ **readonly**, **presentation** (`reading` / `editing`), and **renderMarkupText**
119
+ (`none` / `selection` / `all`) control permission, presentation, and markup policy.
120
+ In read-only mode, `selection` keeps Markdown rendered even when text is selected;
121
+ unlocking restores selection-driven source markers. Explicit `all` still exposes
122
+ source for inspection, and diff/find diagnostics retain their explicit source reveals.
123
+ These controls are
124
+ live in the examples, main demos, content/selection fixtures, and Mermaid
125
+ fixtures: edits and selection survive changes. The dropdown follows the editor
126
+ button and replayed state. Legacy recordings with `sourceEditing` and
127
+ `activeEverywhere` are translated when loaded; new recordings store the explicit
128
+ policies. Existing fixture defaults are preserved, including
129
+ hidden buttons in the examples and selection fixtures. Browser input remains
130
+ controlled separately by **Interactive mode**.
131
+
132
+ The Compare diagnostics (injectivity, Arrow Down coverage, and active/inactive
133
+ comparison) also honor **showEditModeToggle**, defaulting to hidden. They retain
134
+ their diagnostic selection/presentation setup rather than synchronizing the
135
+ compared models through the interactive policy controls.
136
+ Injectivity activates each source character and compares its start and end in
137
+ that same layout. It does not compare coordinates across cell activations,
138
+ which can resize table columns when inline markers appear or collapse.
139
+
140
+ The **Reference** debug tab follows the editor's source and replay position.
141
+ Its renderer selector defaults to **GitHub (cmark-gfm)**, using the
142
+ [`@vscode/cmark-gfm-wasm`](../../../cmark-gfm-wasm/README.md) workspace package
143
+ with GFM tables, task lists, strikethrough, and autolinks. **markdown-it** retains
144
+ the previous reference engine for comparison (including its different task-list
145
+ behavior). Both use `github-markdown-css` in a script-disabled iframe.
146
+ Ordinary paragraphs and lists therefore usually look identical. For a visible
147
+ engine difference, try `- [x] Done`: cmark-gfm renders a checkbox, while the
148
+ markdown-it configuration leaves `[x]` as text.
149
+ This is GitHub's Markdown parser plus reference CSS, not GitHub's complete site
150
+ rendering/sanitization pipeline. cmark's safe HTML defaults remain enabled.
151
+ Initialization/rendering errors are displayed in the pane, not replaced by a
152
+ different engine.
153
+
154
+ The **Trees** pane groups **AST**, **Tokens**, **View data**, and **View** behind
155
+ a dropdown. **Split right** opens another copy with an independent tree
156
+ selection; both continue to follow live edits and replay. **Layout** remains a
157
+ separate pane.
158
+
159
+ Fixture dependency builds now require Emscripten 4.0.15 and CMake for cmark-gfm.
160
+ Alternatively, build that package with `pnpm --filter @vscode/cmark-gfm-wasm
161
+ build:docker`, then run `pnpm run build:fixtures` once the other fixture
162
+ dependencies have been built. Production editor bundles do not include this
163
+ fixture-only renderer.
164
+
165
+ ### Language feature widgets
166
+
167
+ `RenameModel` / `RenameWidget` and `SuggestModel` / `SuggestWidget` are isolated,
168
+ observable-driven contributions exported from the package. Import
169
+ `@vscode/markdown-editor/rename.css` or `@vscode/markdown-editor/suggest.css`
170
+ alongside the corresponding widget. Hosts own provider requests, edit application,
171
+ command routing, and editor integration; importing a widget does not enable a
172
+ language feature automatically.
173
+
174
+ See the [rename integration guide](src/contrib/rename/README.md) and
175
+ [suggest integration guide](src/contrib/suggest/README.md) for their contracts,
176
+ focus handling, and lifecycle requirements.
177
+
178
+ ### Milestone 1 editing coverage
179
+
180
+ The `editor/milestone-1` fixture group is generated from
181
+ `src/view/fixture/milestoneOneScenarios.ts`. Each unique source, directed
182
+ selection, and presentation state mounts the real editor directly. Screenshot
183
+ fixtures do not replay editing history: restored undo/redo states and other
184
+ identical states are deduplicated across the group. Behavioral tests cover
185
+ typing and history separately. The star has detailed prefix coverage; other
186
+ list markers each have a sanity state rather than a duplicate sequence.
187
+ Examples default to 360px wide and content-sized height. **Editor margin**,
188
+ width, markup policy, read-only toggle, and interactive input controls support
189
+ live visual review. Disabling editor margins retains a left rail for hanging
190
+ source markers. The source-selection status uses a fixed-height, ellipsized row.
191
+
192
+ | Family | Source-state coverage | Still to verify before milestone completion |
193
+ | --- | --- | --- |
194
+ | Text and whitespace | Spaces, tabs, soft line breaks, graphemes, empty/populated documents, directed selections | Empty-file VS Code integration, wrapping, clipboard and IME |
195
+ | Headings | ATX levels 1/2/6, setext creation, incomplete prefixes | Other levels, Enter/split/join and caret geometry across wrapping |
196
+ | Lists | Star prefixes, alternate-marker sanity checks, lazy continuation, stable blank-line carets, source/bullet alignment, list continuation/exit | Broader active-block ownership, indentation/outdent and nested combinations |
197
+ | Task lists | Checked/unchecked prefixes, nested task ownership, mixed sibling label alignment | Toggling/history and broader nested task transitions |
198
+ | Links | Inline destination completion, reference definition completion, formatted labels | Escapes/titles, selections at boundaries, mouse placement and wrapped labels |
199
+ | Inline formatting | Star/underscore italics, bold, strike, bold-italic and nested/adjacent emphasis | Delimiter boundary matrix, escaped punctuation, cross-line and cross-block selections |
200
+
201
+ These are coverage seeds, not a claim that every combination is complete.
202
+ Concrete feedback must receive a named fixture plus behavioral/geometry
203
+ assertions; screenshot review alone does not close a regression.
204
+ Point-to-source resolution always uses the editor's geometric hit test. The
205
+ demo's `caretDomPosArea` visualization samples that same path; the browser
206
+ caret hit-test alternative and its `caretDomPos`/`ownHitTest` switches are removed.
207
+
208
+ The list-marker review deliberately distinguishes presentation policies.
209
+ Editing presentation treats a bare `*`, `-`, `+`, or ordered marker as paragraph
210
+ text until its separator space/tab exists. A standalone bare marker has no list
211
+ indentation; a bare continuation stays in its existing bullet paragraph. Inserting
212
+ the separator promotes it, and deleting the separator reverses that promotion.
213
+ Reading presentation retains CommonMark empty-list parsing, with the caret
214
+ immediately after the actual marker rather than its synthetic gutter separator.
215
+ The `lists/lazy-continuation` checkpoints, parser ownership tests, and browser
216
+ geometry/history regressions cover these differences.
217
+
218
+ The `lists/empty-line-0` and `lists/lazy-empty-line`
219
+ checkpoints compare the same caret at EOF and before an additional newline,
220
+ without duplicate restored-state screenshots. The first empty continuation line of a
221
+ populated list paragraph keeps its indentation even when another newline follows;
222
+ the final line after the list terminator remains outside the list. Empty
223
+ marker-only items retain their existing empty-line placement.
224
+
225
+ `lists/nested-indent-dots` spreads source indentation indicators over the reserved
226
+ gutter. `lists/indent-space-1`, `lists/indent-space-2`, and `lists/indent-space-3`
227
+ isolate individual space selections and caret movement before a list marker.
228
+ Parsed list depth determines the gutter width; the actual source whitespace
229
+ shares that width evenly, rather than assuming two spaces per nesting level.
230
+ Each space's source-mapped text and dot fill its allocated cell. At the final
231
+ indentation boundary the caret meets the actual source glyph, including its
232
+ normal font sidebearing; the selection spans those exact caret endpoints.
233
+ Source-only spaces that do not create a nested item extend
234
+ leftward into the gutter instead of moving the logical bullet or text column.
235
+ Their display width uses the parsed marker prefix, not a fixed two-space rule.
236
+ Native bullet typography is unchanged.
237
+ Nested task prefixes use half-width indentation cells to bring their first
238
+ source-space dot closer to ordinary siblings without moving bullets, checkboxes,
239
+ or labels. Unordered-list continuation indentation reuses the source prefix's
240
+ indentation, marker, and separator cells, including an indented blank line
241
+ following a list. `lists/mixed-prefix-spaces`, `lists/blank-continuation-spaces`,
242
+ and `lists/nested-continuation-spaces` isolate these cases; browser tests verify
243
+ each cell's geometry, clicking, arrow movement, and typing at four font sizes.
244
+ Within a list paragraph, every continuation prefix occupies a source-mapped
245
+ gutter ending at the text column, rather than adding indentation inside it.
246
+ Quote prefixes and list indentation on the same line share that gutter.
247
+ The `lists/same-paragraph-continuation`, `lists/nested-same-paragraph-continuation`,
248
+ and `lists/quoted-same-paragraph-continuation` fixtures show inactive and active
249
+ states. Browser tests cover ordinary, ordered, task, nested and quoted lists,
250
+ tabs, CRLF, hard breaks, wrapped lines, cross-line formatting/link labels,
251
+ multiple continuation lines, prefix clicks, and caret movement.
252
+ Reading presentation retains its existing soft-line-break behavior.
253
+ The `lists/indent-depth-2`, `lists/indent-depth-uneven`, and `lists/indent-prefix-3`
254
+ fixtures reconstruct the nested-spacing feedback with minimal sources.
255
+ Browser geometry assertions also cover wider ordered prefixes, tabs,
256
+ markup visibility, typing, and undo.
257
+
258
+ Typing the third backtick of a new opening fence inserts a closing fence on the
259
+ next line, leaving the caret on the opener for a language name. Container
260
+ indentation is retained; pasted, inline, already-paired, and closing fences are
261
+ not completed. `formatting/fence-completion` captures the typing states. Enter
262
+ inside a fenced block preserves its indentation in editing presentation.
263
+ `lists/fenced-continuation-spaces` covers list-contained fences: opening, code,
264
+ and closing-line spaces reuse the list's source prefix cells, including with
265
+ syntax highlighting, without changing reading presentation.
266
+
267
+ The mode toggle is a sticky overlay in the right margin when there is room,
268
+ and may overlap content in narrow editors. It never changes text flow or reserves
269
+ an asymmetric rail. Left and right padding use two fixed sizes, without
270
+ intermediate scaling: 8px through 600px editor width, then 48px.
271
+ Once the document reaches its configured maximum width (900px by default),
272
+ it stays that width and additional space goes equally to the outer margins.
273
+ Disabling the width limit keeps the 48px margins on wide editors.
274
+ Top-level headings retain
275
+ symmetric 2em minimum clearance for their hanging markers, independent of heading
276
+ level. Long prefixes scale to fit that gutter instead of moving the document.
277
+ Top padding stays at 32px regardless of editor width, document content, or
278
+ scrollbar gutters. The VS Code webview uses thin scrollbars with transparent
279
+ tracks. First and later headings use identical font line boxes, preserving the
280
+ same text-to-underline spacing. Only the first block's top margin is removed;
281
+ the fixed top padding provides the optical spacing adjustment.
282
+ The `editor/readonly-toggle/` fixtures include wide, narrow, and scrolling documents.
283
+ The first block has no additional top margin in either presentation. The first
284
+ block inside a blockquote also has no top margin, preventing it from collapsing
285
+ outward and shifting the quote when a marker-only line gains content. The
286
+ paired `HeadingReading` and `HeadingEditing` fixtures and lock-toggle browser
287
+ tests guard its text position. VS Code themes map whitespace indicators to
288
+ `editorWhitespace.foreground`, including its dark-theme opacity.
289
+ The `HeadingSpacingH1` and `HeadingSpacingH2` fixtures compare first and later
290
+ headings; browser tests cover their underline spacing across themes, widths,
291
+ wrapped text, presentation modes, and active or inactive selections.
292
+
293
+ An empty, unlocked document defaults to a collapsed selection at offset zero
294
+ when opened, cleared externally, switched into editing presentation, or unlocked.
295
+ This does not take keyboard focus: the caret blinks only while the editor is
296
+ focused. Explicit deselection remains respected until the next document or mode
297
+ transition. Reading and locked documents keep their existing selection behavior.
298
+ `EmptyEditing` captures the empty surface; browser tests verify actual blink
299
+ cycles, blur, typing/deleting, and presentation/lock transitions.
300
+
301
+ Escape clears an existing selection, including a collapsed caret, and cancels
302
+ any pending empty paragraph. Open find/suggestion widgets and focused nested
303
+ controls handle Escape first. With no selection or pending paragraph, Escape
304
+ remains available to the host. Clicking beside or below the document also clears
305
+ selection: the editor fills a fixed-height host so its blank area receives the
306
+ same pointer handling as the margins, without stretching the document itself.
307
+
308
+ Set `EditorViewOptions.highlightActiveBlock` to `false` to disable the active
309
+ block's background and glow, or update the live `view.highlightActiveBlock`
310
+ observable. This does not change active source markers, selection, or editing
311
+ behavior. Highlighting is enabled by default.
312
+
313
+ Empty ATX headings keep their separator whitespace in the same source marker
314
+ as populated headings. A zero-source-length line anchor preserves the heading
315
+ caret's column and line box when typing or removing its first character.
316
+ The existing `headings/atx-*` empty-prefix states and `headings/prefix-caret-*`
317
+ populated states cover this transition.
318
+
319
+ Rich-link pills at the end of a rendered line may use the remaining content
320
+ width before truncating their title. Short titles retain their natural width;
321
+ pills followed by prose retain their compact title limit. The width is updated
322
+ with editor layout and metadata changes, respecting list indentation and the
323
+ mode toggle's local exclusion rectangle. `Links/Rich links/Static/Trailing titles`
324
+ provides long, short, mid-line, formatted, and session-link examples.
325
+
326
+ `task-lists/nested-task-ownership` prevents a child checkbox from turning its
327
+ parent into a task. `task-lists/mixed-task-labels` aligns labels of task and
328
+ ordinary sibling items while preserving nested indentation. The ordinary
329
+ item's real separator spaces expand to fill the extra label-column width.
330
+ `task-lists/nested-task-empty-sibling-*` and `task-lists/mixed-task-separated-lists-*`
331
+ isolate populated/empty nested tasks and mixed lists separated by a thematic break.
332
+ In both presentations, checkboxes and ordinary bullets share a gutter column;
333
+ the task's extra source bullet hangs farther left. Labels keep their position
334
+ when markup visibility changes, except for extra source-only separator padding.
335
+ `lists/mixed-label-column` compares the same nested labels in reading and editing;
336
+ both use one shared marker/label layout rather than separate task indentation.
337
+ The expanded ordinary separator has a visible
338
+ whitespace dot. Browser tests click task-label characters with markup hidden,
339
+ selection-revealed, and fully revealed, then verify exact insertion offsets.
340
+ `task-lists/empty-task-label` keeps a completed checkbox plus separator structural
341
+ before label text is typed in editing presentation. Reading retains standard GFM
342
+ parsing. Typing or deleting the label must not change checkbox ownership or move
343
+ the empty caret's text column.
344
+ The `task-lists/checkbox-separator-*` fixtures cover the caret immediately
345
+ after `]`, after its first separator, and after an extra space. In editing
346
+ presentation, the first separator reaches the label column and each additional
347
+ space advances normally. The checkbox and separator participate in inline layout,
348
+ so native text ranges, clicks, and the painted caret agree.
349
+ The `lists/extra-separator-continuation-spaces` and
350
+ `lists/extra-separator-blank-line` fixtures protect `- test` followed by a blank
351
+ line and ` test`: the four prefix cells align and the blank-line caret sits
352
+ at the active label column.
353
+ Editing also treats `- [] test` as unchecked, preserving task layout through
354
+ `[x]` -> `[]` -> `[ ]` edits without inserting a space into the source.
355
+ Reading keeps `[]` as literal text. The normal separator requirement remains;
356
+ `- []text` and a bare `- []` at EOF are not tasks. The reduced
357
+ `task-lists/checkbox-value-0`, `checkbox-value-1`, and `checkbox-value-2`
358
+ fixtures cover all three values in reading and editing presentation.
359
+ The paired `task-lists/checkbox-line-end-empty` and `task-lists/checkbox-line-end-filled`
360
+ states extend this guarantee to a checkbox followed directly by a newline:
361
+ typing on the continuation must neither create the checkbox nor move the caret
362
+ column. Bare `* [ ]` without a separator retains standard non-task parsing.
363
+ `lists/nested-parent-filled` and `lists/nested-parent-empty` preserve the parent's
364
+ marker separator and its own visual line when its last label character is
365
+ removed. The nested item's row and indentation must not move. Parser tests cover
366
+ LF, CRLF, CR, source tiling, and incremental edits; browser tests assert the
367
+ caret and nested-item coordinates through deletion and retyping.
368
+ `task-lists/continuation-enter` covers a blank task continuation: editing Enter
369
+ inserts only `\n`. List auto-continuation still applies on the item's own marker
370
+ line, not every later line owned by that item.
371
+ `task-lists/checkbox-newline` keeps the line ending after `[ ]` in paragraph
372
+ flow instead of the absolutely positioned checkbox source.
373
+ The paired `lists/marker-separator-1` and `lists/marker-separator-2` states keep
374
+ the marker fixed while additional separator characters move the content right.
375
+ Extra spaces occupy half-em source cells. Unordered source symbols use the
376
+ body font and baseline in a one-em gutter cell, followed by a half-em separator.
377
+ Native reading bullets retain their original size, font, and nested list style;
378
+ we do not require unrelated glyphs to have identical pixel ink bounds across
379
+ fallback fonts. Geometry tests cover multiple font families and sizes.
380
+
381
+ `lists/separator-activation-inactive` and `lists/separator-activation-active`
382
+ show that extra source-only separator padding collapses outside the active
383
+ item. Nested logical gutters do not move. The explicit `all` and `none` markup
384
+ policies still force revelation or hiding.
385
+ `formatting/table-cell-outside`, `formatting/table-cell-first`, and
386
+ `formatting/table-cell-second` keep inline formatting markers out of the
387
+ inactive cells' layout. Activating another cell may resize columns; source
388
+ offsets remain distinct within each resulting layout.
389
+
390
+ `lists/blank-between-items` keeps list-level blank separators at their
391
+ surrounding container's margin, including typing and undo/redo. These separators
392
+ are distinct from continuation lines within a list-item paragraph.
393
+ `lists/first-blank-between-items` covers the first empty line immediately after
394
+ populated item text: its caret stays at the item's text indent, even when later
395
+ blank lines and another item follow. Moving to the next blank line moves to the
396
+ document margin. Browser tests compare each empty-line caret with the position
397
+ of ordinary text inserted there, across nested, ordered, and quoted lists,
398
+ empty items, and LF and CRLF endings. Parser source-ownership and incremental
399
+ reconciliation tests also cover CR endings.
400
+
401
+ `listMarkerAlignment/Source versus rendered bullet` places the production
402
+ source star and rendered bullet side by side. Reading bullets retain native
403
+ browser typography; source symbols use the body font and baseline, centered
404
+ in a one-em gutter slot. Browser regressions check the source column and
405
+ baseline across font families and sizes, and ensure reading bullets are not
406
+ replaced or resized. They deliberately do not require optical ink centers to
407
+ match across different glyphs and fallback fonts.
408
+
409
+ ### Screenshot CI
410
+
411
+ All fixtures use the package-local `fixtureUtils.ts` wrapper to disable CSS
412
+ animations and transitions within their own container, including the mode
413
+ toggle and cursor. Editor examples restore live motion when **Interactive mode**
414
+ is enabled. The custom cycling highlighter stays fixed by default; enable
415
+ **Cycle keyword colors** to exercise its live observable updates. Property
416
+ fixtures keep their complete diagnostic evidence in a **Replay log** disclosure,
417
+ collapsed by default so screenshots capture the editor rather than the JSON.
418
+
419
+ The `markdown-editor-screenshots` workflow captures every fixture discovered
420
+ by this package's Component Explorer configuration, including content,
421
+ diagnostic, property, and widget fixtures. There is no fixture-ID allowlist
422
+ or fixed fixture count; new fixtures are included automatically. The separate
423
+ screenshot job runs for every PR targeting main and every push to main, without
424
+ changed-path gates. Turbo decides which computations can be reused; commit
425
+ manifest publication always runs for authorized events, including cache hits.
426
+ This registers unchanged snapshots for new commit SHAs so unrelated main
427
+ changes do not leave holes in the baseline history. Pages reload
428
+ between fixtures to isolate their rendering. Capture uses `build:fixtures`
429
+ and `component-explorer.screenshots.json` to serve a static build on an
430
+ ephemeral local port, avoiding dev-server dependency optimization and module
431
+ reloads during a full run. Interactive exploration still uses the regular
432
+ `component-explorer.json` dev-server configuration. On the hosted Ubuntu runner,
433
+ CI removes the unused Android SDK before installing dependencies to leave
434
+ disk space for the full capture. The package-owned
435
+ `scripts/screenshots.mjs` and `screenshots` task store their
436
+ validated render JSON (without Git commit metadata or PNGs) in Turborepo's
437
+ cross-commit cache. The publish step attaches the *current* commit and the
438
+ `markdown-editor` service project ID, checks each content hash against
439
+ the screenshot service, and uploads only missing PNGs. If a cached hash is
440
+ missing remotely and its PNG is no longer local, it recaptures and verifies
441
+ the image before publishing; unchanged hashes already present remotely need
442
+ no browser run on a cache hit.
443
+
444
+ CI restores only the published-cache namespace and saves it after successful
445
+ image/manifest upload and validation. Fork and Dependabot runs do not populate
446
+ this cache. Thus a reusable CI snapshot's images have already been published;
447
+ PNGs remain in the service rather than in Turbo. The existing missing-image
448
+ recovery also supports local caches and older snapshots.
449
+
450
+ Before consulting the screenshot cache, CI builds the renderer and its
451
+ dependencies with `pnpm --filter @vscode/component-explorer-cli... run build`.
452
+ This deliberately bypasses Turbo's dependency-build cache: package builds can
453
+ also generate external dependency outputs (such as LinkRPC), which are not
454
+ restored by a cache entry containing only that package's `dist` directory.
455
+ Screenshot render results remain cached across commits.
456
+ Screenshot-script tests and fixture typechecking are explicit Turbo tasks.
457
+ Rendering depends on successful fixture typechecking, including on cache hits;
458
+ unchanged successful checks need not execute again. Commit metadata, service
459
+ publication, and PR reporting remain outside the cached tasks.
460
+
461
+ Image lookups run in batches of at most eight, use a 10-second timeout per attempt, and retry transient network
462
+ errors and HTTP 429/500/502/503/504 responses up to three total attempts, with
463
+ one- and two-second backoffs logged to CI. Only HTTP 404 means an image is
464
+ missing; persistent service errors fail preparation rather than being hidden.
465
+ The workflow archives the per-commit manifest and writes an advisory
466
+ base-commit comparison with before/after screenshots to the job summary.
467
+ Non-fork PRs also get a single updated comparison comment. Large comments
468
+ stop at a complete fixture boundary below GitHub's size limit; the complete
469
+ comparison remains in the job summary and `markdown-editor-screenshot-report`
470
+ artifact. Comparisons can
471
+ read the legacy `markdown-editor-pilot` baseline until main has published
472
+ under the new project ID; new uploads always use `markdown-editor`.
473
+ Diagnostic fixture errors remain in the published manifest and are listed
474
+ explicitly in the comparison report, including fixtures that could not produce
475
+ an image. Every fixture must pass diagnostics for required CI to be green,
476
+ including when its result is restored from the screenshot cache. The diagnostic
477
+ check runs after artifacts, uploads, reports, and PR comments so failures retain
478
+ their evidence. Run `node scripts/screenshots.mjs check` locally to check the
479
+ cached manifest, or pass a manifest path to check a specific capture.
480
+ Visual screenshot changes remain advisory, not merge gates.
481
+ Empty, duplicate, or malformed manifests, infrastructure failures, and
482
+ invalid image hashes still fail CI.
483
+
484
+ The service must support its existing `/images/<sha256>`,
485
+ `/commits/<owner>/<repo>/<sha>`, and authenticated `/upload` endpoints, with
486
+ project snapshots enabled. The upload step sends the manifest and
487
+ missing PNGs as a ZIP directly; no service-side GitHub token is needed to
488
+ download Actions artifacts. Main-branch pushes and non-fork PRs authenticate using GitHub
489
+ Actions OIDC (the same mechanism used by VS Code screenshot CI), not a new
490
+ repository secret. The service must authorize this repository's main pushes
491
+ and non-fork PR tokens for its OIDC audience. Fork and Dependabot PRs skip
492
+ OIDC upload and commenting; their job summary links to the workflow artifacts
493
+ instead of embedding unpublished images. Upload or unexpected baseline-service
494
+ errors fail CI explicitly, while artifacts are preserved for inspection.
495
+ The reusable `markdown-editor-screenshots` workflow handles rendering,
496
+ archiving, upload, and reporting for both callers. Both `required` and the
497
+ main-push-only `markdown-editor-screenshots-publish` caller explicitly grant
498
+ `contents: read`, `id-token: write`, and `pull-requests: write`; reusable
499
+ workflows cannot elevate their caller's permissions.
500
+ The workflow's
501
+ public service URL and runner/font configuration must be updated together
502
+ when changing service or rendering environment; renderer source, fixture
503
+ inputs, dependency lockfile, and the runner image version participate in
504
+ the Turbo cache key. Branch protection still requires the repository
505
+ administrator to mark the umbrella `Required / required` check as required.
506
+
507
+ Screenshot orchestration, contract tests (`pnpm run test:screenshots`), and
508
+ the Turbo task configuration live in this package. Component Explorer provides
509
+ the reusable renderer and screenshot service, with no Markdown-specific scripts.
510
+ The `markdown-editor-screenshots` artifact contains the upload manifest and new
511
+ PNGs; `markdown-editor-screenshot-render` preserves render diagnostics.
512
+
513
+ Start with the [current implementation specification](./docs/specification.md).
514
+ It explains the architecture, runtime data flow, public integration surface,
515
+ extension points, the VS Code custom text editor adapter, tests, and current
516
+ limitations.
517
+
518
+ Other package documents:
519
+
520
+ - [Original design](./docs/design.md) - historical design intent.
521
+ - [Original implementation plan](./docs/plan.md) - historical roadmap; its
522
+ checkboxes do not describe current completion.
523
+ - [Engineering backlog](./docs/todo.md) - known issues and future work.
524
+
525
+ From this package directory:
526
+
527
+ ```sh
528
+ pnpm test
529
+ pnpm test:e2e
530
+ pnpm build
531
+ pnpm build:explorer
532
+ ```
533
+
534
+ Playwright reuses test servers from the same worktree using a deterministic
535
+ worktree-specific port pair. Set `VSCODE_MARKDOWN_EDITOR_E2E_BASE_PORT` to the
536
+ first port of a different adjacent pair if the generated ports conflict with
537
+ another local service.
538
+
539
+ From the `vscode-packages` workspace root, run `tilt up` to supervise the editor
540
+ test page in Tilt's local web UI at http://localhost:10350. Tilt checks the
541
+ workspace installation with `pnpm install --frozen-lockfile` first; the `editor`
542
+ resource then serves the test page at its worktree-specific URL (shown in the
543
+ Tilt UI). Enable the optional `fixtures` resource in the UI to build and serve
544
+ the Component Explorer fixtures on the adjacent port. The servers run locally;
545
+ Docker and Kubernetes are not needed. Disable either server in the UI to stop
546
+ it, or run `tilt down` to stop Tilt's resources. To start only the fixtures
547
+ from the command line, use `tilt up fixtures`.
548
+
549
+ Install [Tilt](https://docs.tilt.dev/install.html) and use a Node installation
550
+ that supports TypeScript type stripping (Node 22.6+). Corepack runs the pnpm
551
+ version pinned in the workspace's `package.json`. The same
552
+ `VSCODE_MARKDOWN_EDITOR_E2E_BASE_PORT` override applies to both Tilt servers.
553
+
554
+ The multi-repository workspace also has a `Tiltfile` beside
555
+ `markdown-editor.code-workspace`. Run `tilt up` from that directory to see the
556
+ package resources and optional VS Code resources in one dashboard. From either
557
+ dashboard, enable `markdown-explorer` for the interactive Component Explorer
558
+ (port 5339), `explorer-demo` for its demo app (port 5174),
559
+ `markdown-package-watch`, or `team-tools-watch`. The `fixtures` resource above
560
+ is a built preview, not the interactive Component Explorer CLI server. Enabling
561
+ `markdown-explorer` requires stopping any separately launched Component
562
+ Explorer daemon for this same project first; Tilt will not terminate it.
563
+
564
+ In the multi-repository dashboard, `vscode-markdown-webview-watch` and
565
+ `vscode-client-watch` run watchers from the VS Code checkout, while
566
+ `vscode-explorer` serves its separate Component Explorer (port 5337).
567
+ `vscode-extension-host` builds Team Tools and launches Code - OSS with an
568
+ isolated profile, no built-in or installed extensions, and only the Team Tools
569
+ development extension. Disabling the resource closes that window, not other
570
+ VS Code instances. The VS Code checkout needs its own dependencies installed
571
+ before enabling its watchers or Component Explorer.
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Canonical editor command catalog. Standalone keyboard handling and host
3
+ * integrations derive their command registration and default keybindings from
4
+ * this list.
5
+ */
6
+ export declare const commands: readonly EditorCommandDefinition[];
7
+
8
+ export declare type CursorKeyboardAction = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'visualLineStart' | 'visualLineEnd' | 'logicalLineStart' | 'logicalLineEnd' | 'documentStart' | 'documentEnd';
9
+
10
+ export declare type EditKeyboardAction = 'deleteLeft' | 'deleteRight' | 'deleteWordLeft' | 'deleteWordRight' | 'deleteLineLeft' | 'deleteLineRight' | 'copyLinesUp' | 'copyLinesDown' | 'moveLinesUp' | 'moveLinesDown' | 'deleteLines' | 'joinLines';
11
+
12
+ export declare interface EditorCommandDefinition {
13
+ readonly id: `markdown.editor.${string}`;
14
+ readonly title: string;
15
+ readonly action: EditorKeyboardAction;
16
+ readonly keybindings: readonly EditorCommandKeybinding[];
17
+ /**
18
+ * Local commands must execute synchronously in the webview instead of being
19
+ * forwarded through the VS Code keybinding service.
20
+ */
21
+ readonly routing?: 'host' | 'local';
22
+ }
23
+
24
+ export declare interface EditorCommandKeybinding {
25
+ readonly key: string;
26
+ readonly modifiers?: KeyboardModifiers;
27
+ readonly platforms?: readonly KeyboardPlatform[];
28
+ }
29
+
30
+ export declare type EditorKeyboardAction = {
31
+ readonly kind: 'cursor';
32
+ readonly command: CursorKeyboardAction;
33
+ readonly extend: boolean;
34
+ } | {
35
+ readonly kind: 'edit';
36
+ readonly command: EditKeyboardAction;
37
+ } | {
38
+ readonly kind: 'history';
39
+ readonly command: HistoryKeyboardAction;
40
+ } | {
41
+ readonly kind: 'tab';
42
+ readonly command: TabKeyboardAction;
43
+ } | {
44
+ readonly kind: 'toggleTabFocus';
45
+ } | {
46
+ readonly kind: 'toggleReadonly';
47
+ } | {
48
+ readonly kind: 'selectAll';
49
+ } | {
50
+ readonly kind: 'enter';
51
+ readonly command: 'smartEnter' | 'insertParagraph' | 'insertHardLineBreak';
52
+ };
53
+
54
+ export declare type HistoryKeyboardAction = 'undo' | 'redo';
55
+
56
+ export declare interface KeyboardModifiers {
57
+ readonly shift?: boolean;
58
+ readonly alt?: boolean;
59
+ readonly ctrl?: boolean;
60
+ readonly meta?: boolean;
61
+ }
62
+
63
+ export declare type KeyboardPlatform = 'macos' | 'windows' | 'linux';
64
+
65
+ export declare type TabKeyboardAction = 'insert' | 'outdent';
66
+
67
+ export { }