Kevin Schoon 4 years ago
104 commits
18450425 18450425d75b8f414dd30f3ad14dc082239002ed
remove docker files
File Commit Size Mode Time
.dockerignore add dockerfiles & supporting scripts 8 B -rw-r--r-- 4 years ago
.gitignore rm excess build tooling 16 B -rw-r--r-- 4 years ago
.ocamlformat clean up formatting 23 B -rw-r--r-- 4 years ago
LICENSE add LICENSE 33.7 KiB -rw-r--r-- 4 years ago
README.md switch man page generator to scdoc 2.9 KiB -rw-r--r-- 4 years ago
bin switch man page generator to scdoc NaN B d--------- 4 years ago
completion build updates NaN B d--------- 4 years ago
contrib update contrib scripts for sync support NaN B d--------- 4 years ago
doc update docs NaN B d--------- 4 years ago
dune-project refactor note as a (Ezjsonm.t * Omd.t) 28 B -rw-r--r-- 4 years ago
lib add OnSync, populate config show with defaults NaN B d--------- 4 years ago
note.opam build updates WIP 897 B -rw-r--r-- 4 years ago
scripts rm excess build tooling NaN B d--------- 4 years ago
test refactor note to include slug type NaN B d--------- 4 years ago

Note 🐪

Note is a simple CLI based note taking application.

The Anatomy of a Note

A note is a simple markdown document that contains zero or more instances of structured data encoded as YAML or JSON. Notes can optionally contain front-matter at the head of each file, which is YAML or JSON enclosed by a pair of ---.

---
title: This is a Note
tags: [ocaml, programming]
---
# Hello World!
Today will be a nice day.

Configuration

The behavior of note can be configured with yaml file stored in ~/.config/note/config.yaml and configure itself per the XDG Base Directory specification. You can view the resolved configuration by running note config:

state_dir: /home/kevin/.local/share/note
lock_file: /home/kevin/.local/share/note.lock
editor: nvim
on_modification: note_commit.sh

Structured Data

Notes that contain code blocks with structured data as well as front-matter are automatically parsed and exposed via the command API.

Example

note create -stdin <<EOF
# Musical Styles
```yaml
- style: Bomba
influenced:
- style: Plena
- style: Reggaetón
influenced:
- style: Bachatón
```
EOF
# Now let's inspect the code block with jq
note cat -encoding json "Musical Styles" | jq .data[0]
[
{
"style": "Bomba",
"influenced": [
{
"style": "Plena"
},
{
"style": "Reggaetón",
"influenced": [
{
"style": "Bachatón"
}
]
}
]
}
]

The State Directory

Each note is stored as a flat file inside the state_dir with a slug that corresponds to the date (YYYYMMDD) on which it was created. If multiple notes are created on one day, an index will be appended to the file.

$ tree ~/.local/share/note/
/home/kevin/.local/share/note/
├── note-20200818-1.md
├── note-20200819-1.md
├── note-20200819-2.md
└── note-20200819-3.md

Persisting Notes with Git

If the on_modification configuration option is set it will be called each time a note is modified. This feature can be used to automatically commit your notes to a git repository with a script such as below:

#!/bin/bash
# This is an example script that can be used in conjunction with the
# on_modification config option to commit every note change to a git
# repository. You'll need to place it somewhere on your $PATH. This
# script assumes that your state_dir is also a git repository.
set -e
STATE_DIR="$(note config -get state_dir)"
pushd "$STATE_DIR"
git add --all
git commit -m 'automated commit'
popd

Web UI

Notes are stored in a format that is compatible with the static website generator Hugo and thus you can point your state_dir to a Hugo content directory and get a web based interface for all of your notes.

Clone

HTTP

Subscribe

License

AGPL-3.0

Authors

Kevin Schoon: 100%

Analysis