diff options
| author | adamdotdevin <[email protected]> | 2025-08-12 13:22:19 -0500 |
|---|---|---|
| committer | adamdotdevin <[email protected]> | 2025-08-12 13:22:28 -0500 |
| commit | c4ae3e429cd69388d9cde11fa79a8b5d99f04f78 (patch) | |
| tree | d03ea64e20efccb429d589072828f304ef0ad1a8 | |
| parent | e9cb360cb7e6a72be187a78358428182c34d37ab (diff) | |
| download | opencode-c4ae3e429cd69388d9cde11fa79a8b5d99f04f78.tar.gz opencode-c4ae3e429cd69388d9cde11fa79a8b5d99f04f78.zip | |
fix: markdown lists
| -rw-r--r-- | packages/tui/internal/util/file.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/tui/internal/util/file.go b/packages/tui/internal/util/file.go index 943f784fc..879e8a6ab 100644 --- a/packages/tui/internal/util/file.go +++ b/packages/tui/internal/util/file.go @@ -3,6 +3,7 @@ package util import ( "fmt" "path/filepath" + "regexp" "strings" "unicode" @@ -85,7 +86,8 @@ func Extension(path string) string { func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string { r := styles.GetMarkdownRenderer(width-6, backgroundColor) content = strings.ReplaceAll(content, RootPath+"/", "") - content = strings.ReplaceAll(content, "-", "\u2011") + hyphenRegex := regexp.MustCompile(`-([^ ]|$)`) + content = hyphenRegex.ReplaceAllString(content, "\u2011$1") rendered, _ := r.Render(content) lines := strings.Split(rendered, "\n") |
