- Go 100%
| basictransformation.go | ||
| errors.go | ||
| go.mod | ||
| go.sum | ||
| handler.go | ||
| hasmarkdownmediatype.go | ||
| LICENSE | ||
| logger.go | ||
| notransformation.go | ||
| README.md | ||
| responsewriter.go | ||
| transformer.go | ||
go-mdhttp
Package mdhttp provides an http.Handler middleware to render markdown to HTML, for the Go programming language.
mdhttp only renders markdown to HTML when the nested http.Handler returns something with a Content-Type of text/markdown AND the Accept header in the HTTP request does NOT contain text/markdown.
mdhttp uses goldmark.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-mdhttp
Example
Here is an example of using mdhttp.Handler to wrap another handler, to provide mardown to HTML rendering.
import "codeberg.org/reiver/go-mdhttp"
// ...
var handler http.Handler = ...
handler = mdhttp.Wrap(handler) // <---------
err := http.ListenAndServe(":8080", handler)
if nil != err {
return err
}
Import
To import package mdhttp use import code like the following:
import "codeberg.org/reiver/go-mdhttp"
Installation
To install package mdhttp do the following:
GOPROXY=direct go get codeberg.org/reiver/go-mdhttp
Author
Package mdhttp was written by Charles Iliya Krempeaux