main: execute cmark with --unsafe

This commit is contained in:
Kevin Burke 2019-06-30 21:33:15 -07:00
parent 7e86ec5e8b
commit cf87ac38af
No known key found for this signature in database
GPG Key ID: 24B0EF06511BA263
1 changed files with 4 additions and 1 deletions

View File

@ -143,11 +143,14 @@ func main() {
// shell out to markdown because of // shell out to markdown because of
// https://github.com/russross/blackfriday/issues/403 // https://github.com/russross/blackfriday/issues/403
cmark, lookErr := exec.LookPath("cmark") cmark, lookErr := exec.LookPath("cmark")
args := []string{cmark, "--unsafe", f.Name()}
if lookErr != nil { if lookErr != nil {
args = args[:0]
cmark, lookErr = exec.LookPath("markdown") cmark, lookErr = exec.LookPath("markdown")
checkError(lookErr, "finding markdown binary") checkError(lookErr, "finding markdown binary")
args = []string{cmark, f.Name()}
} }
execErr := localExec(cmark, []string{cmark, f.Name()}, []string{}) execErr := localExec(cmark, args, []string{})
checkError(execErr, "executing markdown binary") checkError(execErr, "executing markdown binary")
if err := f.Close(); err != nil { if err := f.Close(); err != nil {
checkError(err, "closing file") checkError(err, "closing file")