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
//! Renders the agent's Markdown into each chat platform's dialect and splits long replies.
//!
//! Agents answer in CommonMark. Each platform shows a different subset: Zalo has no links, code
//! blocks or tables; Google Chat and Slack use `*bold*` and `<url|text>`; and every platform caps
//! message length. [`MarkdownRenderer`] parses the answer once, writes it in the channel's
//! [`MarkdownDialect`](okbot_core::MarkdownDialect) and packs the result into messages that fit,
//! never splitting a code block without re-opening its fence.
//!
//! ```
//! use okbot_core::{ChannelCaps, LengthUnit, MarkdownDialect, Renderer};
//! use okbot_render::MarkdownRenderer;
//!
//! let caps = ChannelCaps {
//! max_message_len: 2000,
//! length_unit: LengthUnit::Utf16,
//! dialect: MarkdownDialect::ZaloMd,
//! ..ChannelCaps::basic()
//! };
//! let parts = MarkdownRenderer.render("See [docs](https://example.com) for **details**.", &caps);
//! assert_eq!(parts[0].text, "See docs (https://example.com) for **details**.");
//! ```
use ;
/// The default [`Renderer`]: CommonMark in, platform dialect out.
;