Skip to content
/ go-enex Public

(unenex) Convert Evernote's export file(*.enex) into HTML and images

License

hymkor/go-enex

Repository files navigation

GoDoc

Go-enex & Unenex

Convert Evernote's export file(*.enex) into HTML(or markdown) and images.

  • go-enex : the package for Go
  • unenex : the executable using go-enex

How to use Unenex

Install

Download the binary package from Releases and extract the executable.

Use go install

go install github.com/hymkor/go-enex/cmd/unenex@latest

Use scoop-installer

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

Usage

$ 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.

Library for Go

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)
    }
}

FAQ

Q. Sometimes attachments are not exported

Evernote has multiple variations of the .enex export format, and some versions may use structures that go-enex does not yet handle correctly.

If you encounter this problem and are able to provide an example .enex file that reproduces it (with sensitive content removed if necessary), please open an issue and share it.
While I cannot guarantee immediate support for all .enex variations, I will do my best to make go-enex compatible.

Release notes

Acknowledgements

Author

License

MIT License

About

(unenex) Convert Evernote's export file(*.enex) into HTML and images

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •