1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Convert Markdown into Telegram **MarkdownV2**.
//!
//! Telegram's MarkdownV2 is a restricted dialect with its own escaping rules. This crate
//! takes a Markdown document and renders it into a string suitable to be sent with
//! Telegram's `parse_mode = MarkdownV2`.
//!
//! The main entry points are [`convert`] (default behavior) and [`convert_with_strategy`]
//! (custom handling for unsupported constructs).
//!
//! ## Basic usage
//!
//! ```rust
//! # fn main() -> telegram_markdown_v2::Result<()> {
//! use telegram_markdown_v2::convert;
//!
//! let out = convert("Hello world!")?;
//! assert_eq!(out, "Hello world\\!\n");
//! # Ok(())
//! # }
//! ```
//!
//! ## Unsupported constructs
//!
//! Telegram MarkdownV2 does not support some Markdown/HTML constructs (e.g. blockquotes,
//! tables, and raw HTML blocks). Use [`UnsupportedTagsStrategy`] to decide what to do
//! with such input:
//!
//! - [`UnsupportedTagsStrategy::Keep`]: keep the unsupported content as-is.
//! - [`UnsupportedTagsStrategy::Escape`]: escape the unsupported content as plain text.
//! - [`UnsupportedTagsStrategy::Remove`]: drop the unsupported content entirely.
//!
//! ```rust
//! # fn main() -> telegram_markdown_v2::Result<()> {
//! use telegram_markdown_v2::{convert_with_strategy, UnsupportedTagsStrategy};
//!
//! let out = convert_with_strategy("> test", UnsupportedTagsStrategy::Escape)?;
//! assert_eq!(out, "\\> test\n");
//! # Ok(())
//! # }
//! ```
//!
//! ## Telegram-specific extensions
//!
//! Outside inline/fenced code, the converter recognizes:
//!
//! - `<u>…</u>` as underline (`__…__`)
//! - `<span class="tg-spoiler">…</span>` as spoiler (`||…||`)
pub use ;
pub use ;
pub use ;