Common/LanguageFeature/DTO/IMarkdownStringDTO.rs
1//! # IMarkdownStringDTO
2//!
3//! Defines the Data Transfer Object for a markdown string that supports
4//! trusted content and theming.
5
6use std::collections::HashMap;
7
8use serde::{Deserialize, Serialize};
9use serde_json::Value;
10
11/// A serializable struct that represents a string containing markdown. It can
12/// optionally be marked as "trusted" to allow for command links and other
13/// active content. This is analogous to `vscode.MarkdownString`.
14#[derive(Serialize, Deserialize, Debug, Clone)]
15#[serde(rename_all = "PascalCase")]
16pub struct IMarkdownStringDTO {
17 /// The markdown string content.
18 pub Value:String,
19
20 /// Whether this markdown string is trusted. Trusted strings can execute
21 /// commands, for example.
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub IsTrusted:Option<bool>,
24
25 /// A flag to indicate that this markdown string might contain icons that
26 /// need to be rendered using a theme-aware icon font.
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub SupportThemeIcons:Option<bool>,
29
30 /// A flag to indicate that this markdown string might contain HTML tags
31 /// that need to be rendered.
32 #[serde(skip_serializing_if = "Option::is_none")]
33 pub SupportHTML:Option<bool>,
34
35 /// An optional base URI to resolve relative paths against, especially for
36 /// images. Serialized `UriComponents`.
37 #[serde(skip_serializing_if = "Option::is_none")]
38 pub BaseURI:Option<Value>,
39
40 /// A map of URIs that are allowed to be accessed, for sanitization
41 /// purposes.
42 #[serde(skip_serializing_if = "Option::is_none")]
43 pub URIs:Option<HashMap<String, Value>>,
44}