This commit is contained in:
Victor Wiebe 2026-07-26 11:21:18 -04:00
parent 000716d42d
commit 03f7a38598
31 changed files with 252 additions and 21 deletions

0
GENERATOR_DOC.md Normal file → Executable file
View File

107
README.md Normal file → Executable file
View File

@ -1,9 +1,102 @@
# Embed search in note - Joplin Plugin # Embed Search — Notebook Grouping Fork
This plugin allows to embed any search A fork of [ambrt/joplin-plugin-embed-search](https://github.com/ambrt/joplin-plugin-embed-search), a Joplin plugin that lets you embed a live search inside a note and have the results render right there in the preview pane.
and its get previewed in pane.
Additionally it detects if note is a todo This fork adds the ability to group results by notebook, and fixes a bug where restricting a search to the current notebook would also pull in results from its subnotebooks.
and allows to tick it on and off.
More at ## What it does
https://discourse.joplinapp.org/t/embed-search/14328
Add a fenced `search` code block to any note:
````markdown
```search
your search terms
```
````
When you view the note, the plugin runs that search and replaces the block with a live list of matching notes, each one a clickable link back to the note. To-do items get a checkbox you can tick right from the results list.
## Search modifiers
Add any of these on their own line inside the `search` block, alongside your search terms:
| Modifier | What it does |
|---|---|
| `sort:asc` | Sort results alphabetically by title, A → Z |
| `sort:desc` | Sort results alphabetically by title, Z → A |
| `content:true` | Show a preview of each note's body content below its title |
| `notebook:this` | Restrict results to the current note's notebook only *(fixed in this fork — no longer pulls in subnotebooks)* |
| `group:notebook` | **New in this fork.** Group results under bold notebook-name headers, sorted alphabetically by notebook, with notes sorted by title within each group |
### Examples
Show every note tagged with a keyword, sorted AZ:
````markdown
```search
budget sort:asc
```
````
Restrict to notes in the current notebook only, with content previews:
````markdown
```search
budget notebook:this content:true
```
````
Group everything across your whole workspace by notebook — handy for a dashboard note that surveys many notebooks at once:
````markdown
```search
tag:reference group:notebook
```
````
## What changed from the original plugin
- **Added:** `group:notebook` — groups search results under notebook headers instead of one flat list.
- **Fixed:** `notebook:this` previously appended a `notebook:"<title>"` filter to the Joplin search query. Joplin's own `notebook:` filter has no way to exclude subnotebooks, so this leaked in results from child notebooks. This fork instead filters results in-plugin by exact `parent_id` match against the current note's notebook, so only notes directly in that notebook are returned.
- **Fixed:** the original code asked Joplin for a folder's `name` field when resolving `notebook:this` — Joplin folders don't have a `name` field, only `title`, so this silently broke the feature. Fixed to request `title`.
All credit for the original plugin, the fence-block rendering approach, and the to-do checkbox handling goes to [ambrt](https://github.com/ambrt).
## Installation
1. Download the latest `.jpl` file from the [Releases](../../releases) page (or build it yourself — see below).
2. In Joplin: **Tools → Options → Plugins → gear icon → Install from file**.
3. Select the `.jpl` file and restart Joplin if prompted.
## Building from source
Requires Node.js and npm.
```bash
git clone https://gitea.skeletonworks.online/vwiebe/joplin-plugin-embed-search-fork.git
cd joplin-plugin-embed-search-fork
npm install
npm run dist
```
The built plugin will appear at `publish/com.victorwiebe.embed-search-notebook-grouping.jpl`.
### If `npm run dist` fails
This project's build tooling (webpack 4) predates a change in Node's OpenSSL defaults. If your Node version is 17 or newer, `npm run dist` (or `npm publish`, which runs it internally) can fail with an error that includes `ERR_OSSL_EVP_UNSUPPORTED` or `digital envelope routines::unsupported`. This is not a problem with the code — it's an old build tool meeting a newer Node.
This is already worked around in `package.json` — the `dist` script runs through `cross-env NODE_OPTIONS=--openssl-legacy-provider`, so a plain `npm run dist` and a plain `npm publish` should both just work as long as you've run `npm install` first (which pulls in the `cross-env` package the fix depends on).
If you still hit the error after `npm install`, delete `node_modules` and reinstall from scratch:
```bash
rm -rf node_modules package-lock.json
npm install
npm run dist
```
**Not sure which Node version you have?** Run `node --version`. Anything starting with `v17` or higher can hit this; `v16` and earlier won't.
## License
MIT, same as the original plugin.

0
api/Global.d.ts vendored Normal file → Executable file
View File

0
api/Joplin.d.ts vendored Normal file → Executable file
View File

0
api/JoplinClipboard.d.ts vendored Normal file → Executable file
View File

0
api/JoplinCommands.d.ts vendored Normal file → Executable file
View File

0
api/JoplinContentScripts.d.ts vendored Normal file → Executable file
View File

0
api/JoplinData.d.ts vendored Normal file → Executable file
View File

0
api/JoplinFilters.d.ts vendored Normal file → Executable file
View File

0
api/JoplinInterop.d.ts vendored Normal file → Executable file
View File

0
api/JoplinPlugins.d.ts vendored Normal file → Executable file
View File

0
api/JoplinSettings.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViews.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViewsDialogs.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViewsMenuItems.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViewsMenus.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViewsPanels.d.ts vendored Normal file → Executable file
View File

0
api/JoplinViewsToolbarButtons.d.ts vendored Normal file → Executable file
View File

0
api/JoplinWindow.d.ts vendored Normal file → Executable file
View File

0
api/JoplinWorkspace.d.ts vendored Normal file → Executable file
View File

0
api/index.ts Normal file → Executable file
View File

0
api/types.ts Normal file → Executable file
View File

144
package-lock.json generated Normal file → Executable file
View File

@ -1,12 +1,12 @@
{ {
"name": "joplin-plugin-embed-search", "name": "joplin-plugin-victorwiebe-embed-search-notebook-grouping",
"version": "2.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "joplin-plugin-embed-search", "name": "joplin-plugin-victorwiebe-embed-search-notebook-grouping",
"version": "2.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"joplin-renderer": "^1.0.8" "joplin-renderer": "^1.0.8"
@ -15,6 +15,7 @@
"@types/node": "^14.0.14", "@types/node": "^14.0.14",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"copy-webpack-plugin": "^6.1.0", "copy-webpack-plugin": "^6.1.0",
"cross-env": "^7.0.3",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"glob": "^7.1.6", "glob": "^7.1.6",
"on-build-webpack": "^0.1.0", "on-build-webpack": "^0.1.0",
@ -1143,6 +1144,89 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"node_modules/cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.1"
},
"bin": {
"cross-env": "src/bin/cross-env.js",
"cross-env-shell": "src/bin/cross-env-shell.js"
},
"engines": {
"node": ">=10.14",
"npm": ">=6",
"yarn": ">=1"
}
},
"node_modules/cross-env/node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/cross-env/node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/cross-env/node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cross-env/node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/cross-env/node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@ -6952,6 +7036,58 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.1"
},
"dependencies": {
"cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"requires": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
}
},
"path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true
},
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"requires": {
"shebang-regex": "^3.0.0"
}
},
"shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
}
}
},
"cross-spawn": { "cross-spawn": {
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",

8
package.json Normal file → Executable file
View File

@ -1,8 +1,9 @@
{ {
"name": "joplin-plugin-embed-search", "name": "joplin-plugin-victorwiebe-embed-search-notebook-grouping",
"version": "2.0.0", "version": "1.0.0",
"author": "Victor Wiebe",
"scripts": { "scripts": {
"dist": "webpack --joplin-plugin-config buildMain && webpack --joplin-plugin-config buildExtraScripts && webpack --joplin-plugin-config createArchive", "dist": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --joplin-plugin-config buildMain && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --joplin-plugin-config buildExtraScripts && cross-env NODE_OPTIONS=--openssl-legacy-provider webpack --joplin-plugin-config createArchive",
"prepare": "npm run dist", "prepare": "npm run dist",
"update": "npm install -g generator-joplin && yo joplin --update", "update": "npm install -g generator-joplin && yo joplin --update",
"distrun2": "npm run dist && ~/Downloads/Joplin-2.3.5.AppImage --env dev", "distrun2": "npm run dist && ~/Downloads/Joplin-2.3.5.AppImage --env dev",
@ -16,6 +17,7 @@
"@types/node": "^14.0.14", "@types/node": "^14.0.14",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"copy-webpack-plugin": "^6.1.0", "copy-webpack-plugin": "^6.1.0",
"cross-env": "^7.0.3",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"glob": "^7.1.6", "glob": "^7.1.6",
"on-build-webpack": "^0.1.0", "on-build-webpack": "^0.1.0",

0
plugin.config.json Normal file → Executable file
View File

0
src/embedfence.css Normal file → Executable file
View File

0
src/fence.js Normal file → Executable file
View File

0
src/index.ts Normal file → Executable file
View File

12
src/manifest.json Normal file → Executable file
View File

@ -1,12 +1,12 @@
{ {
"manifest_version": 1, "manifest_version": 1,
"id": "joplin.plugin.ambrt.embedSearch", "id": "com.victorwiebe.embed-search-notebook-grouping",
"app_min_version": "1.7", "app_min_version": "1.7",
"version": "2.1.0", "version": "2.1.0",
"name": "Embed Search (Notebook Grouping Fork)", "name": "Embed Search (Notebook Grouping Fork)",
"description": "Embeds list of links specified by search inside of note. Fork adds group:notebook.", "description": "Embeds list of links specified by search inside of note. Fork of ambrt's Embed Search plugin, adding group:notebook and a fixed notebook:this.",
"author": "ambrt", "author": "Victor Wiebe",
"homepage_url": "https://discourse.joplinapp.org/t/embed-any-search-with-content/14328", "homepage_url": "https://gitea.skeletonworks.online/vwiebe/joplin-plugin-embed-search-fork",
"repository_url": "https://github.com/ambrt/joplin-plugin-embed-search", "repository_url": "https://gitea.skeletonworks.online/vwiebe/joplin-plugin-embed-search-fork",
"keywords": [] "keywords": ["joplin-plugin"]
} }

0
tsconfig.json Normal file → Executable file
View File

0
webpack.config.js Normal file → Executable file
View File