Documentation ¶
Index ¶
- func PlaintextBlurb(s string) string
- type Engine
- func (te *Engine) ErrorTemplate(w http.ResponseWriter, r *http.Request, mainTemplate string, ...) (status int, err error)
- func (te *Engine) Post(w http.ResponseWriter, r *http.Request, mainTemplate string, post model.Post, ...) (status int, err error)
- func (te *Engine) RenderMarkdown(markdown string) template.HTML
- func (te *Engine) Template(w http.ResponseWriter, r *http.Request, mainTemplate string, ...) (status int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlaintextBlurb ¶
PlaintextBlurb returns a plaintext blurb from markdown content.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents a HTML template engine.
func New ¶
func New(manager *html.TemplateManager, allowUnsafeHTML bool) *Engine
New returns a HTML template engine.
func (*Engine) ErrorTemplate ¶
func (te *Engine) ErrorTemplate(w http.ResponseWriter, r *http.Request, mainTemplate string, partialTemplate string, vars map[string]any) (status int, err error)
ErrorTemplate renders HTML to a response writer and returns a 404 status code and an error if one occurs.
func (*Engine) Post ¶
func (te *Engine) Post( w http.ResponseWriter, r *http.Request, mainTemplate string, post model.Post, vars map[string]any, ) (status int, err error)
Post converts a site post from markdown to HTML and then outputs to response writer. Returns an HTTP status code and an error if one occurs.
func (*Engine) RenderMarkdown ¶
RenderMarkdown renders markdown to html
Click to show internal directories.
Click to hide internal directories.