Skip to content
Open
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
8 changes: 5 additions & 3 deletions tools/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,12 @@ func buildCompiledArticle(cl Cluster, synthesized string) string {
if cat == "" {
cat = "context"
}
// Truncate content for the summary column (first 80 chars).
// Truncate content for the summary column (first 80 runes).
// Use []rune to avoid slicing mid-multibyte character (e.g. em-dash
// U+2014 is 3 bytes; byte-slicing at boundary produces invalid UTF-8).
summary := l.Content
if len(summary) > 80 {
summary = summary[:80] + "..."
if runes := []rune(summary); len(runes) > 80 {
summary = string(runes[:80]) + "..."
}
// Remove newlines from summary for table formatting.
summary = strings.ReplaceAll(summary, "\n", " ")
Expand Down
Loading