fix: markdown lists
This commit is contained in:
parent
e9cb360cb7
commit
c4ae3e429c
1 changed files with 3 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ package util
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
|
|
@ -85,7 +86,8 @@ func Extension(path string) string {
|
||||||
func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string {
|
func ToMarkdown(content string, width int, backgroundColor compat.AdaptiveColor) string {
|
||||||
r := styles.GetMarkdownRenderer(width-6, backgroundColor)
|
r := styles.GetMarkdownRenderer(width-6, backgroundColor)
|
||||||
content = strings.ReplaceAll(content, RootPath+"/", "")
|
content = strings.ReplaceAll(content, RootPath+"/", "")
|
||||||
content = strings.ReplaceAll(content, "-", "\u2011")
|
hyphenRegex := regexp.MustCompile(`-([^ ]|$)`)
|
||||||
|
content = hyphenRegex.ReplaceAllString(content, "\u2011$1")
|
||||||
rendered, _ := r.Render(content)
|
rendered, _ := r.Render(content)
|
||||||
lines := strings.Split(rendered, "\n")
|
lines := strings.Split(rendered, "\n")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue