@vscode/markdown-editor 0.0.2-127 → 0.0.2-129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,6 +20,54 @@ failed with `EPERM` on the Azure release agent. Keep the exact pin until the new
20
20
  download route is approved and verified on that agent. This affects test tooling,
21
21
  not the published editor's runtime dependencies or Component Explorer's renderer.
22
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
+
23
71
  ## Browser tests
24
72
 
25
73
  `pnpm test:e2e` builds the fixture dependencies and runs the Playwright interaction
@@ -99,6 +147,18 @@ See [Editing property tests](docs/editing-properties.md) for the interactive
99
147
  assertion fixtures, CI contracts, deterministic editing corpus, and the
100
148
  red/green/visual evidence required for layout fixes.
101
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
+
102
162
  ### Automatic links
103
163
 
104
164
  Bare HTTP(S) URLs, `www.` addresses, and email addresses are detected using GFM
package/dist/index.d.ts CHANGED
@@ -2009,6 +2009,8 @@ declare interface IEmbeddedCodeEditor {
2009
2009
  setContent(content: string): void;
2010
2010
  /** Update whether the embedded editor may change its content. */
2011
2011
  setReadOnly?(readOnly: boolean): void;
2012
+ /** Mount host actions alongside the embedded editor's own presentation controls. */
2013
+ setActions?(actions: HTMLElement): void;
2012
2014
  /**
2013
2015
  * Optional synchronous height (px) to reserve for `content` *before* the
2014
2016
  * editor has laid out. Return `undefined` to let the editor size itself
@@ -2298,8 +2300,9 @@ export declare class LengthReplacement {
2298
2300
  export declare class LinkAstNode extends AstNode {
2299
2301
  readonly url: string;
2300
2302
  readonly content: readonly InlineContentAstNode[];
2303
+ readonly title?: string | undefined;
2301
2304
  readonly kind = "link";
2302
- constructor(url: string, content: readonly InlineContentAstNode[]);
2305
+ constructor(url: string, content: readonly InlineContentAstNode[], title?: string | undefined);
2303
2306
  get children(): readonly AstNode[];
2304
2307
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
2305
2308
  protected _localEquals(o: this): boolean;
@@ -2982,8 +2985,9 @@ declare interface ReplacedItem {
2982
2985
  }
2983
2986
 
2984
2987
  export declare class RichLink {
2988
+ private readonly _displayHints?;
2985
2989
  static create(options: RichLinkOptions): RichLink;
2986
- static mount(element: HTMLElement, authoredLabel: HTMLSpanElement): RichLink;
2990
+ static mount(element: HTMLElement, authoredLabel: HTMLSpanElement, displayHints?: RichLinkDisplayHints): RichLink;
2987
2991
  static clear(element: HTMLElement): void;
2988
2992
  readonly element: HTMLElement;
2989
2993
  readonly authoredLabel: HTMLSpanElement;
@@ -3001,10 +3005,16 @@ export declare class RichLink {
3001
3005
  private _setDefaultOrder;
3002
3006
  }
3003
3007
 
3008
+ declare interface RichLinkDisplayHints {
3009
+ readonly iconOnly?: boolean;
3010
+ readonly maxWidthChars?: number;
3011
+ }
3012
+
3004
3013
  export declare interface RichLinkOptions {
3005
3014
  readonly href: string;
3006
3015
  readonly authoredLabel: string;
3007
3016
  readonly presentation?: LinkPresentation;
3017
+ readonly displayHints?: RichLinkDisplayHints;
3008
3018
  }
3009
3019
 
3010
3020
  export declare const selectAll: SelectionCommand;