Strip all ```mermaid ... ``` fenced code blocks from a markdown string. Other fenced code blocks (```bash, ```ts, โฆ) are preserved so that changes to them count as narrative drift.
Uses a line-scanner rather than a global regex to be robust against nested or malformed fences (the mermaid autofix in this repo can leave temporarily unbalanced fences mid-edit, which a regex .*? would mis-pair across files).
Strip all
```mermaid ... ```fenced code blocks from a markdown string. Other fenced code blocks (```bash,```ts, โฆ) are preserved so that changes to them count as narrative drift.Uses a line-scanner rather than a global regex to be robust against nested or malformed fences (the mermaid autofix in this repo can leave temporarily unbalanced fences mid-edit, which a regex
.*?would mis-pair across files).