import { isSafeTagName, renderAttrs, renderBlockError } from "./attribute.js"; import type { BlockHandler } from "./handler.type.js"; /** * Default handler for `widget:*` block types. * Renders `` custom element tags. * * The block type carries the widget name (e.g. `widget:counter`), * attrs carry the parsed JSON properties. */ export function createWidgetHandler(widgetName: string): BlockHandler { const tagName = `widget-${widgetName}`; return { render(_raw: string, attrs?: Record): string { // The widget name comes from the fence info string, so it is // untrusted: `widget:x>