@@ 3,3 3,5 @@ module git.sr.ht/~chiefnoah/seq
go 1.20
require github.com/google/uuid v1.3.0
+
+require github.com/russross/blackfriday/v2 v2.1.0 // indirect
@@ 2,3 2,5 @@ github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 h1:uK3X/2mt4tb
github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ 11,6 11,7 @@ import (
"strings"
"github.com/google/uuid"
+ blackfriday "github.com/russross/blackfriday/v2"
)
const TABSTOP int = 4
@@ 103,23 104,33 @@ func (b *Block) recursive_print(builder *strings.Builder, depth int) {
if builder == nil {
builder = &strings.Builder{}
}
- tab(builder, depth)
- builder.WriteString("<li>\n")
+ if depth > 0 {
+ tab(builder, depth)
+ builder.WriteString("<li>\n")
+ }
if b.Content != nil {
tab(builder, depth)
// Handle indentation
- builder.WriteString(*b.Content)
+ output := blackfriday.Run([]byte(*b.Content))
+ builder.WriteString(string(output))
builder.WriteString("\n")
}
- tab(builder, depth)
- builder.WriteString("</li>\n")
+ if depth > 0 {
+ tab(builder, depth)
+ builder.WriteString("</li>\n")
+ }
if len(*b.Children) > 0 {
- builder.WriteString("<ul>\n")
+ tab(builder, depth)
+ builder.WriteString("<li>\n")
+ tab(builder, depth)
+ builder.WriteString("<li><ul>\n")
for _, child := range *b.Children {
child.recursive_print(builder, depth+1)
}
tab(builder, depth)
builder.WriteString("</ul>\n")
+ tab(builder, depth)
+ builder.WriteString("</li>\n")
}
// If we're the top level block to print...
if depth == 0 {