storkit: merge 427_story_server_side_text_normalization_for_chat_message_line_breaks
This commit is contained in:
@@ -6,9 +6,13 @@
|
||||
/// This function converts common Markdown constructs so messages render
|
||||
/// nicely in Slack instead of showing raw Markdown syntax.
|
||||
pub fn markdown_to_slack(text: &str) -> String {
|
||||
use crate::chat::util::normalize_line_breaks;
|
||||
use regex::Regex;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
let normalized = normalize_line_breaks(text);
|
||||
let text = normalized.as_str();
|
||||
|
||||
// Regexes are compiled once and reused across calls.
|
||||
static RE_FENCED_BLOCK: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"(?ms)^```.*?\n(.*?)^```").unwrap());
|
||||
|
||||
Reference in New Issue
Block a user