package fs import ( "fmt" "io/ioutil" "log" "github.com/bouncepaw/mycorrhiza/plugin" "github.com/bouncepaw/mycorrhiza/util" ) func (h *Hypha) asHtml() (string, error) { rev := h.actual ret := `

` + rev.FullName + `

` // What about using
? // TODO: support other things if h.hasBinaryData() { ret += fmt.Sprintf(``, util.DisplayToCanonical(rev.FullName), rev.Id) } contents, err := ioutil.ReadFile(rev.TextPath) if err != nil { log.Println("Failed to read contents of", rev.FullName, ":", err) return "", err } // TODO: support more markups. // TODO: support mycorrhiza extensions like transclusion. parser := plugin.ParserForMime(rev.TextMime) ret += parser(contents) ret += `
` return ret, nil }