├── tests ├── fixtures │ ├── 6421460b.md │ ├── 64217712.md │ ├── 642146c7.md │ ├── nonhex8.md │ ├── 642176a6.md │ ├── 64214930.md │ ├── 64218087.md │ ├── 64214a1d.md │ └── 64218088.md ├── wrap.awk ├── helpers.sh ├── extract.bats ├── weekly │ ├── weekly.bats │ ├── weekly.sh │ ├── weekly.txt │ ├── weekly.vim │ └── weekly.js ├── stats.bats ├── new.bats ├── orphan2.bats ├── orphan1.bats ├── cli.bats ├── runtime.bats ├── web.bats ├── links.bats ├── lines.bats ├── delete.bats ├── raw.bats └── write.bats ├── .gitignore ├── web ├── graph │ ├── .gitignore │ ├── tailwind.input.css │ ├── tailwind.config.js │ ├── make.sh │ └── README.md ├── app │ ├── .gitignore │ ├── tailwind.input.css │ ├── tailwind.config.js │ ├── state.js │ ├── favicon.svg │ ├── alert.js │ ├── dateutils.js │ ├── empty.js │ ├── settings.js │ ├── link-tree.js │ ├── pane.js │ ├── make.sh │ ├── settings-stats.js │ ├── periodic.js │ ├── settings-keybinds.js │ ├── confirm.js │ ├── preview.js │ ├── cm-vim.js │ ├── note-statusbar.js │ ├── ribbon.js │ ├── nav-tabs.js │ ├── finder.js │ ├── index.html │ ├── datepicker.js │ ├── note-sidebar.js │ ├── graph-panel.js │ ├── graph-d3.js │ └── cm-table.js └── index.html ├── go.mod ├── .github └── workflows │ ├── helpers │ ├── run-tests.sh │ ├── install-deps.sh │ ├── release-notes.sh │ └── build-bin.sh │ ├── pr.yml │ └── main.yml ├── heartbeat.go ├── LICENSE ├── finder.go ├── sort.go ├── completion.bash ├── contrib ├── xdg-urxvt-nvim.sh └── ctimehex.sh ├── filter.go ├── version_test.go ├── runtime.go ├── version.go ├── cache.go ├── highlight.go ├── filter_test.go ├── vim └── doc │ └── notesium.txt └── go.sum /tests/fixtures/6421460b.md: -------------------------------------------------------------------------------- 1 | # book 2 | -------------------------------------------------------------------------------- /tests/fixtures/64217712.md: -------------------------------------------------------------------------------- 1 | # empty note 2 | -------------------------------------------------------------------------------- /tests/fixtures/642146c7.md: -------------------------------------------------------------------------------- 1 | # physicist 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | vim/doc/tags 3 | notesium 4 | -------------------------------------------------------------------------------- /web/graph/.gitignore: -------------------------------------------------------------------------------- 1 | tailwind.css 2 | d3.min.js 3 | -------------------------------------------------------------------------------- /tests/fixtures/nonhex8.md: -------------------------------------------------------------------------------- 1 | # non-hex8 note filename 2 | 3 | -------------------------------------------------------------------------------- /web/app/.gitignore: -------------------------------------------------------------------------------- 1 | .vendor/ 2 | vendor.js 3 | vendor.css 4 | tailwind.css 5 | -------------------------------------------------------------------------------- /tests/wrap.awk: -------------------------------------------------------------------------------- 1 | { print "[", "\"${lines[" FNR-1 "]}\"", "==", "\"" $0 "\"", "]" } 2 | -------------------------------------------------------------------------------- /web/app/tailwind.input.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /web/graph/tailwind.input.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /tests/fixtures/642176a6.md: -------------------------------------------------------------------------------- 1 | # lorem ipsum 2 | 3 | lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 4 | tempor incididunt ut labore et dolore magna aliqua. 5 | -------------------------------------------------------------------------------- /tests/fixtures/64214930.md: -------------------------------------------------------------------------------- 1 | # quantum mechanics 2 | 3 | a fundamental theory in physics that provides a description of the 4 | physical properties of nature at the scale of atoms and subatomic 5 | particles. 6 | -------------------------------------------------------------------------------- /web/graph/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ["*.html"], 4 | darkMode: 'class', 5 | theme: { 6 | extend: {}, 7 | }, 8 | plugins: [], 9 | } 10 | -------------------------------------------------------------------------------- /web/app/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ["*.js", "!vendor.js", "!tailwind.config.js"], 4 | darkMode: 'class', 5 | theme: { 6 | extend: {}, 7 | }, 8 | plugins: [], 9 | } 10 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |If you are not redirected, click here.
9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/helpers.sh: -------------------------------------------------------------------------------- 1 | flunk() { 2 | if [[ "$#" -eq 0 ]]; then cat -; else echo "$*"; fi 3 | return 1 4 | } 5 | 6 | assert_line() { 7 | local line 8 | for line in "${lines[@]}"; do [[ "$line" == "$1" ]] && return 0; done 9 | flunk "expected line \"$1\"" 10 | } 11 | 12 | -------------------------------------------------------------------------------- /tests/fixtures/64218087.md: -------------------------------------------------------------------------------- 1 | # surely you're joking mr. feynman 2 | 3 | excellent [book](6421460b.md) by [richard feynman](64214a1d.md) and [ralph leighton](12345678.md). 4 | one of my favorite quotes: 5 | 6 | > you have no responsibility to live up to what other people think you 7 | > ought to accomplish. I have no responsibility to be like they expect 8 | > me to be. It's their mistake, not my failing. 9 | -------------------------------------------------------------------------------- /tests/fixtures/64214a1d.md: -------------------------------------------------------------------------------- 1 | # richard feynman 2 | 3 | richard phillips feynman was an american theoretical [physicist](642146c7.md), 4 | known for his work in the path integral formulation of 5 | [quantum mechanics](64214930.md), the theory of quantum electrodynamics, 6 | the physics of the superfluidity of supercooled liquid helium, as well 7 | as his work in particle physics for which he proposed the parton model. 8 | 9 | -------------------------------------------------------------------------------- /tests/fixtures/64218088.md: -------------------------------------------------------------------------------- 1 | # albert einstein 2 | 3 | albert einstein was a german-born theoretical [physicist](642146c7.md), 4 | widely acknowledged to be one of the greatest and most influential 5 | physicists of all time. einstein is best known for developing the 6 | [theory of relativity](xxxxxxxx.md), but he also made important contributions 7 | to the development of the theory of [quantum mechanics](64214930.md). 8 | 9 | -------------------------------------------------------------------------------- /tests/extract.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load helpers.sh 4 | 5 | setup_file() { 6 | export NOTESIUM_DIR="$BATS_TEST_DIRNAME/fixtures" 7 | export PATH="$(realpath $BATS_TEST_DIRNAME/../):$PATH" 8 | } 9 | 10 | @test "extract: list files" { 11 | run notesium extract 12 | echo "$output" 13 | [ $status -eq 0 ] 14 | assert_line "completion.bash" 15 | assert_line "web/app/index.html" 16 | } 17 | 18 | @test "extract: print file content" { 19 | run notesium extract web/app/index.html 20 | echo "$output" 21 | [ $status -eq 0 ] 22 | [ "${lines[0]}" == "" ] 23 | } 24 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/alonswartz/notesium 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/charlievieth/fastwalk v1.0.9 // indirect 7 | github.com/gdamore/encoding v1.0.1 // indirect 8 | github.com/gdamore/tcell/v2 v2.8.1 // indirect 9 | github.com/junegunn/fzf v0.58.0 // indirect 10 | github.com/junegunn/go-shellwords v0.0.0-20240813092932-a62c48c52e97 // indirect 11 | github.com/lucasb-eyer/go-colorful v1.2.0 // indirect 12 | github.com/mattn/go-isatty v0.0.20 // indirect 13 | github.com/mattn/go-runewidth v0.0.16 // indirect 14 | github.com/rivo/uniseg v0.4.7 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/term v0.28.0 // indirect 17 | golang.org/x/text v0.21.0 // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /tests/weekly/weekly.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | setup_file() { 4 | command -v nvim >/dev/null 5 | command -v node >/dev/null 6 | cd $(realpath $BATS_TEST_DIRNAME/) 7 | [ -e "weekly.txt" ] 8 | export WEEKLY_DATES="$(echo $(cat weekly.txt | cut -d' ' -f1))" 9 | } 10 | 11 | @test "weekly: bash" { 12 | run ./weekly.sh $WEEKLY_DATES 13 | echo "$output" 14 | [ $status -eq 0 ] 15 | diff <(echo "$output") weekly.txt 16 | } 17 | 18 | @test "weekly: vim" { 19 | run nvim -Es -c 'source ./weekly.vim' -c "RunWeeklyTest $WEEKLY_DATES" 20 | echo "$output" 21 | [ $status -eq 0 ] 22 | diff <(echo "$output") weekly.txt 23 | } 24 | 25 | @test "weekly: js" { 26 | run node ./weekly.js $WEEKLY_DATES 27 | echo "$output" 28 | [ $status -eq 0 ] 29 | diff <(echo "$output") weekly.txt 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/stats.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | setup_file() { 4 | export NOTESIUM_DIR="$BATS_TEST_DIRNAME/fixtures" 5 | export PATH="$(realpath $BATS_TEST_DIRNAME/../):$PATH" 6 | } 7 | 8 | @test "stats: default" { 9 | run notesium stats 10 | echo "$output" 11 | [ $status -eq 0 ] 12 | [ "${lines[0]}" == "notes 8" ] 13 | [ "${lines[1]}" == "labels 2" ] 14 | [ "${lines[2]}" == "orphans 2" ] 15 | [ "${lines[3]}" == "links 7" ] 16 | [ "${lines[4]}" == "dangling 1" ] 17 | [ "${lines[5]}" == "lines 28" ] 18 | [ "${lines[6]}" == "words 213" ] 19 | [ "${lines[7]}" == "chars 1396" ] 20 | } 21 | 22 | @test "stats: table" { 23 | run notesium stats --table 24 | echo "$output" 25 | [ $status -eq 0 ] 26 | [ "${lines[0]}" == "notes 8" ] 27 | [ "${lines[7]}" == "chars 1396" ] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/helpers/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | SCRIPT_NAME="$(basename "$0")" 5 | fatal() { echo "[$SCRIPT_NAME] FATAL: $*" 1>&2; exit 1; } 6 | info() { echo "[$SCRIPT_NAME] INFO: $*"; } 7 | 8 | usage() { 9 | cat<{{ filteredItems.length }}/{{ itemsLength }}
18 |