aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/index/index_test.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-07-02 00:06:10 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-07-02 00:06:10 -0400
commitba68130862dc004a7a1b50d99fc70872d39fd065 (patch)
treeef4f08b1d91ff86f717fff4b30474048f77ae4c1 /pkg/index/index_test.go
parent4582265de0c0472755880652dc7b390b342cf3e0 (diff)
Add link parsing
Diffstat (limited to 'pkg/index/index_test.go')
-rw-r--r--pkg/index/index_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/index/index_test.go b/pkg/index/index_test.go
index 0a3239d..69600c2 100644
--- a/pkg/index/index_test.go
+++ b/pkg/index/index_test.go
@@ -251,6 +251,31 @@ func TestIndex_ParseOne(t *testing.T) {
nil,
},
{
+ "links",
+ func(t *testing.T) string {
+ f, path := newTestFile(t, "links")
+ defer f.Close()
+
+ f.WriteString("---\n")
+ f.WriteString("title: Link test\n")
+ f.WriteString("---\n")
+ f.WriteString(`
+ Here are some words in a *markdown* file.
+ In this sentence there is a valid [hyperlink](https://jpappel.xyz).
+ But in this sentence, the [link]() should not get parsed.
+ The same is true for the [link]( ) in this sentence.
+ `)
+
+ return path
+ },
+ index.ParseOpts{ParseLinks: true},
+ &index.Document{
+ Title: "Link test",
+ Links: []string{"https://jpappel.xyz"},
+ },
+ nil,
+ },
+ {
"bad tags",
func(t *testing.T) string {
f, path := newTestFile(t, "badtags")