From b4afd6cca2cadb4ef8f7da6db0ab563b158a0367 Mon Sep 17 00:00:00 2001 From: Dmitry Dobrynin Date: Sat, 5 Apr 2025 23:01:32 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Wrap=20commit=20links=20in=20bac?= =?UTF-8?q?kticks=20for=20monospace=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gitmoji-changelog-markdown/src/index.js | 4 ++-- .../gitmoji-changelog-markdown/src/index.spec.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/gitmoji-changelog-markdown/src/index.js b/packages/gitmoji-changelog-markdown/src/index.js index 7db3bed..50ecaf8 100755 --- a/packages/gitmoji-changelog-markdown/src/index.js +++ b/packages/gitmoji-changelog-markdown/src/index.js @@ -140,7 +140,7 @@ function getShortHash(hash, repository) { if (isEmpty(repository) || !repository.url) return shortHash - return `[${shortHash}](${repository.url}/commit/${hash})` + return `[\`${shortHash}\`](${repository.url}/commit/${hash})` } const ISSUE_REGEXP = /#{1}(\d+)/gm @@ -153,7 +153,7 @@ function autolink(message, repository) { const matches = message.match(ISSUE_REGEXP) if (!matches) return message - return message.replace(ISSUE_REGEXP, `[#$1](${repository.bugsUrl}/$1)`) + return message.replace(ISSUE_REGEXP, `[\`#$1\`](${repository.bugsUrl}/$1)`) } module.exports = { diff --git a/packages/gitmoji-changelog-markdown/src/index.spec.js b/packages/gitmoji-changelog-markdown/src/index.spec.js index 6d9043d..2184ef3 100644 --- a/packages/gitmoji-changelog-markdown/src/index.spec.js +++ b/packages/gitmoji-changelog-markdown/src/index.spec.js @@ -82,7 +82,7 @@ describe('Markdown converter', () => { ### Changed -- ♻️ Upgrade brand new feature [[c40ee86](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] +- ♻️ Upgrade brand new feature [[`c40ee86`](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] @@ -90,7 +90,7 @@ describe('Markdown converter', () => { ### Added -- ✨ Upgrade brand new feature [[c40ee86](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f)] +- ✨ Upgrade brand new feature [[`c40ee86`](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f)] `) @@ -146,7 +146,7 @@ describe('Markdown converter', () => { ### Changed -- ♻️ Upgrade brand new feature [[c40ee86](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] (by John Doe) +- ♻️ Upgrade brand new feature [[`c40ee86`](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] (by John Doe) `) @@ -230,7 +230,7 @@ I am the last version ### Changed -- ♻️ Upgrade brand new feature [[c40ee86](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] +- ♻️ Upgrade brand new feature [[`c40ee86`](https://github.com/frinyvonnick/gitmoji-changelog/commit/c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c)] @@ -255,7 +255,7 @@ describe('getHashUrl', () => { const result = getShortHash('xxxxxxxxxxxxxxxxx', { url: 'https://github.com/frinyvonnick/gitmoji-changelog', }) - expect(result).toBe('[xxxxxxx](https://github.com/frinyvonnick/gitmoji-changelog/commit/xxxxxxxxxxxxxxxxx)') + expect(result).toBe('[`xxxxxxx`](https://github.com/frinyvonnick/gitmoji-changelog/commit/xxxxxxxxxxxxxxxxx)') }) }) @@ -279,14 +279,14 @@ describe('autolink', () => { const result = autolink(':bug: fix issue #123', { bugsUrl: 'https://github.com/frinyvonnick/gitmoji-changelog/issues', }) - expect(result).toBe(':bug: fix issue [#123](https://github.com/frinyvonnick/gitmoji-changelog/issues/123)') + expect(result).toBe(':bug: fix issue [`#123`](https://github.com/frinyvonnick/gitmoji-changelog/issues/123)') }) it('should autolink with markdown severals hashtag issues in message', () => { const result = autolink(':bug: fix issue #123 and #456', { bugsUrl: 'https://github.com/frinyvonnick/gitmoji-changelog/issues', }) - expect(result).toBe(':bug: fix issue [#123](https://github.com/frinyvonnick/gitmoji-changelog/issues/123) and [#456](https://github.com/frinyvonnick/gitmoji-changelog/issues/456)') + expect(result).toBe(':bug: fix issue [`#123`](https://github.com/frinyvonnick/gitmoji-changelog/issues/123) and [`#456`](https://github.com/frinyvonnick/gitmoji-changelog/issues/456)') }) })