feat: add miller document layout
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user