feat: add DOCX/HTML output, go-tomd reverse converter, and input/output flags

- go-mdtopdf-helper: -format pdf,html,docx; new internal/document writers
  (standalone HTML, pure Go DOCX)
- new go-tomd command converting PDF/HTML/DOCX back to Markdown, skipping
  existing .md files unless -force
- -input/-output on both commands (single file with chosen name, or output
  directory mirroring the scan layout)
- restructure README and build config (Makefile, goreleaser) for both binaries
This commit is contained in:
Hein committed 2026-10-08 17:05:01 +02:00
1 parent 50b7246c21
commit 5bf9c3673d
17 files changed
+1903 -84

No files matched your search

+6 -7
View File
@@ -12,6 +12,10 @@ import (
// RunAsHook converts the staged Markdown files and stages the generated output.
func (c *Converter) RunAsHook() error {
if c.InputFile != "" || c.Output != "" {
return fmt.Errorf("-input and -output cannot be combined with -hook")
}
if !confirmConversion() {
fmt.Println("Skipping conversion")
return nil
@@ -64,14 +68,9 @@ func stagedMarkdownFiles() ([]string, error) {
}
func (c *Converter) stageGeneratedFiles(files []string) error {
formats := c.Formats
if len(formats) == 0 {
formats = []string{FormatPDF}
}
for _, file := range files {
for _, format := range formats {
out := filepath.FromSlash(outputPath(file, format))
for _, format := range c.formats() {
out := filepath.FromSlash(c.outputFor(file, format))
if err := exec.Command("git", "add", out).Run(); err != nil {
fmt.Printf("Warning: Could not stage %s\n", out)
}