Append 'out' parameter, to dump html files
This commit is contained in:
parent
647e9b546d
commit
aa6aef939d
17
main.go
17
main.go
|
@ -1,12 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"bytes"
|
||||
|
||||
"github.com/yuin/goldmark"
|
||||
"github.com/yuin/goldmark/extension"
|
||||
"github.com/yuin/goldmark/parser"
|
||||
|
@ -44,10 +45,10 @@ func convertMarkdownToHtml(file string) {
|
|||
goldmark.WithParserOptions(
|
||||
parser.WithAutoHeadingID(),
|
||||
),
|
||||
goldmark.WithRendererOptions(
|
||||
goldmark.WithRendererOptions(
|
||||
html.WithHardWraps(),
|
||||
html.WithXHTML(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
@ -61,8 +62,15 @@ func convertMarkdownToHtml(file string) {
|
|||
func main() {
|
||||
|
||||
var rootDir *string
|
||||
var outputDir *string
|
||||
|
||||
defaultOutputDir, err := os.MkdirTemp("", "go-jack")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
rootDir = flag.String("dir", ".", "Specify the directory to parse.")
|
||||
outputDir = flag.String("out", defaultOutputDir, "Specify the output directory")
|
||||
flag.Usage = func() {
|
||||
fmt.Printf("Jack expects: \n")
|
||||
fmt.Printf("./jack -d <rootDir>\n")
|
||||
|
@ -75,5 +83,6 @@ func main() {
|
|||
fmt.Println(file)
|
||||
convertMarkdownToHtml(file)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(*outputDir)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue