felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
118 stars 21 forks source link

Canonical location of tags in `neuron query` (v2) #75

Open srid opened 3 years ago

srid commented 3 years ago

Just a heads-up; this change will become effective as soon as https://github.com/srid/neuron/issues/570 is resolved (I'll comment here once that's done).


There is (will be) another change in neuron query JSON structure, but this time ... it is a positive one (as it obviates having to hack into internal plugin data, which will no longer contain the tags).

Use the following to pull tags out of a zettel structure.

# Get tags for https://www.srid.ca/pass
$ neuron query --id="Pass with GPG" 2> /dev/null | jq .Meta.tags
[
  "blog"
]
$

Note that Meta will contain pretty much everything the user specifies in the YAML frontmatter of Markdown (or org-mode heading properties, as soon as we implement that for v2). So "tags" is not a special field; it is just part of the generic metadata that neuron exposes, eg:

$ neuron query --id="Pass with GPG" 2> /dev/null | jq .Meta
{
  "slug": "pass",
  "date": "2021-01-15",
  "tags": [
    "blog"
  ]
}
$
srid commented 3 years ago

Done: https://github.com/srid/neuron/pull/572