export function getReadingTime(content: string) {
    const normalized = content
        .replace(/```[\s\S]*?```/g, " ")
        .replace(/`[^`]*`/g, " ")
        .replace(/!\[[^\]]*\]\([^)]+\)/g, " ")
        .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1")
        .replace(/<[^>]+>/g, " ")
        .replace(/[#>*_~-]/g, " ")
        .replace(/\s+/g, " ")
        .trim();

    const wordCount = normalized ? normalized.split(" ").length : 0;
    const minutes = Math.max(1, Math.ceil(wordCount / 200));

    return {
        minutes,
        text: `${minutes} min read`,
    };
}
