diff --git a/cmd/olliesrv/internal/fs/support.go b/cmd/olliesrv/internal/fs/support.go
index 003fb27..5e7a1cf 100644
--- a/cmd/olliesrv/internal/fs/support.go
+++ b/cmd/olliesrv/internal/fs/support.go
@@ -43,21 +43,38 @@ func dispatch(handlers map[string]func([]string) ([]byte, error), data []byte) (
return h(args)
}
-// stripMarkers removes [[[...]]] marker lines and source fence delimiter lines
-// from raw chat data. Content inside fences is preserved — only the ``` lines
-// themselves are stripped.
+// stripMarkers removes [[[...]]] marker lines, source fence delimiter lines,
+// and ... blocks from raw chat data. Content inside fences
+// is preserved — only the ``` lines themselves are stripped.
func stripMarkers(data []byte) []byte {
var out []byte
+ inContext := false
for len(data) > 0 {
nl := bytes.IndexByte(data, '\n')
if nl < 0 {
- out = append(out, data...)
+ if !inContext {
+ out = append(out, data...)
+ }
break
}
line := data[:nl+1]
data = data[nl+1:]
trimmed := bytes.TrimRight(line, "\n")
+
+ // Handle block start/end
+ if bytes.Equal(bytes.TrimSpace(trimmed), []byte("")) {
+ inContext = true
+ continue
+ }
+ if bytes.Equal(bytes.TrimSpace(trimmed), []byte("")) {
+ inContext = false
+ continue
+ }
+ if inContext {
+ continue
+ }
+
if len(trimmed) >= 7 && bytes.HasPrefix(trimmed, []byte("[[[")) && bytes.HasSuffix(trimmed, []byte("]]]")) {
continue
}