Skip to content
/ dayone2md Public

A CLI to export Dayone to Markdown

License

Notifications You must be signed in to change notification settings

kwo/dayone2md

Repository files navigation

Dayone To Markdown

TODO

Export Dayone to Markdown.

tag Go Version GoDoc Go report Contributors License

dayone2md is a CLI application that can create a directory a markdown files from entries in Dayone. Use either a Dayone JSON archive or read directly from the Dayone database. Currently only MacOS is supported.

Features

  • Input sources:
    • JSON export archive
    • read directly from the Dayone database
  • Photos: download embedded photos and rewrite photo links
  • Wikilinks: rewrite links to other entries as wikilinks
  • Templates: supports external templates
  • Title: separate out first line of posts as a title to format as desired
  • In-place updates to output folder
  • Conditional updates: only write files to output folder that differ from source
  • Option to keep files in the output folder that do not exist at the source
  • Flag to group posts by day in a single file
  • Flag to alter sort order within day when grouped by day
  • Installation: static binary without dependencies on external libraries

🚀 Install

brew install kwo/tools/dayone2md

💡 Usage

Usage:
  dayone2md [OPTIONS]

Application Options:
  -j, --journal=      journal name to export
  -i, --input=        input file, either the DayOne.sqlite database file or the JSON export zip file
  -o, --output=       output directory
  -t, --template=     name of the template to use, either the path of an external template file or the name of a built-in template: main or
                      full (default: main)
  -g, --group         group entries by day, one file per day, multiple entries per file
  -r, --reverse       reverse chronological sort order for entries within a file, useful only if entries are grouped by day
      --keep-orphans  do not remove files in the output directory that lack a matching entry in the input file
      --version       print version and exit
  -v, --verbose       show verbose output, list multiple times for even more verbose output

Help Options:
  -h, --help          Show this help message

Example Usage

dayone2md -i "$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite" -o $HOME/Documents/Journal -j Journal -g -vv

OR

dayone2md -i "$HOME/Desktop/09-07-2023_8-30-PM.zip" -o $HOME/Documents/Journal -j Journal -g -vv

Input Sources

JSON Export archive

Follow these instructions to export entries from the Dayone app to a JSON archive.

Then, use the archive location as the import source, for example:

dayone2md -i "$HOME/Desktop/09-07-2023_8-30-PM.zip" ...

Database

The Dayone database on a Mac is located at

$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite

To export entries directly from the database, use this location as the import source, like this:

dayone2md -i "$HOME/Library/Group Containers/5U8NS4GX82.dayoneapp2/Data/Documents/DayOne.sqlite" ...

The database is opened in readonly mode and an export can be performed while the Dayone app is open. Also, note that for premium users that are synchronizing data from multiple devices, the Dayone app must be run once before exporting to retrieve entries from the Dayone cloud service.

Disclaimer: be careful by keeping a backup of your data. As stated in the license, this software assumes no liability for data loss.

🧑‍💻 development

once:

brew install goreleaser golangci-lint
go install -v golang.org/x/vuln/cmd/govulncheck@latest

ongoing:

goreleaser release --clean --snapshot
./dist/dayone2md_darwin_arm64/dayone2md --version -vv

similar projects