(line: string)
| 35 | } |
| 36 | |
| 37 | function 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 | |
| 53 | function process(msg: InMessage): OutMessage { |
| 54 | const lines = msg.markdown.split("\n"); |
nothing calls this directly
no outgoing calls
no test coverage detected