This commit is contained in:
Max Richter
2025-09-26 12:42:06 +02:00
parent deae5acac8
commit ae5cd8481a
17 changed files with 649 additions and 233 deletions

View File

@@ -40,19 +40,9 @@ func DetectType(markdownContent string) (string, error) {
return "", fmt.Errorf("could not parse frontmatter")
}
func MatchBlocks(markdownContent string) ([]matcher.Block, error) {
func MatchBlocks(markdownContent, templateContent string) ([]matcher.Block, error) {
markdownContent = strings.TrimSuffix(markdownContent, "\n")
contentType, err := DetectType(markdownContent)
if err != nil {
return nil, fmt.Errorf("could not detect type: %w", err)
}
templateContent, err := registry.GetTemplate(contentType)
if err != nil {
return nil, fmt.Errorf("could not get schema: %w", err)
}
tpl, err := template.CompileTemplate(templateContent)
if err != nil {
return nil, fmt.Errorf("failed to compile template: %w", err)