/ src / components / shared / markdown-utils.ts
markdown-utils.ts
1  /** Detect if text contains structured markdown (code blocks, headings, lists, tables) */
2  export function isStructuredMarkdown(text: string): boolean {
3    if (!text) return false
4    return /```/.test(text)
5      || /^#{1,4}\s/m.test(text)
6      || /^[-*]\s/m.test(text)
7      || /^\d+\.\s/m.test(text)
8      || /\|.*\|.*\|/m.test(text)
9  }