registry.mdin: /docs/internal/components/

import (


We need a way to embed the components in the actual page.

A static map and an init hook is enough for this, and our doc handler can use this to see if there's any component to actually render in the page.

var registry = map[string]Views{}

func show(vs ...IComponent) {
    _, file, _, ok := runtime.Caller(1)
    if !ok {
        panic("no caller")
    } else {
        file = strings.TrimSuffix(filepath.Base(file), ".generated.go")

	registry[file+".md"] = Views(vs)


Callers should use ForURL to get a view based on the key.

func ForFullURL(url string) (veun.AsView, bool) {
	return ForURL(strings.TrimPrefix(url, "/docs/internal/components/"))

func ForURL(url string) (veun.AsView, bool) {
	v, ok := registry[url]
	return v, ok