@ernstwi/days v2.0.1
days
This is a tool for keeping a personal journal in the form of a directory of markdown files. There are two main commands: new
for writing posts, and server
to browse the journal as a webpage.
Journaling on iOS is supported via iMessage import (see days merge
).
Status
⚠️ Note: Version 2.0.0 contains a security fix. Please do not use previous versions.
Please be mindful that this is a small project and that further security issues should be expected.
Directory structure
├── content
│ └── 2020 ....................... year
│ └── 04 ..................... month
│ └── 01 ................. day
│ ├── 12-00-00.md .... hh-mm-ss
│ └── allday.md ...... you can have one untimed post per day,
│ written for example when looking back at
│ some later point in time
├── assets ......................... files in this dir are served from root
│ └── image.jpeg ................. ![an image](/image.jpeg)
│
└── config.json .................... optional configuration file
Install
Install using npm or Homebrew.
$ npm install --global @ernstwi/days
$ brew install ernstwi/tap/days
Usage
All commands assume your current directory is the journal root.
new
Create a new post.
$ days new [--no-edit] [--allday] [<year> <month> <day> [<hour> [<minute> [<second>]]]]
- If no date is given, the current time is used. With
--allday
, an all day post is created. - If a date is given, but no time, an all day post is created.
- Without
--no-edit
, the post opens in$EDITOR
. - With
--no-edit
, the filename is printed to stdout.
server
Start the web server.
$ days server [--port <number>] [--theme <name>]
merge
Import content from another journal, or from iMessage.
$ days merge [--resolve] (<path> | --imessage <ID>)
- Merge posts from a days journal at
<path>
, or from an iMessage conversation with user<ID>
(macOS only). - With
--resolve
, filename collisions on assets are resolved by renaming.
Tip: Set up a dummy Apple ID for the purpose of journaling.
prune
Clean up the content directory, removing empty subdirectories.
$ days prune
Configuration
The root directory may contain a file config.json
with the following keys.
Setting | Default value |
---|---|
title | days |
port | 3004 |
theme | fruchtig |
Themes
Name | Screenshot | Adapted from |
---|---|---|
fruchtig | schickele/vim-fruchtig | |
nachtleben | schickele/vim-nachtleben | |
monochrome | fxn/vim-monochrome |
Adding themes
You can create your own theme by adding a file static/theme/<theme-name>.css
containing definitions for a subset of the following CSS variables.
Name | Type | Fallback value |
---|---|---|
--ui | color | gray |
--content | color | black |
--background | color | white |
--post-footer-fav | color | gold |
--link | color | blue |
--link-hover | color | magenta |
Name | Type | Fallback value |
---|---|---|
--blockquote-border | color | --content |
--day-header | color | --ui |
--day-header-background | color | --background |
--day-header-border | color | --ui |
--figure-border | color | --content |
--footer-diamond | color | --ui |
--link-disabled | color | --ui |
--no-posts | color | --ui |
--no-posts-border | color | --ui |
--post-body | color | --content |
--post-body-hr | color | --content |
--post-edit-bg | color | --background |
--post-edit-border | color | --ui |
--post-edit-fg | color | --content |
--post-edit-submit-background | color | --background |
--post-edit-submit-border | color | --ui |
--post-footer | color | --ui |
--post-footer-hr | color | --ui |
--sidebar-divider | color | --ui |
--sidebar-month | color | --ui |
--sidebar-year | color | --ui |
--start-index-border | color | --ui |
--start-index-border | color | --ui |
--start-year | color | --ui |
Testing
npm run test
: Compile TypeScript and test the resulting JavaScript using Mocha.
To test iMessage merge functionality, you must define the environment variable DAYS_TEST_IMESSAGE
. This value will be used as the recipient of a test message sent using Applescript on each run of the test suite. Note that this means automatically opening the Messages app and sending a message from your logged in user.
If DAYS_TEST_IMESSAGE
is not defined, iMessage merge testing is skipped and no test message is sent.
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago