feat: add miller document layout

This commit is contained in:
2026-04-29 09:26:37 -04:00
parent 6e244d55db
commit 8c454de809
5 changed files with 333 additions and 72 deletions

View File

@@ -15,7 +15,8 @@ import (
)
var (
tagPattern = regexp.MustCompile(`(^|[\s(])#([a-zA-Z0-9_-]+)\b`)
tagPattern = regexp.MustCompile(`(^|[\s(])#([a-zA-Z0-9_-]+)\b`)
firstH1Pattern = regexp.MustCompile(`(?s)^\s*<h1\b[^>]*>.*?</h1>\s*`)
)
type Result struct {
@@ -61,8 +62,10 @@ func (r *Renderer) Render(content []byte) (Result, error) {
return Result{}, fmt.Errorf("render markdown: %w", err)
}
html := firstH1Pattern.ReplaceAllString(output.String(), "")
return Result{
HTML: template.HTML(output.String()),
HTML: template.HTML(html),
Title: title,
Tags: tags,
}, nil