This commit is contained in:
bel
2019-10-20 02:04:27 +00:00
parent c871632f15
commit ac35e870cc
8 changed files with 28 additions and 2 deletions

0
server/create.go Normal file → Executable file
View File

0
server/create_test.go Normal file → Executable file
View File

View File

@@ -7,12 +7,18 @@ import (
"path"
"github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/html"
"github.com/gomarkdown/markdown/parser"
)
func notesFile(p Path, w http.ResponseWriter, r *http.Request) {
b, _ := ioutil.ReadFile(p.Local)
notesFileHead(p, w)
content := markdown.ToHTML(b, nil, nil)
renderer := html.NewRenderer(html.RendererOptions{
Flags: html.CommonFlags | html.TOC,
})
parser := parser.NewWithExtensions(parser.CommonExtensions | parser.HeadingIDs | parser.AutoHeadingIDs | parser.Titleblock)
content := markdown.ToHTML(b, parser, renderer)
fmt.Fprintf(w, "%s\n", content)
}

0
server/submit.go Normal file → Executable file
View File

0
server/submit_test.go Normal file → Executable file
View File