@vscode/markdown-editor 0.0.2-54 → 0.0.2-56

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/dist/index.d.ts CHANGED
@@ -262,13 +262,20 @@ export declare interface BlockViewOptions {
262
262
  }
263
263
 
264
264
  export declare class CodeBlockAstNode extends BlockAstNodeBase {
265
+ /** First token of the fenced code block info string, used for syntax highlighting. */
265
266
  readonly language: string;
267
+ /** Complete fenced code block info string, including metadata after the language token. */
268
+ readonly infoString: string;
266
269
  readonly content: readonly (MarkerAstNode | GlueAstNode)[];
267
270
  readonly leadingTrivia?: GlueAstNode | undefined;
268
271
  readonly kind = "codeBlock";
269
272
  private _previous?;
270
273
  private _contentEdit?;
271
- constructor(language: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
274
+ constructor(
275
+ /** First token of the fenced code block info string, used for syntax highlighting. */
276
+ language: string,
277
+ /** Complete fenced code block info string, including metadata after the language token. */
278
+ infoString: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
272
279
  get children(): readonly AstNode[];
273
280
  get openFence(): MarkerAstNode | undefined;
274
281
  get closeFence(): MarkerAstNode | undefined;
@@ -581,6 +588,13 @@ export declare class CommentsView extends Disposable {
581
588
  private _applyHover;
582
589
  }
583
590
 
591
+ /** The lossless source slices of a complete block HTML comment. */
592
+ declare interface CompleteHtmlCommentSource extends HtmlCommentSourceBase {
593
+ readonly kind: 'complete';
594
+ readonly closing: '-->';
595
+ readonly trailingWhitespace: string;
596
+ }
597
+
584
598
  /**
585
599
  * A {@link MonacoSyntaxHighlighter} preloaded with a handful of common Monarch
586
600
  * grammars (plus the usual short aliases). Unknown languages fall back to an
@@ -1798,6 +1812,15 @@ export declare function hiddenCursorRanges(doc: DocumentAstNode, markerVisibleBl
1798
1812
 
1799
1813
  export declare type HistoryKeyboardAction = 'undo' | 'redo';
1800
1814
 
1815
+ /** A block HTML comment, discriminated by whether its closing delimiter is present. */
1816
+ declare type HtmlCommentSource = OpenHtmlCommentSource | CompleteHtmlCommentSource;
1817
+
1818
+ declare interface HtmlCommentSourceBase {
1819
+ readonly leadingWhitespace: string;
1820
+ readonly opening: '<!--';
1821
+ readonly body: string;
1822
+ }
1823
+
1801
1824
  /**
1802
1825
  * The editor operations a clipboard strategy drives. The strategy never
1803
1826
  * touches the model or the DOM directly — it asks through this seam, so the
@@ -1894,10 +1917,10 @@ declare interface IEmbeddedCodeEditor {
1894
1917
  /** Creates an {@link IEmbeddedCodeEditor} for a fenced block, or opts out. */
1895
1918
  declare interface IEmbeddedCodeEditorFactory {
1896
1919
  /**
1897
- * Return an editor for a fenced block of `language`, or `undefined` to fall
1920
+ * Return an editor for a fenced block, or `undefined` to fall
1898
1921
  * back to the default (highlighting / {@link BlockViewOptions.renderCustomCodeBlock}).
1899
1922
  */
1900
- create(language: string, initialContent: string): IEmbeddedCodeEditor | undefined;
1923
+ create(language: string, infoString: string, initialContent: string): IEmbeddedCodeEditor | undefined;
1901
1924
  }
1902
1925
 
1903
1926
  /**
@@ -2017,6 +2040,9 @@ export declare const insertParagraph: EditCommand;
2017
2040
  * - block quote — continue the quote (`\n> `); an empty quote line exits it.
2018
2041
  * - list — continue the list with the next marker (incrementing ordered
2019
2042
  * numbers, re-emitting task checkboxes); an empty item exits the list.
2043
+ * - complete HTML comment — at the comment's end, leave it by arming a
2044
+ * transient paragraph; inside it (or while the comment is open), insert a
2045
+ * normal source line break.
2020
2046
  * A non-collapsed selection, or any other block, falls back to a plain soft line
2021
2047
  * break, preserving today's behaviour.
2022
2048
  */
@@ -2485,6 +2511,11 @@ export declare class OffsetRange {
2485
2511
  toString(): string;
2486
2512
  }
2487
2513
 
2514
+ /** The lossless source slices of a block HTML comment whose closer has not been typed. */
2515
+ declare interface OpenHtmlCommentSource extends HtmlCommentSourceBase {
2516
+ readonly kind: 'open';
2517
+ }
2518
+
2488
2519
  /** Outdent the current line, or every line touched by the selection. */
2489
2520
  export declare function outdent(config?: IndentationConfig): EditCommand;
2490
2521
 
@@ -2987,21 +3018,29 @@ declare class UnhandledBlockAstNode extends BlockAstNodeBase {
2987
3018
  constructor(tokenType: string, content: readonly (MarkerAstNode | GlueAstNode)[], leadingTrivia?: GlueAstNode | undefined);
2988
3019
  get children(): readonly AstNode[];
2989
3020
  get code(): MarkerAstNode | undefined;
3021
+ /**
3022
+ * Lossless slices when this raw HTML block starts one comment after optional
3023
+ * whitespace. An open comment consumes the remaining source as its body. A
3024
+ * complete comment permits only trailing whitespace after its closer.
3025
+ */
3026
+ get htmlComment(): HtmlCommentSource | undefined;
2990
3027
  mapChildren(m: ReadonlyMap<AstNode, AstNode>): AstNode;
2991
3028
  withLeadingTrivia(trivia: GlueAstNode | undefined): UnhandledBlockAstNode;
2992
3029
  protected _localEquals(o: this): boolean;
2993
3030
  }
2994
3031
 
2995
3032
  /**
2996
- * View-data for an {@link UnhandledBlockAstNode}. It has no active/inactive
2997
- * split — the raw source *is* both the source and the rendered form so it
2998
- * carries no `showMarkup` flag; the renderer always shows the verbatim text.
3033
+ * View-data for an {@link UnhandledBlockAstNode}. The source remains verbatim
3034
+ * in both states. Complete HTML comments use {@link showMarkup} to switch
3035
+ * between their quiet reading treatment and editable source presentation;
3036
+ * other unhandled blocks ignore the flag and keep their warning treatment.
2999
3037
  */
3000
3038
  declare class UnhandledBlockViewData {
3001
3039
  readonly ast: UnhandledBlockAstNode;
3040
+ readonly showMarkup: boolean;
3002
3041
  readonly content: readonly AnyViewData[];
3003
3042
  readonly kind = "unhandledBlock";
3004
- constructor(ast: UnhandledBlockAstNode, content: readonly AnyViewData[]);
3043
+ constructor(ast: UnhandledBlockAstNode, showMarkup: boolean, content: readonly AnyViewData[]);
3005
3044
  }
3006
3045
 
3007
3046
  /**