fix: backticks placement issue with use-github-autolink disabled (#221)

* fix: don't quote links in backticks with use-github-autolink disabled

Fixes an issue where some links would be quoted in backticks causing them to be rendered as code instead of markdown links.

* fix: add suggestion to src/footer.ts

Co-authored-by: Ardalan Amini <[email protected]>
Signed-off-by: darksaid98 <[email protected]>

* fix: add suggestion to src/nodes/commit-hash.ts

Co-authored-by: Ardalan Amini <[email protected]>
Signed-off-by: darksaid98 <[email protected]>

* fix: add suggestion to tests/footer.test.ts

Co-authored-by: Ardalan Amini <[email protected]>
Signed-off-by: darksaid98 <[email protected]>

* fix: add suggestion to tests/nodes/commit-hash.test.ts

Co-authored-by: Ardalan Amini <[email protected]>
Signed-off-by: darksaid98 <[email protected]>

---------

Signed-off-by: darksaid98 <[email protected]>
Co-authored-by: Ardalan Amini <[email protected]>
This commit is contained in:
darksaid98andArdalan Amini authored and GitHub committed 2025-06-28 22:19:37 +03:30
1 parent f54a10a737
commit 03d7b4ed20
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ export async function generateFooter(previousTagName?: string): Promise<string>
if (includeCompareLink() && previousTagName) { if (includeCompareLink() && previousTagName) {
let link = `${ url }/compare/${ previousTagName }...${ tagName }`; let link = `${ url }/compare/${ previousTagName }...${ tagName }`;
if (!useGitHubAutolink() || releaseNamePrefix()) link = `\`[${ previousTagName }...${ tagName }](${ url }/compare/${ previousTagName }...${ tagName })\``; if (!useGitHubAutolink() || releaseNamePrefix()) link = `[\`${ previousTagName }...${ tagName }\`](${ url }/compare/${ previousTagName }...${ tagName })`;
footer.push(`**Full Changelog**: ${ link }`); footer.push(`**Full Changelog**: ${ link }`);
} }
+1 -1
View File
@@ -59,7 +59,7 @@ export class CommitHashNode extends Node {
if (shouldUseGithubAutolink) return sha; if (shouldUseGithubAutolink) return sha;
// eslint-disable-next-line @typescript-eslint/no-magic-numbers // eslint-disable-next-line @typescript-eslint/no-magic-numbers
return `\`[${ sha.slice(0, 7) }](${ repo.url }/commit/${ sha })\``; return `[\`${ sha.slice(0, 7) }\`](${ repo.url }/commit/${ sha })`;
} }
} }
+1 -1
View File
@@ -138,7 +138,7 @@ it("should generate the changelog footer with the full changelog link", async ()
const result = await generateFooter(info.previous.name); const result = await generateFooter(info.previous.name);
expect(result).toEqual(`\n\n**Full Changelog**: \`[${ info.previous.name }...${ releaseNameInputValue }](${ url }/compare/${ info.previous.name }...${ releaseNameInputValue })\``); expect(result).toEqual(`\n\n**Full Changelog**: [\`${ info.previous.name }...${ releaseNameInputValue }\`](${ url }/compare/${ info.previous.name }...${ releaseNameInputValue })`);
expect(getInput).toHaveBeenCalledTimes(1); expect(getInput).toHaveBeenCalledTimes(1);
+1 -1
View File
@@ -84,5 +84,5 @@ it("should print the sha with the link (not using autolink)", () => {
expect(commitHashNode.shouldUseGithubAutolink).toBe(false); expect(commitHashNode.shouldUseGithubAutolink).toBe(false);
// eslint-disable-next-line @typescript-eslint/no-magic-numbers // eslint-disable-next-line @typescript-eslint/no-magic-numbers
expect(commitHashNode.print()).toBe(`\`[${ sha.slice(0, 7) }](${ context.serverUrl }/${ repo.owner }/${ repo.repo }/commit/${ sha })\``); expect(commitHashNode.print()).toBe(`[\`${ sha.slice(0, 7) }\`](${ context.serverUrl }/${ repo.owner }/${ repo.repo }/commit/${ sha })`);
}); });