GithubHelp home page GithubHelp logo

zk-org / zk Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 106.0 1.3 MB

A plain text note-taking assistant

Home Page: https://zk-org.github.io/zk/

License: GNU General Public License v3.0

Go 99.60% Makefile 0.40%
cli notes second-brain wiki zettelkasten

zk's People

Contributors

artoj avatar bibor avatar codito avatar dependabot[bot] avatar dstanberry avatar dutrieuc avatar hugginsio avatar julio-lopez avatar jupblb avatar kabouzeid avatar khimaros avatar kluen avatar leiserfg avatar lsvmello avatar matze avatar mcdevnagh avatar mhanberg avatar mickael-menu avatar nelyah avatar pkazmier avatar psanker avatar pstuifzand avatar rahlir avatar rktjmp avatar skbolton avatar srid avatar sumit-sahrawat avatar tjex avatar wrvsrx avatar zalegrala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zk's Issues

Link hrefs are not finding the best match

Link hrefs are matched as a prefix of a note path, however this fails when several notes use the same prefix. For example, in the docs/ notes a template href might match the file path template-creation.md instead of template.md.

It can be reproduce by following a WikiLink [[template]] with the LSP server.

Disable mouse in fzf

Hi! I would like to disable the mouse interaction when invoking fzf and be able to select text with the mouse. fzf already got an option for that, "--no-mouse", but I don't know how to make zf to call fzf with that option.

Can you help me? Thanks!

Allow escaped pipe in wikilink

When using the Wikilink syntax inside of a markdown table the pipe character has to be escaped to prevent it becoming a new column. Currently the LSP server doesn't seem to allow for the escape character and reports a broken link prevent the use of wikilinks in tables.

A B
Escaped [[www.duckduckgo.com|search engine]]
Not Escaped [[www.duckduckgo.com

Supporting YAML frontmatters for metadata

Many Zettelkasten use a YAML frontmatter to provide note metadata, e.g.:

---
title: Improve the structure of essays by rewriting
date: 2011-05-16 09:58:57
keywords: [writing, essay, practice]
---

zk only supports title, we should support the rest as well:

  • date for the creation date
  • keywords and tags for tags
  • unknown keys could be saved and indexed for targeted search

Neuron also supports unlisted: true which could be interesting to disable indexing of particular notes.

Groups not working with flag --working-dirrectory

For journal organisation I create group diary.

[group.diary]
paths = ["journal/diary"]

[group.diary.note]
filename = "{{date now}}"
template = "diary.md"
extension = "md"

If I use command zk new journal/diary it works fine BUT it should be .zk dir in cwd. So if I need run the command from different directory I can't do it without creating .zk. The solution is -W dirname flag. When I use it zk used .zk from dirname but does not use group config.
How to fix it?

Problems building with sqlite3

Hello, thank you for your work with these scripts. I encountered a couple issues when trying to build the most recent version (and same with 0.4.0).

  1. This might be more of an ubuntu/golang thing, but I initially had to do some hunting to find a missing library, it's part of icu-dev but it wants a specific version which is older and tough to find:
    ./zk: error while loading shared libraries: libicuuc.so.63: cannot open shared object file: No such file or directory Versions close to 63 seemed to be replaceable by just creating symlinks, but obviously not ideal.

  2. Once I got over that, started getting sqlite3 errors about missing the fts5 module:
    zk: error: open failed: failed to migrate the database: database migration failed: no such module: fts5
    I tried rebuilding sqlite3 (bin and go-sqlite3) with the fts5 module enabled, was able to get a successful build but still didn't fix the error, which occurs anytime trying to init or access the db file in a folder. I got this same error when trying to use the pre-built binaries.

Any idea how to get it compiled with the fts5 and icu enabled sqlite? Any chance you could release a docker image? I'll contribute to the repo once I get it running, thanks!

Ubuntu 20.10
go version go1.16.5 linux/amd64
/home/linuxbrew/.linuxbrew/Cellar/sqlite/3.35.5.reinstall (12 files, 5MB)
go-sqlite3   v1.14.7

Feature request: passing lists in `[extra]`

I like something like this:

[group.activities]
paths=["activities"]

[group.activities.note]
filename = "{{id}}-{{slug title}}"
extension = "md"
template="activities.md"

[group.activities.extra]
author = "Me"
keywords = ["activities", "really stuff"]

and in template:

keywords: {{group.extra keywords]]

But it gives me an error

Ability to use XDG_CONFIG_HOME path for ZK's config and templates

Hey there @mickael-menu!

I was recently alerted to this project by @evantravers and am super excited to dive in!

One thing I've been trying to do with my dotfiles and my system setup in general, is to move everything config-wise to XDG_CONFIG_HOME (~/.config/). I see there looks to be some flexibility for path in zk.go where you're joining that given path with a fixed .zk dir for those config items. I'm a little bit confused on what the .zk/ path is relative to.

Any thoughts around this as an option?

Thanks again for such a wonderful tool!

Local notebook configuration should be optional

Only the presence of the .zk directory should be mandatory to mark a directory as a notebook.


@mickael-menu quick question around global config/templates (https://github.com/mickael-menu/zk/blob/main/docs/config.md#global-configuration-file)..

there still seems to be a requirement that a config.toml exist in your notebook's directory (even the notebook defined in the ZK_NOTEBOOK_DIR; is this expected behaviour?

thanks!

Originally posted by @megalithic in https://github.com/mickael-menu/zk/issues/10#issuecomment-808359417

alias is not known/executed if -W option is given first

i have initialized a notebook at ~/notes and running the command zk ls -W ~/notes, on a different directory, returns the correct output (all the notes in oneline format).
however, running the command zk -W ~/notes ls returns the following with an exit code of 1

Usage: zk <command>

NOTEBOOK
  A notebook is a directory containing a collection of notes

  init     Create a new notebook in the given directory.
  index    Index the notes to be searchable.

NOTES
  Edit or browse your notes

  new     Create a new note in the given notebook directory.
  list    List notes matching the given criteria.
  edit    Edit notes matching the given criteria.

Flags:
  -h, --help                 Show context-sensitive help.
      --notebook-dir=PATH    Turn off notebook auto-discovery and set manually
                             the notebook where commands are run.
  -W, --working-dir=PATH     Run as if zk was started in <PATH> instead of the
                             current working directory.
      --no-input             Never prompt or ask for confirmation.

Run "zk <command> --help" for more information on a command.

zk: error: unexpected argument ls, did you mean "list"?

here is my ~/notes/.zk/config.toml

[note]
template = "default.md"

[extra]


[format.markdown]
hashtags = true
colon-tags = false
multiword-tags = false

[tool]


[lsp]


[lsp.diagnostics]
dead-link = "error"

[filter]


[alias]
journal = "zk new journal -g journal --no-input"
ls = "zk list --format oneline $@"

[group.journal]


[group.journal.note]
filename = "{{date now}}"
template = "journal.md"

moreover, if i use the command zk -W ~/notes list --format oneline, it returns the same output as zk ls -W ~/notes. native commands such as new, edit, and list seems to be working fine regardless of the position of the -W option.

i have also tried removing the $@ from the ls alias in my ~/notes/.zk/config.toml and i still get the same results. the output is also quite similar if i test the journal alias with the last line being zk: error: unexpected argument journal instead.

is this the intended behavior that zk aliases wont work if the -W <path> option is given first before the alias?

i found out this behavior since i wanted to create a shell alias (alias zknotes="zk -W ~/notes") but it turns out that it will not work properly if i used zk aliases as well.

Notes with broken relative paths are excluded from operations

I've been rearranging some notes so I can use emanote and zk together and I think I've found a bug in the link validation. I'm moving notes found in a subfolder into the root so I can avoid path mismatches. Notes in the subfolder which references relative paths ex: [This is a link](../my-note.md) once moved to the root aren't included in results anymore.

It took me a while to notice because the warning displays after you return from the list command, and is shown on the previous command prompt. Maybe this is intended, but I didn't expect broken links to prevent finding the note, I was intending to first move files and then fix links and was finding that nothing that I moved was 'present' anymore. In fact, it would be super nice if 'invalid link' were a search term that I could look for mistakes and edit them.

Utility command: Generate a new ID

I would like a command (and perhaps it's also exposed over LSP?) to generate a new ID following the configuration. My use case is importing old notes from other software / random text files strewn about my system. They don't have an ID and I'd like to add one to them.

For now, duplicating the configuration into a separate script is my solution but I think it would nice to include in zk itself.

Something like this? (Assuming you've configured neuron-compatible IDs)

$ zk util id
a65c8b45d

Providing a Language Server (LSP)

zk can provide a basic integration with any LSP-compatible text editor by shipping a Language Server.

PR #21 implements a proof of concept server showing promising results, but there's more to come:

  • Links

    • Auto-complete internal Markdown links with [[
    • Auto-complete the path portion of a Markdown link with [custom title]((
    • User configuration to specify the link format using a template
    • Open a note from an inline Markdown link or WikiLink (document link when supported and go to definition as an alternative)
    • Open a website from an inline external Markdown link (with textDocument/documentLink)
    • Open a reference link
    • Move the caret to the next link in the note with a code action, for quick navigation (with window.showDocument)
    • Preview the content of a linked note with a hover
    • Diagnostic (error) to show dead links
    • Diagnostic (hint) to show the title of a linked note next to the link
    • Browse backlinks with find references
    • Browse backlinks / outbound links with a tree-like call hierarchy (client support is still lacking)
    • Highlight WikiLinks using semantic tokens (client support is still lacking)
    • (Maybe?) Report DocumentLink for unlinked mentions, using aliases metadata
  • Tags

    • Auto-complete tags with # and : trigger characters
    • Rename a tag with a refactor code action
    • Highlight tags using semantic tokens (client support is still lacking)
    • View the list of all the notes for a particular tag when running the References action.
  • Notes

    • Code action to create (and link) a new note using the current selection as its title
    • Code action to create (and link) a new note using the current selection as its content (refactor.extract?)
    • Code action to rename the note title
    • User configuration to declare dynamic code actions to generate notes with custom group / template
    • Snippet support using zk templates
  • Expose zk commands as LSP commands, for easy client-side consumption

    • zk.init to create a new notebook
    • zk.index to index a notebook manually
    • zk.new to create a new note
    • zk.list to search for notes (returning a JSON)
    • zk.tag.list to return the list of tags
    • zk.info to provide detailed JSON metadata about a notebook (list of groups, templates, dirs, etc.)
  • Other

    • Optimizations for large (10k+) notebooks (esp. completion)

Feel free to share more ideas!

Allow extra frontmatter

It appears through some light testing that if there are any frontmatter tags that aren't from zk itself a note won't get indexed. Ref: https://github.com/mickael-menu/zk/blob/main/docs/note-frontmatter.md

I'm trying out zk with an emanote site and by default all notes show up in the directory tree. You can hide a note by setting a front matter for order. This works but I've found adding this to my default template prevents zk from finding these notes. Interestingly, if I have already indexed the note then add the new frontmatter things continue to work as expected. I presume it's not getting updates, but still knows about the original title.

Seem like an unknown frontmatter should probably just be ignored, or counted as a warning but still processed. I think it's going to be common for things like Emanote and Gollum to have some extra info that zk won't care about.

zk does not recognize my Wiki link template with a pipe

Here is part of my configuration:

[note]
filename = "{{slug title}}.{{id}}"

[format.markdown]
link-format = "[[{{metadata.id}}|{{title}}]]"

This generates a text link from the LSP something like this:

[[ker6z|Terms of Gardening]]

But it does not get recognized as an actual link to the note:

$ zk list -l Digital\ Garden/terms-of-gardening.ker6z.md
Found 0 note

My intention with the template is to be able to link to a template without worrying what its filename is as well as enabling custom link text in the source document to allow better flow in whatever context it is in.

For me, when "wiki" is listed as a supported link style, I expected nearly-full support of MediaWiki's link syntax but it seems it's much simpler then that. Could this feature be added?

Support links to non existent notes

A portion of one of my notebooks is reserved as a dev notebook where I store snippets and things I want to remember. What I'll often do is link to a note like [[sql]]. I usually don't create these "topic" notes but instead use them as something to query on. Or in Obsidian they still show up in the graph views even though they don't exist.

I tried to take my existing notebook and make it work with zk but one issue has occurred. When I do something like zk list --link-to=sql I get errors because the sql path doesn't exist. At first I was hoping it could still find the notes that link to that non existent note. I can always go through and create these "topic" notes but I think then I just have notes that litter my search results when I am doing --match queries or other non relational lookups.

I can always change my workflows or listen to feedback on different ways of doing things, interested in your thoughts on this.

Terminal borked when piping content to Vim

When setting vim for the editor, the terminal is borked after creating a note with a piped input:

$ echo borking | zk new
Vim: Warning: Input is not from a terminal

This works fine with Neovim though (editor = nvim).

Most likely caused by spawning Vim with the same stdin as zk. Could be fixed by running Vim with vim file </dev/tty.

Adding zk to `nixpkgs`

Just wanted to let you know, I'm adding zk to nixpkgs so it can be installed directly on NixOS, since there seems to be interest by others in using is on that OS.

There is a PR already open for it and awaiting review. I'll be keeping the package up to date there, should I miss a release just ping me and I'll bump the version.

Incompatibility with neuron

When I try to link from a note in a subdirectory (e.g., journal/) to a note in the root directory, zk (its LSP support) wants to create a link of the form [[../abcd]]. Neuron doesn't resolve this correctly, and renders it as a non-existing link. It does work correctly if the link is changed to [[abcd]], which zk's LSP, in turn, doesn't understand and highlights as an error.

Question about debugging notes that might contain issues/errors/etc

@mickael-menu .. while i've been working on zk.nvim, it's shown that a lot of my notes mnight have some sort of issue or issues with their formatting/content/etc. I'm wondering how we might go about debugging these? Thanks!

~/D/_notes                                                                                                                                                                                                                                                                                                                                                                           zk index                                                                                                                                                                                                                                                                                                                                                                          zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       
zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: mapping values are not allowed in this context                                                                                                                                                                                                                                                                                                                   
zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       
zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       zk: warning: yaml: line 4: did not find expected node content                                                                                                                                                                                                                                                                                                                       Indexed 59 notes in 0s                                                                                                                                                                                                                                                                                                                                                                + 43 added                                                                                                                                                                                                                                                                                                                                                                        
  ~ 0 modified                                                                                                                                                                                                                                                                                                                                                                        - 0 removed   

Special characters throw off the YAML frontmatter parser

It looks like using special characters in the YAML frontmatter or note titles might be breaking the indexing.

Ahh, I'm wondering if certain characters in a filename or title might be breaking completion? |, :, and & are command items in some of my note file names and titles (i auto-extract calendar titles and use those from meeting note generation and pass that along to zk.nvim to generate the note, or open an existing note with the same file name).

When searching for a note (using zk edit --interactive via cli, not abstracted out via zk.nvim) that does contain one of the above characters, these are throw into the preview area of fzf:

image

Originally posted by @megalithic in https://github.com/mickael-menu/zk/issues/22#issuecomment-814347167

error while loading shared libraries

I get this on Ubuntu 20.04

zk: error while loading shared libraries: libicuuc.so.63: cannot open shared object file: No such file or directory

I have lib 66 on my system

/usr/lib/i386-linux-gnu/libicuuc.so.66
/usr/lib/i386-linux-gnu/libicuuc.so.66.1
/usr/lib/x86_64-linux-gnu/libicuuc.a
/usr/lib/x86_64-linux-gnu/libicuuc.so
/usr/lib/x86_64-linux-gnu/libicuuc.so.66
/libicuuc.so.66.1

Is it possible to list all defined tags?

I was wondering if it is possible to list all user defined tags, as of now it is
possible to list all notes that include the specified tags; but I'm not sure if
it's possible to list all defined tags.

I want to be able to output all tags as a list so I can feed them as a source
to a picker in my text editor and make sure that I'm using a consistent set of
tags

Thanks

Expanding named filters in path-based filtering options

Named filters are currently expanded only in the path argument of filtering options, e.g.

[filter]
draft = "--tag 'draft OR todo'"
$ zk list draft --interactive

By expanding it in filtering options taking path arguments as well, we open the possibility for easy nested filtering commands. Named filters would become some kind of "virtual directories".

$ zk list --exclude draft

Run commands from outside a notebook directory

There has been some discussions around the best way to manage a global notebook.

Declaring in the global configuration file a default notebook would go against the design of zk in my opinion. A notebook is like a Git repository, with a .zk marker similar to .git.

However, it could be interesting to specify from the command line the notebook where zk commands are run. There is a precedent with Git, which provides --git-dir and --work-tree.

I suggest specifying the path to the notebook with (in order of precedence):

  • --notebook-dir <path>
  • current working directory (or its parents)
  • ZK_NOTEBOOK_DIR env variable

To simplify, any relative path provided as arguments would be relative to the notebook directory (when set explicitly), which allows stuff like:

$ zk list --exclude journal --notebook-dir ~/notes

In practice, that means that someone using a single notebook can set it as a "default global one" with ZK_NOTEBOOK_DIR in ~/.profile.

include filename in the index

Hi, thanks for this awesome tool!

This may be something stupid Im missing, but when I search for a note (eg: zk edit --interactive) I don't get any hits when I search for the filename. For example, if I search for 2021-10-04, I don't get any hits even though I have a daily note called 2021-10-04.md. Is there a way to include the filename in the index?

Thanks!

zk: error: no such function: REGEXP

I've the following directory layout

.
├── journal
│  ├── 2021-06-11.md
│  ├── 2021-06-12.md
│  └── 2021-06-13.md
├── note1.md
├── note2.md
├── note3.md

Using commands that include the directory name journal result in an error though:
List all notes in ./journal

zk list journal
zk: error: no such function: REGEXP

List all notes, excluding ./journal

zk list -x journal
zk: error: no such function: REGEXP

Not sure if this is a misconfiguration or a bug, could you help me out?

Parsing tags

Tags must be parsed from the YAML frontmatter (tags and keywords) and inline with a special syntax. Many syntax flavors exist, let's focus on the most common ones:

  • #hashtags (Bear has #multi words# tags)
  • :colon:separated:tags: (e.g. vimwiki, Org mode)

Are authorized in a tag:

  • unicode categories [L]etter and [N]umber
  • / @ ' % ~ - _ $ % & + = and if possible : #
  • any character escaped with \, including whitespace

To support Bear's #multi words# tags, we continue the parsing if only valid characters + whitespaces are found and we reach a # followed by a non-valid character or whitespace.

#hashtags containing only numbers are invalid, because it's common to use it to number things, like #42.

zk new broken using group

Feel free to adjust my title. I don't know the best way to describe what is broken here.

I have boiled my setup down to as simple as I can make it. I only have a .zk folder in my notebook directory (I removed the one I normally have in ~/.config). Also for good measure I removed $ZK_NOTEBOOK_DIR from my profile.

Quest is my gamification of a journal so its basically the same as the journal example in the docs. Running the following only works if the file for today does not exist.

zk new --group quest Quests

If the file exists it fails with the following error, even when I add the --no-input flag.

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x88374c]

goroutine 1 [running]:
github.com/alecthomas/kong.catch(0xc000995e88)
        /root/go/pkg/mod/github.com/alecthomas/[email protected]/kong.go:398 +0xa5
panic({0x9d9be0, 0xe3f5c0})
        /usr/lib/go/src/runtime/panic.go:1038 +0x215
github.com/mickael-menu/zk/internal/cli/cmd.(*New).Run(0xeaac78, 0xc0001bcf20)
        /home/orlando/zk/internal/cli/cmd/new.go:45 +0x3ac
reflect.Value.call({0x9cd380, 0xeaac78, 0x18}, {0xa543f0, 0x4}, {0xc000422630, 0x1, 0x0})
        /usr/lib/go/src/reflect/value.go:543 +0x814
reflect.Value.Call({0x9cd380, 0xeaac78, 0xb}, {0xc000422630, 0x1, 0x1})
        /usr/lib/go/src/reflect/value.go:339 +0xc5
github.com/alecthomas/kong.callMethod({0xa53c43, 0x3}, {0xa29040, 0xeaac78, 0x3}, {0x9cd380, 0xeaac78, 0x7efc08}, 0xea9f40)
        /root/go/pkg/mod/github.com/alecthomas/[email protected]/callbacks.go:71 +0x4e7
github.com/alecthomas/kong.(*Context).RunNode(0xc0003ee900, 0xc000198460, {0xc000995f60, 0x1, 0x1})
        /root/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:716 +0x40b
github.com/alecthomas/kong.(*Context).Run(0xc0001bd1e0, {0xc000995f60, 0x1, 0x1})
        /root/go/pkg/mod/github.com/alecthomas/[email protected]/context.go:733 +0xa5
main.main()
        /home/orlando/zk/main.go:94 +0x285

Here is the configuration I have for that group

[group.quest]
paths = ["Quests"]

[group.quest.note]
filename = "{{date now}}"
template = "quest.md"

When I changed to tag v0.6.0 using the same config everything works fine so it is something recent.

--no-input doesn't seem to work for `zk init`

If I do zk init --no-input, it still prompts me for the link style and tag style.

It would be nice to have defaults for those so the flag would work so that I can create the "test automation` part of my homebrew-tap, which is required to get the formula submitted to the core repository.

ideally the test would be something like

zk init --no-input
echo "some note" > someid.md
zk index
zk list

# some assertion that it listed the note

Use glow for fzf-preview

I would like to use glow for fzf-preview, but when I try to use it, I just get "Loading" in the preview window, when running zk list -i. I'm not sure what the problem is or how to debug it.

Build fails on Apple Silicon

I was attempting to build the project to try it out and ran into this error sqlite3-binding.c:195315:10: fatal error: 'unicode/utypes.h' file not found.

This is on an M1 Mac running macOS 11.2.3 and go version go1.16.2 darwin/arm64

Full Log
$ ./go install
go: downloading github.com/alecthomas/kong v0.2.16-0.20210209082517-405b2f4fd9a4
go: downloading github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
go: downloading github.com/schollz/progressbar/v3 v3.7.4
go: downloading github.com/tj/go-naturaldate v1.3.0
go: downloading github.com/aymerick/raymond v2.0.2+incompatible
go: downloading github.com/mvdan/xurls v1.1.0
go: downloading github.com/yuin/goldmark-meta v1.0.0
go: downloading github.com/AlecAivazis/survey/v2 v2.2.7
go: downloading github.com/fatih/color v1.10.0
go: downloading github.com/mattn/go-sqlite3 v1.14.6
go: downloading github.com/relvacode/iso8601 v1.1.0
go: downloading gopkg.in/djherbis/times.v1 v1.2.0
go: downloading github.com/gosimple/slug v1.9.0
go: downloading github.com/lestrrat-go/strftime v1.0.4
go: downloading github.com/rvflash/elapsed v0.2.0
go: downloading golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
go: downloading github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be
go: downloading github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: downloading golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
# github.com/mattn/go-sqlite3
sqlite3-binding.c:195315:10: fatal error: 'unicode/utypes.h' file not found

[lsp] zk.list command not respect excludeHrefs with createdAfter

If I query my notes with the following options via the lsp, the excluded note is still included in the result. Here is a dump of the params and the results from my neovim lua code.

image

On the cli this seems to work as expected. I piped the output into wc -l just to hide my personal notes, but you can see that it returns 3 notes instead of 4 (3 being the correct amount).

image

zk index only works in notebook directory

Here is how to test the issue. My notebook directory is ~/notes.

$ cd ~
$ touch ~/notes/foo.md
$ zk index
zk: warning: foo.md: open foo.md: no such file or directory
Indexed 19 notes in 0s
  + 1 added
  ~ 0 modified
  - 0 removed

$ cd ~/notes
$ zk index
Indexed 19 notes in 0s
  + 1 added
  ~ 0 modified
  - 0 removed

LSP go to definition goes to incorrect note

Hi,

I group notes for the same project under a directory called <DATE> - Project name and then I have a main note for that project on that directory with the same name <DATE> - Project name.md. When I add a link to that note ([[<DATE> - Project name]]) and use the LSP go to definition feature, it opens another note from the same directory.

Steps to reproduce:

  • Create a directory called 2021-12-31 - test
  • Create a note called 2021-12-31 - test.md in 2021-12-31 - test
  • Create a note called another note.md in 2021-12-31 - test
  • In a different note add the following link ([[2021-12-31 - test]])
  • Use LSP go to definition to navigate to the note. In my case another note.md is opened instead.

Thanks

'zk init' terminated by signal SIGTERM (Polite quit request)

My tried-and-tested ZK install doesn't work anymore. No matter which command I give, my RAM + SWAP go to 100% (~32GB combined), my computer freezes, and then the command quits.

This only happens in my "real" ZK folder. I created a new empty folder in /tmp/test and ran zk init there -- it worked.

This happens to me on both v0.7.0 and 0.8.0. I removed my .zk directory and tried re-creating it, but to no avail.

The first time this bug happened was when I ran a zk new command whilst playing/idling the paperclip game. My PC was already on heavy load/dying, and the zk command just died. Afterwards, even after restarting, zk just stopped working. So maybe this has to do with memory.

Feature request: Plot graph using graphviz

It would be nice to be able to visualise the connections between notes as a graph. I have seen this functionality on other applications implementing that implement a Zettelkasten-style notebook and find it very helpful. Here is an example of how that could look.

I propose a command, e.g. zk graph that, that just outputs the source for a graph as a graphviz graph, allowing to pipe it to a file or render it using dot.

Here is another example of a very useful visualisation, haven't been able to run it on my zk notes folder though.

image

Maybe there already is a solution for this I'm not aware of, if so please let me know!

Grep mode for search with exact matches

The --match option is super fast and usually find more desired results, but it could be useful to have an additional --grep one looking for exact matches in all the notes. Regular expressions could be enabled as well for more advanced use cases.

Modern arch based systems support

Since I've updated my system, can't use and build zk anymore. I've got error:
zk: error while loading shared libraries: libicuuc.so.69: cannot open shared object file: No such file or directory
The modern core package is icu 70.1-1 Can you make some updates for supporting it? libicuio.so

macOS 10.14.6, build fails

Building with the instruction in the Readme.

CGO_ENABLED=1 go build -tags "fts5 icu" -ldflags "-X=main.Version=`git describe --tags --match v[0-9]* 2> /dev/null` -X=main.Build=`git rev-parse --short HEAD`"
go: cannot find main module, but found .git/config in /Users/sr/GitHub/zk
	to create a module there, run:
	go mod init
make: *** [build] Error 1

Cyrillic symbols in zk.lsp

Found a bug (nvim + zk.lsp)

If you trying to create link using lua vim.lsp.buf.definition command with Cyrillic symbols, it creates ref with ������� blocks.

To reproduce it, write some Cyrillic text - example: русский, visualize it and push <CR>.

Can't get `--link-to`, `--linked-by` etc… to work.

Here is my full zk config

# zk configuration file
#
# Uncomment the properties you want to customize.

# NOTE SETTINGS
#
# Defines the default options used when generating new notes.
[note]

# Language used when writing notes.
# This is used to generate slugs or with date formats.
language = "en"

# The default title used for new note, if no `--title` flag is provided.
default-title = "Untitled"

# Template used to generate a note's filename, without extension.
filename = "{{date now 'timestamp'}} {{title}}"

# The file extension used for the notes.
extension = "md"

# Template used to generate a note's content.
# If not an absolute path, it is relative to .zk/templates/
template = "default.md"

# Path globs ignored while indexing existing notes.
ignore = [
  "drafts/*",
  "log.md",
  ".neuron",
  "neuron.dhall",
  ".neuronignore",
  ".obsidian",
  "_templates",
  ".obsidian.vimrc",
  ".syncinfo",
  "static"
]

# Configure random ID generation.

# The charset used for random IDs. You can use:
#   * letters: only letters from a to z.
#   * numbers: 0 to 9
#   * alphanum: letters + numbers
#   * hex: hexadecimal, from a to f and 0 to 9
#   * custom string: will use any character from the provided value
id-charset = "numbers"

# Length of the generated IDs.
id-length = 12

# Letter case for the random IDs, among lower, upper or mixed.
# id-case = "lower"


# EXTRA VARIABLES
#
# A dictionary of variables you can use for any custom values when generating
# new notes. They are accessible in templates with {{extra.<key>}}
[extra]

#key = "value"


# GROUP OVERRIDES
#
# You can override global settings from [note] and [extra] for a particular
# group of notes by declaring a [group."<name>"] section.
#
# Specify the list of directories which will automatically belong to the group
# with the optional `paths` property.
#
# Omitting `paths` is equivalent to providing a single path equal to the name of
# the group. This can be useful to quickly declare a group by the name of the
# directory it applies to.

[group.work]
[group.work.note]
template = "work.md"

[group.journal]
[group.journal.note]
filename = "{{date now}}"
template = "journal.md"

# MARKDOWN SETTINGS
[format.markdown]

# Format used to generate links between notes.
# Either "wiki", "markdown" or a custom template. Default is "markdown".
#link-format = "wiki"
# Indicates whether a link's path will be percent-encoded.
# Defaults to true for "markdown" format and false for "wiki" format.
#link-encode-path = true
# Indicates whether a link's path file extension will be removed.
# Defaults to true.
#link-drop-extension = true

# Enable support for #hashtags.
hashtags = true
# Enable support for :colon:separated:tags:.
colon-tags = false
# Enable support for Bear's #multi-word tags#
# Hashtags must be enabled for multi-word tags to work.
multiword-tags = false


# EXTERNAL TOOLS
[tool]

# Default editor used to open notes. When not set, the EDITOR or VISUAL
# environment variables are used.
#editor = "vim"

# Pager used to scroll through long output. If you want to disable paging
# altogether, set it to an empty string "".
#pager = "less -FIRX"

# Command used to preview a note during interactive fzf mode.
# Set it to an empty string "" to disable preview.

# bat is a great tool to render Markdown document with syntax highlighting.
#https://github.com/sharkdp/bat
fzf-preview = "bat -p --color always {-1}"


# LSP
#
#   Configure basic editor integration for LSP-compatible editors.
#   See https://github.com/mickael-menu/zk/blob/main/docs/editors-integration.md
#
[lsp]

[lsp.diagnostics]
# Each diagnostic can have for value: none, hint, info, warning, error

# Report titles of wiki-links as hints.
#wiki-title = "hint"
# Warn for dead links between notes.
dead-link = "error"


# NAMED FILTERS
#
#    A named filter is a set of note filtering options used frequently together.
#
[filter]

# Matches the notes created the last two weeks. For example:
#    $ zk list recents --limit 15
#    $ zk edit recents --interactive
recents = "--sort created- --created-after 'last two weeks'"
work = '--group work'


# COMMAND ALIASES
#
#   Aliases are user commands called with `zk <alias> [<flags>] [<args>]`.
#
#   The alias will be executed with `$SHELL -c`, please refer to your shell's
#   man page to see the available syntax. In most shells:
#     * $@ can be used to expand all the provided flags and arguments
#     * you can pipe commands together with the usual | character
#
[alias]
# Here are a few aliases to get you started.

# override defaults
edit = "zk edit --interactive $@"

# Shortcut to a command.
ls = "zk list --interactive $@"

# backlinks
bl = "zk list --link-to $@"

# Edit the last modified note.
editlast = "zk edit --limit 1 --sort modified- $@"

wc = "zk list --format '{{word-count}}\t{{title}}' --sort word-count"

# Edit the notes selected interactively among the notes created the last two weeks.
# This alias doesn't take any argument, so we don't use $@.
recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"

# Print paths separated with colons for the notes found with the given
# arguments. This can be useful to expand a complex search query into a flag
# taking only paths. For example:
#   zk list --link-to "`zk path -m potatoe`"
path = "zk list --quiet --format {{path}} --delimiter , $@"

# Show a random note.
#lucky = "zk list --quiet --format full --sort random --limit 1"

# Returns the Git history for the notes found with the given arguments.
# Note the use of a pipe and the location of $@.
hist = "zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"

# Edit this configuration file.
conf = '$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml"'

# Work related
oto = 'zk new work --template 1-1.md --extra with="$*" --title "$*"'
work = 'zk new work --title "$*"'

# Personal
journal = 'zk new --group journal "$*"'

And this is a simple example to show my problem/issue.

$ZK_NOTEBOOK_DIR/work/202110031652 foo bar.md

---
title: 'foo bar'
---

Some note

$ZK_NOTEBOOK_DIR/work/202110031653 baz.md

---
title: 'baz'
---
<!-- link created by the lsp, not manual -->
[foo bar](202110031652%20foo%20bar)
$ zk list --link-to 202110031652
zk: error: could not find notes at: 202110031652

$ zk list --link-to "202110031652 foo bar"
zk: error: could not find notes at: 202110031652 foo bar

$ zk list --link-to "foo bar"
zk: error: could not find notes at: foo bar

$ zk list --link-to "work/202110031652 foo bar"

Found 0 note

Filtering by link relations

Link relations (Folgezettel, references, etc.) are parsed in the database, but we cannot filter notes per link relation yet.

Date helper fails: no value can start with %

I am trying to format my weekly-journal filenames with strftime-style placeholders, as described in the documentation.

Below is my config. The commented string is what I want to do (2021-W45-Friday-12-November), the other one is copied directly from the docs. Both fail with zk: error: failed to open notebook: failed to read config: 89, 25): parsing error: no value can start with %

[group."journal/weekly".note]
template = "journal.weekly.md"
#filename = "{{date now "%y-W%V-%A-%d-%B"}}"
filename = "{{date now "%m-%d-%Y"}}"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.