telegram-markdown-v2 0.2.0

Transform regular Markdown into Telegram MarkdownV2 (parse_mode = MarkdownV2).
Documentation
//! 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 (`||…||`)
mod convert;
mod definitions;
mod errors;
mod handlers;
mod types;
mod utils;

pub use convert::{convert, convert_with_strategy};
pub use errors::{Error, Result};
pub use types::{Definition, TextType, UnsupportedTagsStrategy};