( value: string, start: number, marker: string, )
| 204 | } |
| 205 | |
| 206 | const findClosingDelimiter = ( |
| 207 | value: string, |
| 208 | start: number, |
| 209 | marker: string, |
| 210 | ): number => { |
| 211 | let idx = start |
| 212 | while (idx < value.length) { |
| 213 | idx = value.indexOf(marker, idx) |
| 214 | if (idx === -1) { |
| 215 | return -1 |
| 216 | } |
| 217 | let backslashes = 0 |
| 218 | for (let offset = idx - 1; offset >= 0 && value[offset] === '\\'; offset -= 1) { |
| 219 | backslashes += 1 |
| 220 | } |
| 221 | if (backslashes % 2 === 0) { |
| 222 | return idx |
| 223 | } |
| 224 | idx += marker.length |
| 225 | } |
| 226 | return -1 |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Remark follows CommonMark's emphasis rules, which ignore some practical |
no outgoing calls
no test coverage detected