themes-magazine-bold/image_override.go
Alex Dunmow fe754f634b initial: theme plugin magazine-bold
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/magazine-bold.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:38 +08:00

24 lines
720 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// ImageOverrideBlock renders the built-in image block with the Magazine Bold
// treatment: optional full-bleed mode + a mono caption folio.
//
// Built-in image content shape: {"src": "...", "alt": "...", "caption": "...", "fullBleed": true/false}
func ImageOverrideBlock(ctx context.Context, content map[string]any) string {
src := blocks.ResolveMediaPath(getString(content, "src"))
alt := getString(content, "alt")
caption := getString(content, "caption")
fullBleed := getBool(content, "fullBleed", false)
var buf bytes.Buffer
_ = mbImageComponent(src, alt, caption, fullBleed).Render(ctx, &buf)
return buf.String()
}