Skip to content

Instantly share code, notes, and snippets.

@slav123
Created August 25, 2014 05:59
Show Gist options
  • Save slav123/aa1408f384523330ff1e to your computer and use it in GitHub Desktop.
Save slav123/aa1408f384523330ff1e to your computer and use it in GitHub Desktop.
<form action="/generate" method="POST"> <textarea name="body" cols="30" rows="10"></textarea> <button>Submit</button> </form>
package main
import (
"github.com/codegangsta/martini"
"github.com/russross/blackfriday"
"net/http"
)
func main() {
m := martini.Classic()
m.Post("/generate", func(r *http.Request) []byte {
body := r.FormValue("body")
return blackfriday.MarkdownBasic([]byte(body))
})
m.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment