summaryrefslogtreecommitdiff
path: root/transformations.go
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-26 22:16:03 +0200
committerNicolas Paul <n@nc0.fr>2023-04-26 22:16:03 +0200
commit8ad06294d6d9c7a67a32099e31c93b4f08b9aff2 (patch)
tree02edb46f1f283cca6df8d115c97096d97b1baae6 /transformations.go
parent8f4d8fbc593dfa3dfcf4ad132d01f23cffda360c (diff)
Fix missing outdir bug
crocc was not creating the output directory if it was not present, making it impossible to generate files
Diffstat (limited to 'transformations.go')
-rw-r--r--transformations.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/transformations.go b/transformations.go
index 7053a94..ddf259d 100644
--- a/transformations.go
+++ b/transformations.go
@@ -90,13 +90,12 @@ func TransformMarkdownFile(inputDir, inputFile, outputDir string) error {
renderer := html.NewRenderer(html.RendererOptions{Flags: htmlFlags})
contentHTML := markdown.Render(doc, renderer)
- outputFile, err := os.Create(outputPath)
+ c, err := GenerateHTML(fm, string(contentHTML))
if err != nil {
return err
}
- defer outputFile.Close()
- if err := GenerateHTML(outputFile, fm, string(contentHTML)); err != nil {
+ if err := os.WriteFile(outputPath, c, 0666); err != nil {
return err
}