mirror of
https://github.com/mickael-menu/zk
synced 2024-11-15 12:12:56 +00:00
27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
$ cd blank
|
|
|
|
# The default filename is a random ID of 4 lowercase alphanumeric characters, with .md extension.
|
|
$ zk new --dry-run
|
|
2>{{working-dir}}/{{match "[a-z0-9]{4}"}}.md
|
|
|
|
# Set a custom filename.
|
|
$ echo "[note]\n filename = '\{{slug title}} - \{{format-date now \"%m-%d\"}}'" > .zk/config.toml
|
|
$ zk new --title "A new note" --date "January 5th" --dry-run
|
|
2>{{working-dir}}/a-new-note - 01-05.md
|
|
|
|
# Set a custom extension.
|
|
$ echo "extension = 'markdown'" >> .zk/config.toml
|
|
$ zk new --title "A new note" --date "January 5th" --dry-run
|
|
2>{{working-dir}}/a-new-note - 01-05.markdown
|
|
|
|
# Test the filename Handlebars variables.
|
|
$ mkdir "a dir"
|
|
$ echo "[note]\n filename = '\{{title}},\{{content}},\{{format-date now \"%m-%d\"}},\{{json extra}}'" > .zk/config.toml
|
|
$ echo "Piped content" | zk new --interactive --title "A new note" --date "January 5th" --extra key=value --dry-run
|
|
2>{{working-dir}}/A new note,Piped content
|
|
2>,01-05,{"key":"value"}.md
|
|
$ echo "[note]\n filename = '\{{id}},\{{dir}},\{{json extra}},\{{env.ZK_NOTEBOOK_DIR}}'" > .zk/config.toml
|
|
$ echo "Piped content" | zk new --title "A new note" --date "January 5th" --dry-run "a dir"
|
|
2>{{working-dir}}/a dir/{{match "[a-z0-9]{4}"}},a dir,{},{{working-dir}}.md
|
|
|