MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / findClosingDelimiter

Function findClosingDelimiter

cli/src/utils/markdown-renderer.tsx:206–227  ·  view source on GitHub ↗
(
  value: string,
  start: number,
  marker: string,
)

Source from the content-addressed store, hash-verified

204}
205
206const 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

Callers 1

parseInlineFallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected