Skip to content

Commit

Permalink
Fix block directive output contents (#42)
Browse files Browse the repository at this point in the history
- add `{{contents}}` variable support to block directive output
  • Loading branch information
tib authored Oct 21, 2024
1 parent 570d9a0 commit 4c62640
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/ToucanSDK/Markdown/MarkupToHTMLVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,15 @@ struct MarkupToHTMLVisitor: MarkupVisitor {
}

if let output = block.output {
return output.replacingOccurrences(templateParams)
var contents = ""
for child in blockDirective.children {
contents += visit(child)
}

var params = templateParams
params["{{contents}}"] = contents

return output.replacingOccurrences(params)
}

if let name = block.tag {
Expand Down

0 comments on commit 4c62640

Please sign in to comment.