(content: string, ext: string)
| 144 | } |
| 145 | |
| 146 | export function createFencedCodeBlock(content: string, ext: string): string { |
| 147 | const markdownLanguage = getMarkdownLanguage(ext); |
| 148 | const fenceMatches = content.match(/`+/g) ?? []; |
| 149 | let longestFence = 0; |
| 150 | for (const fence of fenceMatches) { |
| 151 | longestFence = Math.max(longestFence, fence.length); |
| 152 | } |
| 153 | const fence = "`".repeat(Math.max(3, longestFence + 1)); |
| 154 | return `${fence}${markdownLanguage}\n${content}\n${fence}`; |
| 155 | } |
| 156 | |
| 157 | export function resolveCodeEmbedReference( |
| 158 | plugin: CodeSpacePlugin, |
no test coverage detected