DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Joplin Notes


笔记软件要求

  • 跨平台:Linux, Winodws, Android;

  • 实时同步;

  • 无设备数限制;

  • 支持 markdown 和 mathjax;

  • 文本编辑器支持 vi-mode,或者外部编辑器保存文件后能实时预览;

  • 实时预览,或至少方便地在预览和编辑状态间切换;

  • 对中文支持好;

  • 有命令行接口:重复性不太强的工作可以用它完成,例如修改tag,创建时间等;

  • 暗色调界面;

  • 对键盘操作支持好;

  • 方便导出纯文本数据文件;

  • 有 Python 或者 REST API(用于批量更新元数据或者自定义功能定制);

Terminal

命令行版本数据文件默认保存在 ~/.config/joplin 目录下。

命令行版本对键盘操作支持好,可以同时开多个实例并实时同步 (GUI版本如果有一个实例运行,再启动时会跳到已有的实例), 缺点是没有笔记预览功能,无法插入图片(GUI版本中可以直接从剪贴板粘贴)。

Joplin terminal 支持两种风格:

  • Shell 风格一次性执行命令,例如 jop config sync.target 2. 使用 jop help all 列出所有命令格式,用 jop help config 列出某个命令的帮助;

  • TUI 风格类似于 vi,默认处于 Normal 模式下,执行命令时用分号(默认值是冒号)作为命令前缀, 例如 :config sync.target 2.

只能在 TUI 模式下进行全文搜索,shell 模式下的 ls 命令支持按文件名匹配, 例如列出所有名字以 2019 开头的笔记:jop ls '2019*'.

用户手册:https://joplinapp.org/terminal/

Install, Update and Basic Usage in Shell Mode

首先用 asdf 安装 node,然后执行

$ NPM_CONFIG_PREFIX=~/.joplin-bin npm install -g joplin  // for both installation and update
$ echo 'alias jop=$HOME/.joplin-bin/bin/joplin' >> ~/.bash_aliases
$ cat << EOF > $HOME/.config/joplin/keymap.json
[
    { "keys": [";"], "type": "function", "command": "enter_command_line_mode" },
    { "keys": ["k"], "type": "function", "command": "move_up" },
    { "keys": ["j"], "type": "function", "command": "move_down" },
    { "keys": ["l"], "type": "function", "command": "focus_next" },
    { "keys": ["q"], "type": "function", "command": "exit" },
    { "keys": ["h"], "type": "function", "command": "focus_previous" }
]
EOF

$ jop config sync.target 2
$ jop config sync.2.path /home/leo/Documents/Dropbox/Apps/Joplin
$ jop config editor     # show current value
$ jop config editor nvim
$ jop config dateFormat YYYY-MM-DD
$ jop mkbook Diary      # add a new notebook
$ jop ls /              # list notebooks, `jop help ls` for full docs
$ jop use Diary         # set the current notebook
$ jop mknote 2019.5.21  # optional, you can `edit` an nonexisting note directly
$ jop edit 2019.5.21
$ jop sync
$ jop cat 2019.5.21     # only print the contents of the note
$ jop cat -v 2019.5.21  # print note contents and metadata (creating and updating date, etc)
$ jop tag list          # list all tags
$ jop tag list training # list all notes with tag 'training'
$ jop ls -l -n 5 -s updated_time  # list last updated 5 notes
$ jop set fe889 title "New title" # modify note title, 'fe889' is from `ls` command
$ jop export --note <node-id> --format md <output-dir>
$ jop import papers.md Tech       # import from file papers.md into notebook 'Tech'
$ jop version           # show version

You can get the in export command in TUI mode with metadata displayed (use tm to toggle metadata). And output in export command is a folder name, where joplin put the exported note in.

2020.9.1 更新:

Install node.js with homebrew instead of asdf:

brew install node
sudo apt install libsecret-1-dev
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
NPM_CONFIG_PREFIX=~/.joplin-bin npm install -g joplin

The installation process is much faster with sshuttle.

In TUI Mode

Start joplin with jop.

Wrtie a new note: :mknote "my note name" and press on the note panel.

Modify metadata of a note:

  1. Search the note with :search <title>

  2. Add tag to the note: :tag add wesnoth $n ( $n means current note);

  3. Modify created time of the note: :set $n user_created_time 1470268800000 (run Date.parse('2016-08-04') in node.js REPL to get the timestamp 1470268800000)

Shortcuts

  • Sync: :sync;

  • Quit: Ctrl-d;

  • Search: /;

  • Edit note: Enter;

  • toggle console: tc;

  • make a new note: mn, or :mknote

  • toggle metadata: tm;

Export

Joplin can be exported to several formats:

  • raw: export to a folder, each note to a markdown file, with contents and metadata;

  • jex: Joplin Export File, default format, a big binary file

  • markdown: export to a folder, each notebook to a subfolder, each note to a markdown file with only contents, no metadata;

  • json: export to a folder, each note to a json file (no subfolder), with contents and metadata; For "type_" field, 1 means a "note", 5 means a "tag", 6 means "relation".

常用命令:joplin export jopbackup0203.jex

Import

如果当前 Joplin 中已有数据,直接导入 jex 文件不会覆盖原来的 notebook, 而是会生成一个名字为原来名字后面加上 (1) 这样的 notebook, 所以先到 ~/.config/joplin 目录下删除 database.sqlite, log 以及 resources 文件夹, 再执行 joplin import jopbackup0203.jex。

API

apt install httpie
http localhost:41184/ping  # test REST server
http -b 'localhost:41184/tags?fields=id,title'   # List all tags with id and name

GUI



Published

Nov 23, 2018

Last Updated

Sep 1, 2020

Category

Tech

Tags

  • joplin 1
  • note-taking 1

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor