Documentation ¶
Overview ¶
Package html 提供输出 HTML 内容的解码函数
srv := NewServer() tpl := template.ParseFiles(...) srv.Mimetypes().Add("text/html", html.Marshal, nil) func handle(ctx *web.Context) Responser { return Object(200, html.Tpl(tpl, "index", map[string]any{...}), nil) }
Index ¶
Constants ¶
View Source
const Mimetype = "text/html"
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal 针对 HTML 内容的解码实现
参数 v 可以是以下几种可能:
- Marshaler 接口;
- string 或是 []byte 将内容作为 HTML 内容直接输出;
- 其它情况下则是返回 serializer.ErrUnsupported;
Types ¶
Click to show internal directories.
Click to hide internal directories.