( line: string, seenFirstFence: boolean, shouldRemoveLineBeforeStart: (line: string) => boolean, )
| 17 | * Processes block nesting logic and returns updated state. |
| 18 | */ |
| 19 | export 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. |
no test coverage detected