(value: string)
| 39 | const escapeMarkdownText = (value: string): string => value.replace(/\\/g, "\\\\").replace(/[~<>*_]/g, "\\$&") |
| 40 | |
| 41 | const escapeAnnotationText = (value: string): string => { |
| 42 | const output: Array<string> = [] |
| 43 | let index = 0 |
| 44 | while (index < value.length) { |
| 45 | const start = value.indexOf("`", index) |
| 46 | if (start === -1) { |
| 47 | output.push(escapeMarkdownText(value.slice(index))) |
| 48 | break |
| 49 | } |
| 50 | output.push(escapeMarkdownText(value.slice(index, start))) |
| 51 | let end = start + 1 |
| 52 | while (value[end] === "`") { |
| 53 | end++ |
| 54 | } |
| 55 | const delimiter = value.slice(start, end) |
| 56 | const close = value.indexOf(delimiter, end) |
| 57 | if (close === -1) { |
| 58 | output.push("\\`".repeat(delimiter.length)) |
| 59 | index = end |
| 60 | } else { |
| 61 | output.push(value.slice(start, close + delimiter.length)) |
| 62 | index = close + delimiter.length |
| 63 | } |
| 64 | } |
| 65 | return output.join("") |
| 66 | } |
| 67 | |
| 68 | const compareStrings = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0 |
| 69 |
no test coverage detected