`text` as inline code, whatever backticks it holds.
(text: string)
| 170 | |
| 171 | /** `text` as inline code, whatever backticks it holds. */ |
| 172 | function inlineCode(text: string): string { |
| 173 | const longest = Math.max(0, ...[...text.matchAll(/`+/g)].map((m) => m[0].length)); |
| 174 | const fence = '`'.repeat(longest + 1); |
| 175 | const pad = text.startsWith('`') || text.endsWith('`') ? ' ' : ''; |
| 176 | return `${fence}${pad}${text}${pad}${fence}`; |
| 177 | } |
| 178 | |
| 179 | const MAX_SITE_TEXT = 160; |
| 180 |
no test coverage detected