Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: escape markdown characters in user provided strings #122

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions commit-to-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ function toStringMarkdown (data) {
s += `* \\[[\`${data.sha.substr(0, 10)}\`](${data.shaUrl})] - `
s += (data.semver || []).length ? `**(${data.semver.join(', ').toUpperCase()})** ` : ''
s += data.revert ? '***Revert*** "' : ''
s += data.group ? `**${data.group}**: ` : ''
s += data.group ? `**${cleanMarkdown(data.group)}**: ` : ''
s += cleanMarkdown(data.summary)
s += data.revert ? '" ' : ' '
s += data.author ? `(${data.author}) ` : ''
s += data.author ? `(${cleanMarkdown(data.author)}) ` : ''
s += data.pr ? `[${data.pr}](${data.prUrl})` : ''
s = s.trim()

Expand Down
8 changes: 8 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,11 @@ test('test backtick strings in commit messages', (t) => {
`)
t.end()
})

test('test markdown punctuation chars in commit message and author name', (t) => {
t.equal(
exec('--start-ref=eadf9e3d32 --end-ref=eadf9e3d32 --filter-release --commit-url=https://yeehaw.com/{ref}/{ref}/{ghUser}/{ghRepo}/'),
`* \\[[\`eadf9e3d32\`](https://yeehaw.com/eadf9e3d32/eadf9e3d32/nodejs/changelog-maker/)] - **group\\_with\\_underscore**: test commit message (Author\\_name\\_with\\_underscore)
`)
t.end()
})