| 1533 | // regex (unanchored, scans the whole body) still matches and the badge renders |
| 1534 | // as the first visible line. The code suggestion block is appended if present. |
| 1535 | function formatComment(comment, id) { |
| 1536 | let body = id ? `<!-- ${id} -->\n` : ""; |
| 1537 | const badge = buildBadgeImage(comment); |
| 1538 | if (badge) body += `${badge}\n`; |
| 1539 | body += comment.content || ""; |
| 1540 | if (comment.suggestion_code && comment.existing_code) { |
| 1541 | body += "\n\n**Suggestion:**\n"; |
| 1542 | body += fencedBlock(comment.suggestion_code, "suggestion"); |
| 1543 | } |
| 1544 | return body; |
| 1545 | } |
| 1546 | |
| 1547 | function formatCommentMarkdown(comment, error) { |
| 1548 | let md = ""; |