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