Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTMLTemplRenderer ¶
type HTMLTemplRenderer struct {
FallbackHtmlRenderer render.HTMLRender
}
HTMLTemplRenderer is a custom renderer that can handle templ.Component.
func (*HTMLTemplRenderer) Instance ¶
func (r *HTMLTemplRenderer) Instance(s string, d interface{}) render.Render
Instance implements gin's HTMLRender interface. If the data is a templ.Component, it returns our custom Renderer struct; otherwise, it falls back to the default provided gin HTML renderer (if set).
NOTE: This method uses context.Background() because the HTMLRender interface has no access to the HTTP request context. Handlers should always use renderer.New(ctx, status, component) instead of c.HTML() to ensure proper context propagation (cancellation, timeouts, request-scoped values).
type Renderer ¶
Renderer implements gin.Render for templ components.
func (Renderer) Render ¶
func (t Renderer) Render(w http.ResponseWriter) error
Render writes headers and renders the templ component to the HTTP response.
func (Renderer) WriteContentType ¶
func (t Renderer) WriteContentType(w http.ResponseWriter)
WriteContentType sets "Content-Type: text/html; charset=utf-8".