feat: allow overriding getMarkdownCode

allow overriding `DefaultBadgeBuilder.getMarkdownCode`

Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
Patrick Jungermann
2022-03-26 01:11:48 +01:00
parent 9c01fe543d
commit 4c93fd36ee
3 changed files with 8 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-badges-backend': patch
---
allow overriding `DefaultBadgeBuilder.getMarkdownCode`
+2
View File
@@ -122,6 +122,8 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
createBadgeSvg(options: BadgeOptions): Promise<string>;
// (undocumented)
getBadges(): Promise<BadgeInfo[]>;
// (undocumented)
protected getMarkdownCode(params: Badge, badgeUrl: string): string;
}
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -70,7 +70,7 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
}
}
private getMarkdownCode(params: Badge, badgeUrl: string): string {
protected getMarkdownCode(params: Badge, badgeUrl: string): string {
let altText = `${params.label}: ${params.message}`;
if (params.description && params.description !== params.label) {
altText = `${params.description}, ${altText}`;