// Import import * as badges from './badges.js' export { badges } /** * Render a specified badge with the appropriate wrapping (div if block badge, span if inline badge) * @method renderBadge * @param badgeName The name of the badge to render * @param config The configuration to pass to the badge render method * @return The rendered badge */ export function renderBadge(badgeName: string, config = {}): string { if (badgeName === '---') { return '
' } // Fetch // @ts-ignore const badgeMethod = badges[badgeName] as any // Send the badge value and options to the render method const badgeResult = badgeMethod(config).trim() if (!badgeResult) return '' // We have a result, so let's wrap it const elementName = badgeMethod.badgeInline === false ? 'div' : 'span' const wrappedResult = `<${elementName} class="badge-${badgeName}">${badgeResult}` // Done return wrappedResult } export interface RenderOptions { /* Render only the badges that are part of this category */ filterCategory?: false | string /* Render badges that include `