MCPcopy Create free account
hub / github.com/continuedev/continue / processBlockNesting

Function processBlockNesting

core/utils/streamMarkdownUtils.ts:19–33  ·  view source on GitHub ↗
(
  line: string,
  seenFirstFence: boolean,
  shouldRemoveLineBeforeStart: (line: string) => boolean,
)

Source from the content-addressed store, hash-verified

17 * Processes block nesting logic and returns updated state.
18 */
19export function processBlockNesting(
20 line: string,
21 seenFirstFence: boolean,
22 shouldRemoveLineBeforeStart: (line: string) => boolean,
23): { newSeenFirstFence: boolean; shouldSkip: boolean } {
24 if (!seenFirstFence && shouldRemoveLineBeforeStart(line)) {
25 return { newSeenFirstFence: false, shouldSkip: true };
26 }
27
28 if (!seenFirstFence) {
29 return { newSeenFirstFence: true, shouldSkip: false };
30 }
31
32 return { newSeenFirstFence: seenFirstFence, shouldSkip: false };
33}
34
35/**
36 * Stream transformation that stops when encountering a markdown code block ending.

Callers 2

filterCodeBlockLinesFunction · 0.90

Calls 1

Tested by

no test coverage detected