Home

Awesome

Description

An assortment of handy logseq CLIs using nbb-logseq.

Prerequisites

Setup

To use these clis/commands/executables on $PATH:

$ git clone https://github.com/cldwalker/logseq-clis
# Use yarn (what I use)
$ yarn install
$ yarn global add $PWD

# OR use npm
$ npm i
$ npm i -g

Usage

The following CLIs are now installed.

logseq-file-ast

Prints the logseq ast of a given markdown file:

$ logseq-file-ast example.md
[[["Heading"
   {:anchor "apple",
    :level 1,
    :meta {:properties [], :timestamps []},
    :size nil,
    :tags [],
    :title [["Plain" "apple "] ["Tag" [["Plain" "some-tag"]]]],
    :unordered true}]
  {:end_pos 18, :start_pos 0}]
 [["Heading"
   {:anchor "banana",
    :level 2,
    :meta {:properties [], :timestamps []},
    :size nil,
    :tags [],
    :title [["Plain" "banana "]
            ["Tag" [["Plain" "work"]]]
            ["Plain" " "]
            ["Tag" [["Plain" "blarg"]]]],
    :unordered true}]
  {:end_pos 41, :start_pos 18}]
...

logseq-block-move

Moves blocks with specified tag to another file or directory. Useful for finely splitting a logseq graph directory.

$ logseq-block-move pages new-pages unused-tag
pages/example.md -> new-pages/example.md - 6 of 8 nodes moved

Note: There are minor whitespace changes and this bug that occur during the move. It's recommended to use logseq-roundtrip on the intended move target beforehand to see what the mldoc exporter will do.

logseq-roundtrip

Parses and then exports a markdown file. Useful for testing mldoc's export.

logseq-class-hierarchy

Prints a graph's class hierarchy to a logseq-compatible markdown file. Useful for generating a navigable tree for a graph's ontology a.k.a. "table of contents".

Development

Code is organized under the following directories:

License

See LICENSE.md