-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Glamour to render readmes when file is markdown formatted Fixes: #463
- Loading branch information
1 parent
b06b555
commit ead2892
Showing
7 changed files
with
75 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package common_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/charmbracelet/soft-serve/pkg/ui/common" | ||
) | ||
|
||
func TestIsFileMarkdown(t *testing.T) { | ||
cases := []struct { | ||
name string | ||
filename string | ||
content string // XXX: chroma doesn't correctly analyze mk files | ||
isMkd bool | ||
}{ | ||
{"simple", "README.md", "", true}, | ||
{"empty", "", "", false}, | ||
{"no extension", "README", "", false}, | ||
{"weird extension", "README.foo", "", false}, | ||
{"long ext", "README.markdown", "", true}, | ||
} | ||
|
||
for _, c := range cases { | ||
t.Run(c.name, func(t *testing.T) { | ||
if got := common.IsFileMarkdown(c.content, c.filename); got != c.isMkd { | ||
t.Errorf("IsFileMarkdown(%q, %q) = %v, want %v", c.content, c.filename, got, c.isMkd) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters