Update main.go: Log to stdout & support both html and html-chroma
Could be moved into a flag but I'll significantly refactor the main.go later on anyways - for now this works TM
This commit is contained in:
parent
6637e63892
commit
6adad92e8b
2 changed files with 5 additions and 2 deletions
2
Makefile
2
Makefile
|
@ -20,4 +20,4 @@ setup:
|
|||
case=example
|
||||
.PHONY: render
|
||||
render:
|
||||
bash -c "go run main.go org/testdata/$(case).org html |& html2text"
|
||||
go run main.go org/testdata/$(case).org html | html2text
|
||||
|
|
5
main.go
5
main.go
|
@ -16,9 +16,10 @@ import (
|
|||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetOutput(os.Stdout)
|
||||
if len(os.Args) < 3 {
|
||||
log.Println("USAGE: org FILE OUTPUT_FORMAT")
|
||||
log.Fatal("supported output formats: org, html")
|
||||
log.Fatal("supported output formats: org, html, html-chroma")
|
||||
}
|
||||
bs, err := ioutil.ReadFile(os.Args[1])
|
||||
if err != nil {
|
||||
|
@ -29,6 +30,8 @@ func main() {
|
|||
case "org":
|
||||
out = org.NewDocument().Parse(r).Write(org.NewOrgWriter()).String()
|
||||
case "html":
|
||||
out = org.NewDocument().Parse(r).Write(org.NewHTMLWriter()).String()
|
||||
case "html-chroma":
|
||||
writer := org.NewHTMLWriter()
|
||||
writer.HighlightCodeBlock = highlightCodeBlock
|
||||
out = org.NewDocument().Parse(r).Write(writer).String()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue