`text` as inline code, whatever backticks it holds.
(text: string)
| 289 | |
| 290 | /** `text` as inline code, whatever backticks it holds. */ |
| 291 | function inlineCode(text: string): string { |
| 292 | const longest = Math.max(0, ...[...text.matchAll(/`+/g)].map((m) => m[0].length)); |
| 293 | const fence = '`'.repeat(longest + 1); |
| 294 | const pad = text.startsWith('`') || text.endsWith('`') ? ' ' : ''; |
| 295 | return `${fence}${pad}${text}${pad}${fence}`; |
| 296 | } |
| 297 | |
| 298 | const MAX_SITE_TEXT = 160; |
| 299 |
no test coverage detected