about summary refs log tree commit diff stats
path: root/internal/nix/option.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/nix/option.go')
-rw-r--r--internal/nix/option.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/nix/option.go b/internal/nix/option.go
index c1cc4c3..96c4546 100644
--- a/internal/nix/option.go
+++ b/internal/nix/option.go
@@ -1,5 +1,13 @@
 package nix
 
+import (
+	"io"
+
+	"github.com/yuin/goldmark"
+	"github.com/yuin/goldmark/extension"
+	"gitlab.com/tozd/go/errors"
+)
+
 type Markdown string
 
 type Value struct {
@@ -35,3 +43,12 @@ func (p Option) GetName() string {
 func (p Option) GetSource() string {
 	return p.Source
 }
+
+var md = goldmark.New(
+	goldmark.WithExtensions(extension.NewLinkify()),
+)
+
+// implements gomponent.Node
+func (text Markdown) Render(w io.Writer) error {
+	return errors.WithStack(md.Convert([]byte(text), w))
+}