MCPcopy Create free account
hub / github.com/codeaashu/claude-code / classifyLine

Function classifyLine

web/lib/workers/markdown.worker.ts:37–51  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

35}
36
37function classifyLine(line: string): TokenLine {
38 if (line.trim() === "") return { type: "blank", content: "" };
39 if (/^#{1,6}\s/.test(line)) {
40 const level = (line.match(/^(#{1,6})\s/)![1].length) as number;
41 return { type: "heading", content: line.replace(/^#{1,6}\s+/, ""), level };
42 }
43 if (/^```/.test(line)) {
44 const lang = line.slice(3).trim() || undefined;
45 return { type: "code-fence", content: line, lang };
46 }
47 if (/^[-*+]\s|^\d+\.\s/.test(line)) return { type: "list-item", content: line };
48 if (/^>\s/.test(line)) return { type: "blockquote", content: line.slice(2) };
49 if (/^[-*_]{3,}$/.test(line.trim())) return { type: "hr", content: line };
50 return { type: "text", content: line };
51}
52
53function process(msg: InMessage): OutMessage {
54 const lines = msg.markdown.split("\n");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected