Skip to content

Commit 03d7b4e

Browse files
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]>
1 parent f54a10a commit 03d7b4e

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/footer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export async function generateFooter(previousTagName?: string): Promise<string>
7070
if (includeCompareLink() && previousTagName) {
7171
let link = `${ url }/compare/${ previousTagName }...${ tagName }`;
7272

73-
if (!useGitHubAutolink() || releaseNamePrefix()) link = `\`[${ previousTagName }...${ tagName }](${ url }/compare/${ previousTagName }...${ tagName })\``;
73+
if (!useGitHubAutolink() || releaseNamePrefix()) link = `[\`${ previousTagName }...${ tagName }\`](${ url }/compare/${ previousTagName }...${ tagName })`;
7474

7575
footer.push(`**Full Changelog**: ${ link }`);
7676
}

src/nodes/commit-hash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class CommitHashNode extends Node {
5959
if (shouldUseGithubAutolink) return sha;
6060

6161
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
62-
return `\`[${ sha.slice(0, 7) }](${ repo.url }/commit/${ sha })\``;
62+
return `[\`${ sha.slice(0, 7) }\`](${ repo.url }/commit/${ sha })`;
6363
}
6464

6565
}

tests/footer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ it("should generate the changelog footer with the full changelog link", async ()
138138

139139
const result = await generateFooter(info.previous.name);
140140

141-
expect(result).toEqual(`\n\n**Full Changelog**: \`[${ info.previous.name }...${ releaseNameInputValue }](${ url }/compare/${ info.previous.name }...${ releaseNameInputValue })\``);
141+
expect(result).toEqual(`\n\n**Full Changelog**: [\`${ info.previous.name }...${ releaseNameInputValue }\`](${ url }/compare/${ info.previous.name }...${ releaseNameInputValue })`);
142142

143143
expect(getInput).toHaveBeenCalledTimes(1);
144144

tests/nodes/commit-hash.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ it("should print the sha with the link (not using autolink)", () => {
8484
expect(commitHashNode.shouldUseGithubAutolink).toBe(false);
8585

8686
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
87-
expect(commitHashNode.print()).toBe(`\`[${ sha.slice(0, 7) }](${ context.serverUrl }/${ repo.owner }/${ repo.repo }/commit/${ sha })\``);
87+
expect(commitHashNode.print()).toBe(`[\`${ sha.slice(0, 7) }\`](${ context.serverUrl }/${ repo.owner }/${ repo.repo }/commit/${ sha })`);
8888
});

0 commit comments

Comments
 (0)