(err, file, block)
| 124 | } |
| 125 | |
| 126 | function formatError(err, file, block) { |
| 127 | const msg = err?.message || String(err); |
| 128 | const match = msg.match(/Parse error on line (\d+)/i); |
| 129 | const relLine = match ? parseInt(match[1], 10) : 1; |
| 130 | const sourceLine = block.startLine + relLine; |
| 131 | const head = msg.split('\n').slice(0, 6).join('\n '); |
| 132 | return `${file}:${sourceLine}: mermaid parse error\n ${head}`; |
| 133 | } |
| 134 | |
| 135 | async function lintFile(file) { |
| 136 | const text = await readFile(file, 'utf8'); |