Skip to main content

telegram_markdown_v2/
types.rs

1/// Strategy used to handle Markdown nodes that cannot be represented in
2/// Telegram MarkdownV2.
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
4pub enum UnsupportedTagsStrategy {
5    /// Convert unsupported content into plain escaped text.
6    Escape,
7    /// Remove unsupported content from the output.
8    Remove,
9    /// Keep unsupported content unchanged.
10    #[default]
11    Keep,
12}
13
14/// Escaping context used by `escape_symbols`.
15#[derive(Debug, Clone, Copy, PartialEq, Eq)]
16pub enum TextType {
17    /// Regular message text context.
18    Text,
19    /// Inline or block code context.
20    Code,
21    /// URL/link destination context.
22    Link,
23}
24
25/// Reference-style link definition extracted from the Markdown AST.
26#[derive(Debug, Clone, PartialEq, Eq)]
27pub struct Definition {
28    /// Optional title associated with the definition.
29    pub title: Option<String>,
30    /// Destination URL used by the definition.
31    pub url: String,
32}