Convert Evernote's export file(*.enex) into HTML(or markdown) and images.
go-enex
: the package for Gounenex
: the executable using go-enex
Download the binary package from Releases and extract the executable.
go install github.com/hymkor/go-enex/cmd/unenex@latest
scoop install https://raw.githubusercontent.com/hymkor/go-enex/master/unenex.json
or
scoop bucket add hymkor https://github.com/hymkor/scoop-bucket
scoop install unenex
$ unenex {options} {ENEX-FILENAME.enex}
Available Options
-d directory
: Specifies the output directory (default is the current directory"."
).-markdown
: Outputs the content in shrinked markdown format.-sf path
: Specifies the path to a stylesheet file.-st stylesheet
: Specifies the stylesheet directly as a string.-v
: Enables verbose mode to display additional information during execution.-web-clip-only
: Outputs only the web-clip content, removing Evernote-specific styling and non-web-clip elements.
package main
import (
"fmt"
"io"
"os"
"github.com/hymkor/go-enex"
)
func mains() error {
data, err := io.ReadAll(os.Stdin)
if err != nil {
return err
}
notes, err := enex.Parse(data, os.Stderr)
if err != nil {
return err
}
for _, note := range notes {
html, bundle := note.Extract(nil)
baseName := bundle.BaseName
err := os.WriteFile(baseName+".html", []byte(html), 0644)
if err != nil {
return err
}
fmt.Fprintf(os.Stderr, "Create File: %s.html (%d bytes)\n", baseName, len(html))
if len(bundle.Resource) > 0 {
fmt.Fprintf(os.Stderr, "Create Dir: %s", bundle.Dir)
os.Mkdir(bundle.Dir, 0755)
for fname, rsc := range bundle.Resource {
data, err := rsc.Data()
if err != nil {
return err
}
fmt.Fprintf(os.Stderr, "Create File: %s (%d bytes)\n", fname, len(data))
os.WriteFile(fname, data, 0666)
}
}
}
return nil
}
func main() {
if err := mains(); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
}
MIT License