Skip to content

Commit

Permalink
Escape markdown table (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
leordev authored Feb 7, 2024
1 parent bf0bd1b commit 4e12d8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/docs-report/report-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ const getMessageLog = (
? `[#L${message.sourceFileLine}](${blobBaseUrl}/${relativePath}#L${message.sourceFileLine})`
: ''

return `| ${flag} \`${message.category}:${message.messageId}\`: ${message.text} ${link} |`
const escapedText = message.text
// escape pipes
.replaceAll('|', '\\|')
// remove line breaks
.replaceAll('\n', '')

return `| ${flag} \`${message.category}:${message.messageId}\`: ${escapedText} ${link} |`
}

const saveReportFile = (reportMarkdown: string): void => {
Expand Down

0 comments on commit 4e12d8f

Please sign in to comment.