( audit: Pick<AuditReport, 'docsUrl' | 'description'>, )
| 71 | |
| 72 | // @TODO extract `Pick<AuditReport, 'docsUrl' | 'description'>` to a reusable schema and type |
| 73 | export function metaDescription( |
| 74 | audit: Pick<AuditReport, 'docsUrl' | 'description'>, |
| 75 | ): InlineText { |
| 76 | const docsUrl = audit.docsUrl; |
| 77 | const description = audit.description?.trim(); |
| 78 | if (docsUrl) { |
| 79 | const docsLink = md.link(docsUrl, '📖 Docs'); |
| 80 | if (!description) { |
| 81 | return docsLink; |
| 82 | } |
| 83 | const formattedDescription = wrapTags(description); |
| 84 | const parsedDescription = formattedDescription.endsWith('```') |
| 85 | ? `${formattedDescription}\n\n` |
| 86 | : `${formattedDescription} `; |
| 87 | return md`${parsedDescription}${docsLink}`; |
| 88 | } |
| 89 | if (description && description.trim().length > 0) { |
| 90 | return wrapTags(description); |
| 91 | } |
| 92 | return ''; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Link to local source for IDE |
no test coverage detected