(content: string)
| 42 | const parseMarkdown = (content: string) => marked.lexer(content); |
| 43 | |
| 44 | const findMarkdownComments = (content: string): string[] => { |
| 45 | const tokens = parseMarkdown(content); |
| 46 | const comments: string[] = []; |
| 47 | |
| 48 | function walkTokens(tokenList: unknown[]) { |
| 49 | for (const token of tokenList) { |
| 50 | const t = token as { type: string; raw: string; tokens?: unknown[] }; |
| 51 | if (t.type === 'html' && t.raw.includes('<!--')) { |
| 52 | comments.push(t.raw.trim()); |
| 53 | } |
| 54 | if (t.tokens) { |
| 55 | walkTokens(t.tokens); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | walkTokens(tokens); |
| 61 | return comments; |
| 62 | }; |
| 63 | |
| 64 | const findCodeBlocks = ( |
| 65 | content: string, |
no test coverage detected