1
>
/*---------------------------------------------------------------------------------------------
htmlContent.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { illegalArgument } from './errors.js';
7
>
import { escapeIcons } from './iconLabels.js';
8
>
import { Schemas } from './network.js';
9
>
import { isEqual } from './resources.js';
10
>
import { escapeRegExpCharacters } from './strings.js';
11
>
import { URI, UriComponents } from './uri.js';
12
>
13
>
export interface MarkdownStringTrustedOptions {
14
>
readonly enabledCommands: readonly string[];
15
>
}
16
>
17
>
export interface IMarkdownString {
18
>
readonly value: string;
19
>
readonly isTrusted?: boolean | MarkdownStringTrustedOptions;
20
>
readonly supportThemeIcons?: boolean;
21
>
readonly supportHtml?: boolean;
22
>
/** @internal */
23
>
readonly supportAlertSyntax?: boolean;
24
>
readonly baseUri?: UriComponents;
25
>
uris?: { [href: string]: UriComponents };
26
>
}
27
>
28
>
export const enum MarkdownStringTextNewlineStyle {
29
>
Paragraph = 0,
30
>
Break = 1,
31
>
}
32
>
33
>
export class MarkdownString implements IMarkdownString {
34
>
35
>
public value: string;
36
>
public isTrusted?: boolean | MarkdownStringTrustedOptions;
37
>
public supportThemeIcons?: boolean;
38
>
public supportHtml?: boolean;
39
>
public supportAlertSyntax?: boolean;
40
>
public baseUri?: URI;
41
>
public uris?: { [href: string]: UriComponents } | undefined;
42
>
43
>
public static lift(dto: IMarkdownString): MarkdownString {
44
const markdownString = new MarkdownString(dto.value, dto);
45
markdownString.uris = dto.uris;