You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
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
|
|
}
|