commit 42df9465cf51862149df3dc82c2d6ba10f849a25 Author: Simon Cambier Date: Sat Jun 21 13:22:54 2025 +0200 First commit diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..b245a11 --- /dev/null +++ b/.babelrc @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": { + "node": "current" + } + } + ], + "@babel/preset-typescript", + ] +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0020fc0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*] +indent_style = space +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..30576a7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] " +labels: '' +assignees: '' +--- + + + + +**Problem description:** + + + + + +**Your environment:** + + + + +- Omnisearch version: +- Obsidian version: +- Operating system: +- Number of indexed documents in your vault (approx.): + +**Things to try:** + +- Does the problem occur when Omnisearch is the only active community plugin: +- Does the problem occur when you _don't_ index PDFs, images, or other non-notes files: +- Does the problem occur after a cache reset: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..09e640e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[Feature request]" +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..03c0981 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,110 @@ +name: Release Obsidian plugin + +on: + push: + tags: + - "*" + +env: + PLUGIN_NAME: omnisearch + DIST_FOLDER: ./dist + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v4 + with: + run_install: true + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + cache: 'pnpm' + node-version: "20.x" + + - name: Build + id: build + run: | + pnpm install + pnpm run build + mkdir ${{ env.PLUGIN_NAME }} + cp ${{ env.DIST_FOLDER }}/* ${{ env.PLUGIN_NAME }} + zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} + ls + echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)" + + - name: Generate a changelog + uses: orhun/git-cliff-action@v3 + id: git-cliff + with: + config: cliff.toml + args: -vv --latest --strip header + env: + GITHUB_REPO: ${{ github.repository }} + + - name: Print the changelog + run: cat "${{ steps.git-cliff.outputs.changelog }}" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ github.ref }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{ steps.git-cliff.outputs.content }} + draft: true + prerelease: false + + - name: Upload zip file + id: upload-zip + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.PLUGIN_NAME }}.zip + asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip + asset_content_type: application/zip + + - name: Upload main.js + id: upload-main + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.DIST_FOLDER }}/main.js + asset_name: main.js + asset_content_type: text/javascript + + - name: Upload manifest.json + id: upload-manifest + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./manifest.json + asset_name: manifest.json + asset_content_type: application/json + + - name: Upload styles.css + id: upload-css + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.DIST_FOLDER }}/styles.css + asset_name: styles.css + asset_content_type: text/css + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7a35d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# vscode +.vscode + +# Intellij +*.iml +.idea + +# npm +node_modules + +# Exclude sourcemaps +*.map + +# obsidian +data.json + +# Exclude macOS Finder (System Explorer) View States +.DS_Store + +dist +.pnpm-debug.log +coverage +package-lock.json +Doc Omnisearch/.obsidian diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..40fff7b --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +tag-version-prefix="" +package-manager-strict=false diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..29c2482 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,13 @@ +// prettier.config.js or .prettierrc.js +module.exports = { + plugins: ['prettier-plugin-svelte'], + trailingComma: 'es5', + tabWidth: 2, + semi: false, + singleQuote: true, + arrowParens: 'avoid', + bracketSameLine: true, + svelteBracketNewLine: false, + svelteAllowShorthand: true, + svelteIndentScriptAndStyle: true, +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d1deee7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,243 @@ +# Omnisearch Changelog + +This changelog is not exhaustive. + +## 1.27.x + +- Updated Svelte from v3 to v5 +- Highlighting improvements + +## 1.26.x + +- Allow `# headings` as display titles in search results +- Added an experimental recency boost +- Added lazy loading for the vault modal items + +## 1.25.x + +- Added basic support for embed references in Vault Search results +- Added support for [Iconize](https://github.com/FlorianWoelki/obsidian-iconize) +- Weights are now 1-10 (instead of 1-5) +- Small performance improvements + +## 1.24.x + +- Added support for [AI Image Analyzer](https://github.com/Swaggeroo/obsidian-ai-image-analyzer) + +## 1.23.x + +- Updated Chinese tokenizer +- Added user-defined boosted fields +- No more freezes when loading large caches (hopefully) +- Large refactoring to properly clean up several older warnings + +## 1.22.x + +- Improved highlighting + +## 1.21.x + +- Added support for .docx and .xlsx + +## 1.20.x + +- Refactored indexing tokenization process to correctly take diacritics into account +- Added highlighting in the note's path +- Improved the selection of the chosen excerpt in the results list + +## 1.19.x + +- Various bugfixes and improvements + +## 1.18.x + +- Added a localhost server to use Omnisearch's API from outside Obsidian + +## 1.17.x + +- Added a shortcut to open files without closing Omnisearch +- Prefill the search field with selected text +- Improved highlighting + +## 1.16.x + +- Various indexing/tokenization improvements + +## 1.15.x + +- Added support of webp images +- Configurable fuzziness +- Added support for DataLoom plugin files +- Unsupported files are now indexed by their path +- Unmarked tags are now slightly boosted + +## 1.14.x + +- Added a `path:` option +- Bugfixes + +## 1.13.x + +- CamelCaseWords are now indexed as 3 words +- Reduced search freezes in some cases + +## 1.12.x + +- You can filter files by their extension +- Refreshed UI +- New API functions +- Fixed some tokenization issues + +## 1.10.x - 1.11.x + +- Added support for Text Extractor; Omnisearch no longer extracts text itself +- Added canvas indexing +- Improved tags indexing + +## 1.9.x + +- PDFs are no longer indexed on mobile +- Performance improvements +- Various bugfixes + +## 1.8.x + +- Added OCR for images +- OCR and PDF indexing are now restricted to desktop. They either don't work or consume too much resources during indexing of big vaults. Too many headaches. +- Notes caching is deactivated on iOS because of crashes: memory usage too high during (de)serializing. +- Added an URL scheme for integration with external tools: `obsidian://omnisearch?query=foo bar` + +## 1.7.x + +### New + +- PDF Indexing https://github.com/scambier/obsidian-omnisearch/issues/58 + +### Improved + +- Code refactor to better scale and handle PDFs as smoothly as possible + +### Fixed + +- Search history https://github.com/scambier/obsidian-omnisearch/issues/104 +- Text in search input was not always correctly selected https://github.com/scambier/obsidian-omnisearch/issues/105 +- Padding issue https://github.com/scambier/obsidian-omnisearch/issues/113 + +### Removed + +- Caching data https://github.com/scambier/obsidian-omnisearch/issues/92#issuecomment-1287647725 + + +## 1.6.x + +### New + +- Omnisearch can now index other plaintext files ~~and PDFs~~ https://github.com/scambier/obsidian-omnisearch/issues/58 +- Search history, navigable with alt+up/down https://github.com/scambier/obsidian-omnisearch/issues/90 +- Added a setting to toggle the visibility of the note excerpt in results https://github.com/scambier/obsidian-omnisearch/issues/70 + +### Improved + +- You can now create a new note in a new pane https://github.com/scambier/obsidian-omnisearch/issues/87 +- Added a setting to show a "create note" button https://github.com/scambier/obsidian-omnisearch/issues/96 + +### Fixed + +- Fixed layout issues https://github.com/scambier/obsidian-omnisearch/issues/97 + +## 1.5.x + +### New + +* Added a toggleable sidebar button to open Omnisearch: https://github.com/scambier/obsidian-omnisearch/issues/60 +* Added a cache-clearing mechanism in case of corruption: https://github.com/scambier/obsidian-omnisearch/issues/83 + +### Improved + +* Notes created by Omnisearch now honour the default note location https://github.com/scambier/obsidian-omnisearch/pull/81 +* Ctrl+click now opens the note in a new pane https://github.com/scambier/obsidian-omnisearch/issues/61 +* Improved highlighting https://github.com/scambier/obsidian-omnisearch/issues/85 + +### Fixed + +* Fixed some edge cases when opening an already open/pinned note https://github.com/scambier/obsidian-omnisearch/issues/51 https://github.com/scambier/obsidian-omnisearch/issues/80 +* Fixed nested tags searching https://github.com/scambier/obsidian-omnisearch/issues/79 +* Fixed a silent crash when clicking on In-File search results https://github.com/scambier/obsidian-omnisearch/issues/84 + +## 1.4.x + +### New + +- Opt-in support for Vim navigation keys: https://github.com/scambier/obsidian-omnisearch/issues/26 +- Opt-in display of "short form" links: https://github.com/scambier/obsidian-omnisearch/issues/59 +- Opt-in search index serialization, for faster loading times: https://github.com/scambier/obsidian-omnisearch/pull/64 by @mnaoumov +- Opt-out: diacritics can now be ignored +- Added support for `#tag` searches: https://github.com/scambier/obsidian-omnisearch/issues/48 +- Added a basic public API for integration with other plugins: https://github.com/scambier/obsidian-omnisearch/issues/22 https://github.com/scambier/obsidian-omnisearch/issues/69 +- Use `alt+enter` to inject a link to the currently selected search result item: https://github.com/scambier/obsidian-omnisearch/issues/32 + + +### Improved + +- You can now switch between "Vault" and "In-File" modals with `tab` +- Search index updates are now done only when Omnisearch is invoked: https://github.com/scambier/obsidian-omnisearch/issues/57 +- New files are now created empty: https://github.com/scambier/obsidian-omnisearch/issues/77 + +### Fixed + +- Opening a pinned note would open it a second time: https://github.com/scambier/obsidian-omnisearch/issues/51 +- Fixed an issue that would index "non-existing notes" multiple times: https://github.com/scambier/obsidian-omnisearch/issues/68 +- Fixed a visual bug for Obsidian 0.15.3: https://github.com/scambier/obsidian-omnisearch/issues/76 +- Fixed the diacritics normalization of the note's title: https://github.com/scambier/obsidian-omnisearch/issues/72 + +## 1.3.x + +### New + +* Chinese support by @aidenlx in https://github.com/scambier/obsidian-omnisearch/pull/37 + * You need to install https://github.com/aidenlx/cm-chs-patch to enable this feature +* Settings page https://github.com/scambier/obsidian-omnisearch/issues/41 +* Do not show indexing Notice by default by @chrisgrieser in https://github.com/scambier/obsidian-omnisearch/pull/46 +* Include notes that don't exist https://github.com/scambier/obsidian-omnisearch/issues/14 + +### Improved + +* Better accessibility https://github.com/scambier/obsidian-omnisearch/issues/50 +* Note aliases are now scored as high as the filename in search results https://github.com/scambier/obsidian-omnisearch/issues/34 +* By default, reindexing is now done when the app is out of focus, and not after each save https://github.com/scambier/obsidian-omnisearch/issues/57 + * On mobile, indexing is only done at startup + +### Fixed + +* Showing an error when a note can't be created https://github.com/scambier/obsidian-omnisearch/issues/52 + + +## 1.2.x + +### New +* #42 Files that are present in Obsidian's "Excluded Files" list are downranked by a factor of 3 (_desktop only_) + +## 1.1.1 + +### Fixes +* Fixed a crash when no results were returned + +## 1.1.0 + +### New +* #25 Search filters: expressions in quotes and exclusions +* Added support for beta versions with [BRAT](https://github.com/TfTHacker/obsidian42-brat) + +This works as a "post-search" filter and does not allow for partial words searches (see #35) + +### Fixes +* #39 Fixed key events not correctly prevented in the search input + +**Full Changelog**: https://github.com/scambier/obsidian-omnisearch/compare/1.0.1...1.1.0 + +## 1.0.1 + +## 1.0.0 + +* First non-beta release +* Includes Vault search and In-File search diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fdfec7a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing to Omnisearch + +_This document is a Work In Progress._ + +Thank you for wanting to make Omnisearch an even better plugin :) + +Please read this document before beginning work on a Pull Request. + +## Preface + +- Omnisearch is a personal hobby project. I'm happy to discuss about your ideas and additions, but ultimately it is my code to grow and maintain. +- ❗ Always file an issue/feature request before working on a PR, to make sure we're aligned and no-one is making useless work. + +## "Good First Issue" + +Are you a beginner, looking for a small open source contribution? Look at the "[good first issues](https://github.com/scambier/obsidian-omnisearch/labels/good%20first%20issue)". Those issues have a limited scope, don't require intricate knowledge of the code, and are easy enough to locate, fix, and test. + +If you wish to work on one of these issues, leave a comment and I'll assign it to you and give you some pointers. + +## Code guidelines + +- ❗ By default, start your fork from the `develop` branch. If the `develop` branch is behind `master`, then use `master`. When in doubt, ask :) +- Don't add npm dependencies if you can avoid it. If a new dependency is unavoidable, be mindful of its size, freshness and added value. +- Use Svelte for all UI needs. +- Try to not shoehorn your code into existing functions or components. +- Simple is better. OOP is not inevitable. Simple functions often work as well, if not better. +- If you must use OOP, avoid inheritance as much as possible, no one likes digging several layers of abstraction. +- Comment the code. What, why, how, just make your intent clear. + +## Philosphy + +Always respect those UI & UX points: +- The core feature of Omnisearch is its "smartness". + - The simplest queries must bring relevant results. +- The search interface is a means to an end. + - The less user interactions, the better. + - All settings must have sane defaults. +- The UI must not block / show visible lag. +- Keyboard navigation first +- If you're adding a feature, make it toggleable (if desirable). +- The results must always come fast by default. + +## Style guidelines + +- .ts files must be formatted with "Prettier ESLint" +- .svelte files must be formatted with "Svelte for VS Code" +- All CSS code **must** go into styles.css, and all classes should be properly named for easy customization. Do **not** use `