memos/plugin/markdown
Steven 68c17469a3 fix(markdown): fix UTF-8 truncation for CJK characters in snippet generation
The truncateAtWord function was slicing strings by byte position instead of
character position. When truncating text with multi-byte UTF-8 characters
(like CJK), this could cut in the middle of a character, creating invalid
UTF-8 and causing gRPC marshaling errors.

Fixed by converting to runes before truncation to ensure we always cut at
proper character boundaries. Added test cases for CJK characters.

Fixes #5276

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 07:34:28 +08:00
..
ast chore: remove unused syntax 2025-10-27 08:31:57 +08:00
extensions chore: remove unused syntax 2025-10-27 08:31:57 +08:00
parser fix: add period to comment for golangci-lint compliance 2025-11-23 23:47:17 +08:00
renderer chore: remove unused syntax 2025-10-27 08:31:57 +08:00
markdown.go fix(markdown): fix UTF-8 truncation for CJK characters in snippet generation 2025-11-26 07:34:28 +08:00
markdown_test.go fix(markdown): fix UTF-8 truncation for CJK characters in snippet generation 2025-11-26 07:34:28 +08:00