()
| 166 | } |
| 167 | |
| 168 | async renderPreviewNotes() { |
| 169 | const previews = get(this.#operation, 'x-github.previews', []) |
| 170 | this.previews = await Promise.all( |
| 171 | previews.map(async (preview) => { |
| 172 | const note = preview.note |
| 173 | // remove extra leading and trailing newlines |
| 174 | .replace(/```\n\n\n/gm, '```\n') |
| 175 | .replace(/```\n\n/gm, '```\n') |
| 176 | .replace(/\n\n\n```/gm, '\n```') |
| 177 | .replace(/\n\n```/gm, '\n```') |
| 178 | |
| 179 | // convert single-backtick code snippets to fully fenced triple-backtick blocks |
| 180 | // example: This is the description.\n\n`application/vnd.github.machine-man-preview+json` |
| 181 | .replace(/\n`application/, '\n```\napplication') |
| 182 | .replace(/json`$/, 'json\n```') |
| 183 | return await renderContent(note) |
| 184 | }) |
| 185 | ) |
| 186 | } |
| 187 | } |
no test coverage detected