Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/earthen. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 lines
541 B
Go
22 lines
541 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
)
|
|
|
|
// EarthenImageBlock renders an image with paper-grain frame and optional caption.
|
|
// Content expects: {"src":"…","alt":"…","caption":"…"}
|
|
func EarthenImageBlock(ctx context.Context, content map[string]any) string {
|
|
src := getString(content, "src")
|
|
if src == "" {
|
|
src = getString(content, "url")
|
|
}
|
|
alt := getString(content, "alt")
|
|
caption := getString(content, "caption")
|
|
|
|
var buf bytes.Buffer
|
|
_ = earthenImageComponent(src, alt, caption).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|