mirror of
https://github.com/arnaucube/padArchiver.git
synced 2026-02-08 12:16:48 +01:00
implemented webServer, and implemented listPadsImporter
This commit is contained in:
23
webServer/files.go
Normal file
23
webServer/files.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/fatih/color"
|
||||
blackfriday "gopkg.in/russross/blackfriday.v2"
|
||||
)
|
||||
|
||||
func readFile(path string) string {
|
||||
dat, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
color.Red(path)
|
||||
}
|
||||
check(err)
|
||||
return string(dat)
|
||||
}
|
||||
|
||||
func fileToHTML(path string) (string, error) {
|
||||
mdcontent := readFile(path)
|
||||
htmlcontent := string(blackfriday.Run([]byte(mdcontent)))
|
||||
return htmlcontent, nil
|
||||
}
|
||||
Reference in New Issue
Block a user