MCPcopy
hub / github.com/codeaashu/claude-code / hasMarkdownSyntax

Function hasMarkdownSyntax

src/components/Markdown.tsx:32–36  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

30// One pass instead of 10× includes scans.
31const MD_SYNTAX_RE = /[#*`|[>\-_~]|\n\n|^\d+\. |\n\d+\. /;
32function hasMarkdownSyntax(s: string): boolean {
33 // Sample first 500 chars — if markdown exists it's usually early (headers,
34 // code fence, list). Long tool outputs are mostly plain text tails.
35 return MD_SYNTAX_RE.test(s.length > 500 ? s.slice(0, 500) : s);
36}
37function cachedLexer(content: string): Token[] {
38 // Fast path: plain text with no markdown syntax → single paragraph token.
39 // Skips marked.lexer's full GFM parse (~3ms on long content). Not cached —

Callers 1

cachedLexerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected