synpad 0.1.0

A full-featured Matrix chat client built with Dioxus
use comrak::{markdown_to_html, Options};

/// Convert markdown text to HTML.
pub fn markdown_to_html_string(input: &str) -> String {
    let mut options = Options::default();
    options.extension.strikethrough = true;
    options.extension.table = true;
    options.extension.autolink = true;
    options.extension.tasklist = true;

    markdown_to_html(input, &options)
}

/// Check if a string contains markdown formatting.
pub fn has_markdown(text: &str) -> bool {
    // Simple heuristic check for common markdown patterns
    text.contains("**")
        || text.contains("__")
        || text.contains("~~")
        || text.contains("```")
        || text.contains('`')
        || text.contains("- ")
        || text.contains("1. ")
        || text.contains("> ")
        || text.contains("# ")
        || text.contains('[')
}