@vscode/markdown-editor 0.0.2-13 → 0.0.2-130

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