(body: CaptureRequest)
| 238 | } |
| 239 | |
| 240 | function createSourceDescription(body: CaptureRequest): string { |
| 241 | const title |
| 242 | = trimToValue(body.sourceTitle) |
| 243 | ?? trimToValue(body.source?.title) |
| 244 | ?? trimToValue(body.pageTitle) |
| 245 | const url |
| 246 | = trimToValue(body.sourceUrl) |
| 247 | ?? trimToValue(body.source?.url) |
| 248 | ?? trimToValue(body.url) |
| 249 | const lines: string[] = [] |
| 250 | |
| 251 | if (url) { |
| 252 | lines.push(`Captured from: ${title ? `${title} (${url})` : url}`) |
| 253 | } |
| 254 | |
| 255 | const contextLabel = trimToValue(body.contextLabel) |
| 256 | if (contextLabel) { |
| 257 | lines.push(`Context: ${contextLabel}`) |
| 258 | } |
| 259 | |
| 260 | lines.push(`Captured at: ${resolveCapturedAt(body)}`) |
| 261 | |
| 262 | return lines.join('\n') |
| 263 | } |
| 264 | |
| 265 | function getCodeFence(text: string): string { |
| 266 | const matches = text.match(/`{3,}/g) |
no test coverage detected