package server import ( "fmt" "io/ioutil" "net/http" "os" "github.com/gomarkdown/markdown" ) func isFile(path string) bool { stat, err := os.Stat(path) return err == nil && !stat.IsDir() } func notesFile(path string, w http.ResponseWriter, r *http.Request) { title := h1(path) block(title, w) b, _ := ioutil.ReadFile(path) content := markdown.ToHTML(b, nil, nil) fmt.Fprintf(w, "%s\n", content) }