Skip to content

Instantly share code, notes, and snippets.

@rocknrollMarc
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rocknrollMarc/37f2c945681705c2159b to your computer and use it in GitHub Desktop.
Save rocknrollMarc/37f2c945681705c2159b to your computer and use it in GitHub Desktop.
package main
import (
"net/http"
"github.com/russross/blackfriday"
)
func main() {
http.HandleFunc("/markdown", GenerateMarkdown)
http.Handle("/",
http.FileServer(http.Dir("public")))
http.ListenAndServe(":8080", nil)
}
func GenerateMarkdown(rw http.ResponseWriter, r *http.Request) {
markdown := blackfriday.MarkdownCommon([]byte(r.FormValue("body")))
rw.Write(markdown}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment