about summary refs log tree commit diff stats
path: root/internal/options
diff options
context:
space:
mode:
authorAlan Pearce2024-05-05 19:03:10 +0200
committerAlan Pearce2024-05-05 19:03:10 +0200
commit0d653242b21abd1678df35e2ba6c30cc23733eb1 (patch)
treef0bf17faeee79fed355268c975f5787911d136fa /internal/options
parent767e25a146c3dfefb4774517bacd01f831ee25a2 (diff)
downloadsearchix-0d653242b21abd1678df35e2ba6c30cc23733eb1.tar.lz
searchix-0d653242b21abd1678df35e2ba6c30cc23733eb1.tar.zst
searchix-0d653242b21abd1678df35e2ba6c30cc23733eb1.zip
feat: auto-linkify URLs in markdown
Diffstat (limited to 'internal/options')
-rw-r--r--internal/options/option.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/options/option.go b/internal/options/option.go
index 5255c65..d714ad2 100644
--- a/internal/options/option.go
+++ b/internal/options/option.go
@@ -6,6 +6,7 @@ import (
 
 	"github.com/pkg/errors"
 	"github.com/yuin/goldmark"
+	"github.com/yuin/goldmark/extension"
 )
 
 type NixValue struct {
@@ -17,9 +18,13 @@ type HTML struct {
 	HTML string
 }
 
+var md = goldmark.New(
+	goldmark.WithExtensions(extension.NewLinkify()),
+)
+
 func (html *HTML) UnmarshalText(text []byte) error {
 	var out strings.Builder
-	err := goldmark.Convert(text, &out)
+	err := md.Convert(text, &out)
 	if err != nil {
 		return errors.WithMessage(err, "failed to convert markdown to HTML")
 	}