Telegram markdown support for structured json messages

This commit is contained in:
euzu
2025-10-22 11:09:43 +02:00
parent 86d8409391
commit 8245bc4c85
14 changed files with 160 additions and 48 deletions
+21
View File
@@ -106,6 +106,27 @@ pub fn mask_credentials(s: &str) -> String {
}
}
pub fn humanize_snake_case(s: &str) -> String {
let mut result = String::with_capacity(s.len());
let mut capitalize_next = true;
for c in s.chars() {
if c == '_' {
result.push(' ');
capitalize_next = true;
} else if capitalize_next {
for up in c.to_uppercase() {
result.push(up);
}
capitalize_next = false;
} else {
result.push(c);
}
}
result
}
#[cfg(test)]
mod test {
use std::collections::HashSet;