mirror of
https://github.com/usestrix/strix.git
synced 2026-08-21 10:48:59 +02:00
fix(tui): use single space after ordered-list marker (#1043)
This commit is contained in:
@@ -100,7 +100,7 @@ func applyMarkdownStyles(text string) string {
|
||||
case strings.HasPrefix(line, "- "), strings.HasPrefix(line, "* "):
|
||||
out.WriteString(Col(Green).Render("• ") + inlineFormat(line[2:]))
|
||||
case len(line) > 2 && line[0] >= '0' && line[0] <= '9' && (line[1:3] == ". " || line[1:3] == ") "):
|
||||
out.WriteString(Col(Green).Render(string(line[0])+". ") + inlineFormat(line[2:]))
|
||||
out.WriteString(Col(Green).Render(line[:2]+" ") + inlineFormat(line[3:]))
|
||||
case line == "---" || line == "***" || line == "___":
|
||||
out.WriteString(Col(Green).Render(strings.Repeat("─", 40)))
|
||||
default:
|
||||
|
||||
@@ -72,6 +72,19 @@ func TestNonTablePipeLinesAreLeftAlone(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarkdownOrderedListsUseSingleSpaceAfterMarker(t *testing.T) {
|
||||
out := renderAssistantMarkdown("1. hello\n2) world")
|
||||
plain := ansi.Strip(out)
|
||||
for _, want := range []string{"1. hello", "2) world"} {
|
||||
if !strings.Contains(plain, want) {
|
||||
t.Fatalf("ordered list item %q missing: %q", want, plain)
|
||||
}
|
||||
}
|
||||
if strings.Contains(plain, "1. hello") || strings.Contains(plain, "2) world") {
|
||||
t.Fatalf("double space after the list marker: %q", plain)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInlineFormatKeepsNonEmphasisMarkers(t *testing.T) {
|
||||
literal := []string{
|
||||
"ls *.py *.go",
|
||||
|
||||
Reference in New Issue
Block a user