Skip to content

Commit 0c82454

Browse files
committed
Fixes for Logseq marketplace. README improvements. Build script improvements.
1 parent 67b1499 commit 0c82454

File tree

3 files changed

+52
-15
lines changed

3 files changed

+52
-15
lines changed

Diff for: README.md

+42-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# Blocknav
1+
# Block Navigation
22

33
## Synopsis
44

5-
Super simple plugin to facilitate block navigation in [Logseq](https://www.logseq.com/).
5+
Simple plugin to facilitate top-level block navigation in [Logseq](https://www.logseq.com/).
66

77
## Installation
88

9-
Not currently in the marketplace.
10-
11-
To load, must turn on developer mode in settings and load as an "unpacked plugin" from the Logseq plugins page (`t p`).
9+
1. **(Recommended)** Install from the plugin marketplace.
10+
2. Turn on developer mode in settings and load this repo as an "unpacked plugin" from the Logseq plugins page (`t p`).
1211

1312
## Usage (default keybinds)
1413

@@ -28,11 +27,11 @@ Keybind|Action
2827

2928
## Settings
3029

31-
As of `v0.0.2` the plugin will allow you to disable the default key bindings and optionally provide your own.
30+
The plugin settings page allows disabling the default key bind set and optionally providing your own.
3231

33-
Changing custom keybinds requires editing the plugin JSON settings.
32+
Changing custom keybinds requires editing the plugin JSON settings manually. It currently seems necessary to restart Logseq for the changes to be applied. Also see [Possible Issues](#possible-issues).
3433

35-
### Default settings JSON
34+
### Default Settings JSON
3635

3736
```json
3837
{ "default-shortcuts": true,
@@ -65,3 +64,38 @@ Key|Type|Description
6564
`disabled`|boolean|Disables this definition. Defaults to `false`. **(optional)**
6665
`new`|boolean|Prepend a block if the index is positive, otherwise append. Defaults to `false`. **(optional)**
6766
`onlySelect`|boolean|**Experimental**: Only select the block, do not edit it. Defaults to `false`. **(optional)**
67+
68+
69+
### Keybind Ideas
70+
71+
#### Direct Block Indexing
72+
73+
It's possible to dispense with the `b` prefix for keybinds and just use `1` to edit the first block, `- 1` to edit the last, etc. Here is an example using that approach with `^`, `$` to prepend/append blocks (modeled after regex anchors.)
74+
75+
```json
76+
{
77+
"default-shortcuts": false,
78+
"custom-shortcuts": [
79+
{ "idx": -1, "new": true, "bind": "shift+4", "desc": "Append and edit" },
80+
{ "idx": 0, "new": true, "bind": "shift+6", "desc": "Prepend and edit" },
81+
82+
{ "idx": 0, "bind": "1", "desc": "Edit block 1" },
83+
{ "idx": 1, "bind": "2", "desc": "Edit block 2" },
84+
{ "idx": 2, "bind": "3", "desc": "Edit block 3" },
85+
{ "idx": 3, "bind": "4", "desc": "Edit block 4" },
86+
{ "idx": 4, "bind": "5", "desc": "Edit block 5" },
87+
{ "idx": -1, "bind": "- 1", "desc": "Edit block -1" },
88+
{ "idx": -2, "bind": "- 2", "desc": "Edit block -2" },
89+
{ "idx": -3, "bind": "- 3", "desc": "Edit block -3" },
90+
{ "idx": -4, "bind": "- 4", "desc": "Edit block -4" },
91+
{ "idx": -5, "bind": "- 5", "desc": "Edit block -5" }
92+
],
93+
"disabled": false
94+
}
95+
96+
```
97+
98+
99+
### Possible Issues
100+
101+
Invalid data in the settings JSON file is not currently handled very gracefully. If you've edited the that file and are experiencing problems, it's very likely due to something like a trailing comma in one of the entries causing a JSON syntax error. *Solution: Correct the error and restart Logseq.*

Diff for: build.sh

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!env bash
22
set -euo pipefail
3-
PLUGIN_NAME=${1:-logseq-blocknav}
3+
PLUGIN_NAME="${1:-logseq-blocknav}"
4+
LSAPI_VERSION="${2:-0.0.6}"
45
mkdir "$PLUGIN_NAME"
56
cd "$PLUGIN_NAME"
6-
cp ../README.md .
7-
sed 's@"\./index\.html"@"./index.js"@' < ../package.json > ./package.json
8-
curl -Ssl 'https://cdn.jsdelivr.net/npm/@logseq/libs@0.0.6' > index.js
9-
cat ../index.js >> ./index.js
7+
cp ../{README.md,LICENSE,index.js} .
8+
sed 's@https://cdn[^"]*@./logseq-api.js@' ../index.html > ./index.html
9+
curl -fSs \
10+
"https://cdn.jsdelivr.net/npm/@logseq/libs@${LSAPI_VERSION}" \
11+
"https://cdn.jsdelivr.net/npm/@logseq/libs@${LSAPI_VERSION}/dist/lsplugin.user.js.LICENSE.txt" \
12+
-o ./logseq-api.js -O
1013
cd ..
11-
exec zip -r "$PLUGIN_NAME".zip "$PLUGIN_NAME"
14+
exec zip -r "${PLUGIN_NAME}.zip" "$PLUGIN_NAME"

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{
33
"name": "logseq-blocknav",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"author": "KerfuffleV2",
66
"main": "./index.html",
77
"description": "Block navigation shortcuts",

0 commit comments

Comments
 (0)