package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // DropcapIntroBlockMeta describes the Editorial drop-cap intro block: an // opening paragraph whose first letter is rendered as an oxblood drop cap. // Registered as "editorial:dropcap_intro" at runtime. var DropcapIntroBlockMeta = blocks.BlockMeta{ Key: "dropcap_intro", Title: "Drop Cap Intro", Description: "Opening paragraph with an oxblood Playfair drop cap", Source: "editorial", Category: blocks.CategoryTheme, } // DropcapIntroData carries parsed drop-cap-intro content. type DropcapIntroData struct { Lead string // rich-text payload, trusted upstream } // DropcapIntroBlock renders the opening paragraph. // // The drop cap is rendered via CSS (::first-letter on the first

) rather // than by extracting the first character server-side. This is the simpler // path and works for ASCII openers. The spec calls out a known risk: an // opener starting with `"` or `—` will style the punctuation. That fallback // is acceptable for this build pass and is documented in BUILD_REPORT.md. // // Content shape: // // { "lead": "

The reform was always going to be quiet.

" } func DropcapIntroBlock(ctx context.Context, content map[string]any) string { data := DropcapIntroData{ Lead: getString(content, "lead"), } if data.Lead == "" { return "" } var buf bytes.Buffer _ = dropcapIntroComponent(data).Render(ctx, &buf) return buf.String() }