feat: allow overriding getMarkdownCode
allow overriding `DefaultBadgeBuilder.getMarkdownCode` Signed-off-by: Patrick Jungermann <Patrick.Jungermann@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-badges-backend': patch
|
||||
---
|
||||
|
||||
allow overriding `DefaultBadgeBuilder.getMarkdownCode`
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user