From 7c10a4ead4c0886a1cd61c2ce09723edc33cb8ea Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 16 Jan 2022 17:54:50 +0100 Subject: [PATCH 1/5] feat: escape markdown characters in user provided strings (#122) --- commit-to-output.js | 4 ++-- test.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/commit-to-output.js b/commit-to-output.js index 3e25376..9be9fd3 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -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() diff --git a/test.js b/test.js index 97a12c3..866910f 100644 --- a/test.js +++ b/test.js @@ -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() +}) From 0d51e7953023aa56d37a043287271d97885f6306 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 17 Jan 2022 13:05:19 +1100 Subject: [PATCH 2/5] Revert "feat: escape markdown characters in user provided strings (#122)" This reverts commit 7c10a4ead4c0886a1cd61c2ce09723edc33cb8ea. --- commit-to-output.js | 4 ++-- test.js | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/commit-to-output.js b/commit-to-output.js index 9be9fd3..3e25376 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -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 ? `**${cleanMarkdown(data.group)}**: ` : '' + s += data.group ? `**${data.group}**: ` : '' s += cleanMarkdown(data.summary) s += data.revert ? '" ' : ' ' - s += data.author ? `(${cleanMarkdown(data.author)}) ` : '' + s += data.author ? `(${data.author}) ` : '' s += data.pr ? `[${data.pr}](${data.prUrl})` : '' s = s.trim() diff --git a/test.js b/test.js index 866910f..97a12c3 100644 --- a/test.js +++ b/test.js @@ -115,11 +115,3 @@ 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() -}) From f12fe589c410e3922507f2bfe3b7c292ebf5bb54 Mon Sep 17 00:00:00 2001 From: Author_name_with_underscore Date: Sun, 16 Jan 2022 18:01:07 +0100 Subject: [PATCH 3/5] group_with_underscore: test commit message Empty commit to test escaping of markdown special characters in commit group and author name. From aa0234f07cc7f9cfeb4c8a240e251943905a1518 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sun, 16 Jan 2022 17:54:50 +0100 Subject: [PATCH 4/5] feat: escape markdown characters in user provided strings (#122) --- commit-to-output.js | 4 ++-- test.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/commit-to-output.js b/commit-to-output.js index 3e25376..9be9fd3 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -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() diff --git a/test.js b/test.js index 97a12c3..0aa1e18 100644 --- a/test.js +++ b/test.js @@ -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=f12fe589c4 --end-ref=f12fe589c4 --filter-release --commit-url=https://yeehaw.com/{ref}/{ref}/{ghUser}/{ghRepo}/'), + `* \\[[\`f12fe589c4\`](https://yeehaw.com/f12fe589c4/f12fe589c4/nodejs/changelog-maker/)] - **group\\_with\\_underscore**: test commit message (Author\\_name\\_with\\_underscore) +`) + t.end() +}) From c37c15994cfac54f3c9534c06ec7690ca71ec94e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 17 Jan 2022 04:59:17 +0000 Subject: [PATCH 5/5] chore(release): 2.8.0 [skip ci] ## [2.8.0](https://github.com/nodejs/changelog-maker/compare/v2.7.4...v2.8.0) (2022-01-17) ### Features * escape markdown characters in user provided strings ([#122](https://github.com/nodejs/changelog-maker/issues/122)) ([aa0234f](https://github.com/nodejs/changelog-maker/commit/aa0234f07cc7f9cfeb4c8a240e251943905a1518)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2e6a7..c355d0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.8.0](https://github.com/nodejs/changelog-maker/compare/v2.7.4...v2.8.0) (2022-01-17) + + +### Features + +* escape markdown characters in user provided strings ([#122](https://github.com/nodejs/changelog-maker/issues/122)) ([aa0234f](https://github.com/nodejs/changelog-maker/commit/aa0234f07cc7f9cfeb4c8a240e251943905a1518)) + ### [2.7.4](https://github.com/nodejs/changelog-maker/compare/v2.7.3...v2.7.4) (2021-11-23) diff --git a/package.json b/package.json index 27bf38a..27c1fc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "changelog-maker", - "version": "2.7.4", + "version": "2.8.0", "description": "A git log to CHANGELOG.md tool", "main": "changelog-maker.js", "bin": {