Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func (p *Parser) createCheat(path string, s *parseState, block codeBlock, cheatB
p.index.Errors = append(p.index.Errors, ParseError{
File: path,
Line: cheatLine,
Message: "cheat contains raw ANSI escape sequences which will be sanitized",
Message: "cheat contains raw ANSI escape sequences which may cause parsing errors. Please remove them manually.",
})
}

Expand Down
25 changes: 25 additions & 0 deletions pkg/parser/parser_ansi_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package parser

import (
"strings"
"testing"
)

func TestANSIWarningMessage(t *testing.T) {
p := NewParser()
content := []byte("# \x1b[31mCheat\x1b[0m\n```bash\necho 1\n```\n")

p.parseLines("test.md", content)

// Create cheats so createCheat runs
_ = p.index.Cheats

if len(p.index.Errors) != 1 {
t.Fatalf("expected 1 error, got %d", len(p.index.Errors))
}

errMessage := p.index.Errors[0].Message
if !strings.Contains(errMessage, "Please remove them manually") {
t.Errorf("expected warning to mention manual removal, got %q", errMessage)
}
}
Loading