Просмотр исходного кода

fix(tui): issue with rendering markdown tables (#1956)

Yihui Khuu 6 месяцев назад
Родитель
Сommit
c35e1a03d1
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      packages/tui/internal/util/file.go

+ 1 - 1
packages/tui/internal/util/file.go

@@ -86,7 +86,7 @@ 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+"/", "")
-	hyphenRegex := regexp.MustCompile(`-([^ ]|$)`)
+	hyphenRegex := regexp.MustCompile(`-([^ \-|]|$)`)
 	content = hyphenRegex.ReplaceAllString(content, "\u2011$1")
 	rendered, _ := r.Render(content)
 	lines := strings.Split(rendered, "\n")