Package mdhttp provides an http.Handler middleware to render markdown to HTML, for the Go programming language.
Find a file
2025-10-05 12:31:53 -07:00
basictransformation.go the transformers. more than meets the eye. 2025-09-06 19:19:05 -07:00
errors.go errors 2025-09-01 21:31:26 -07:00
go.mod codeberg 2025-10-05 12:31:53 -07:00
go.sum codeberg 2025-10-05 12:31:53 -07:00
handler.go codeberg 2025-10-05 12:31:53 -07:00
hasmarkdownmediatype.go hasMarkDownMediaType() 2025-09-01 21:32:28 -07:00
LICENSE intial commits 2025-09-01 21:29:53 -07:00
logger.go codeberg 2025-10-05 12:31:53 -07:00
notransformation.go the transformers. more than meets the eye. 2025-09-06 19:19:05 -07:00
README.md mdhttp.Wrap() 2025-09-01 22:32:03 -07:00
responsewriter.go improvement 2025-09-01 22:41:27 -07:00
transformer.go the transformers. more than meets the eye. 2025-09-06 19:19:05 -07:00

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

GoDoc

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