# Embed Search — Notebook Grouping Fork 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. 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. ## What it does 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 A–Z: ````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:""` 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.