feature/table-of-content-docx #2
@ -22,7 +22,7 @@ func ConvertToMarkdown(c *Config, filename string) ([]byte, error) {
|
|||||||
|
|
||||||
// --toc
|
// --toc
|
||||||
articleFileName := filepath.Join(os.TempDir(), fmt.Sprint(uuid.New(), ".md"))
|
articleFileName := filepath.Join(os.TempDir(), fmt.Sprint(uuid.New(), ".md"))
|
||||||
cmd := exec.Command("pandoc", "-s", "--lua-filter=cmd/backend/remove-header-images.lua", "-f", "docx", "-t", "commonmark_x", "-o", articleFileName, "--extract-media", tmpDir, filename) // TODO: Is writing to a file necessary?
|
cmd := exec.Command("pandoc", "-s", "--lua-filter=cmd/backend/create_toc.lua", "-f", "docx", "-t", "commonmark_x", "-o", articleFileName, "--extract-media", tmpDir, filename) // TODO: Is writing to a file necessary?
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
return nil, fmt.Errorf("error converting docx to markdown: %v: %v", err, stderr.String())
|
return nil, fmt.Errorf("error converting docx to markdown: %v: %v", err, stderr.String())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user