# obsidian-quick-preview

> An Obsidian.md plugin to quickly preview a suggestion before selecting it in link suggestions & quick swicher.

Latest version **0.5.10** (published 2023-12-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install obsidian-quick-preview
pnpm add obsidian-quick-preview
yarn add obsidian-quick-preview
bun add obsidian-quick-preview
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.10 |
| Published | 2023-12-17 |
| First published | 2023-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 93.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryota Ushio |
| Maintainers | ryotaushio |

## Links

- npm: https://www.npmjs.com/package/obsidian-quick-preview
- npm.io page: https://npm.io/package/obsidian-quick-preview

## Dependencies (1)

- [monkey-around](https://npm.io/package/monkey-around.md) ^2.3.0

## Recent versions

- 0.5.10 (latest) — 2023-12-17
- 0.5.9 — 2023-12-12
- 0.5.8 — 2023-12-12
- 0.5.6 — 2023-12-11
- 0.5.5 — 2023-12-09
- 0.5.4 — 2023-12-09
- 0.5.3 — 2023-12-09
- 0.5.2 — 2023-12-09
- 0.5.1 — 2023-12-09
- 0.5.0 — 2023-12-08
- 0.4.5 — 2023-12-07
- 0.4.4 — 2023-12-07
- 0.4.1 — 2023-12-07
- 0.4.0 — 2023-12-07

## README

# Obsidian Quick Preview

This [Obsidian.md](https://obsidian.md) plugin adds a ***quick preview*** functionality to
- [Link suggestions](https://help.obsidian.md/Linking+notes+and+files/Internal+links),
- [Quick switcher](https://help.obsidian.md/Plugins/Quick+switcher),
- and even [Quick switcher++](https://github.com/darlal/obsidian-switcher-plus).

Hold down `Alt`/`Option` (by default) to quickly preview a suggestion before actually selecting it.

### Link suggestions ([file](https://help.obsidian.md/Linking+notes+and+files/Internal+links#Link%20to%20a%20file)/[heading](https://help.obsidian.md/Linking+notes+and+files/Internal+links#Link%20to%20a%20heading%20in%20a%20note)/[block](https://help.obsidian.md/Linking+notes+and+files/Internal+links#Link%20to%20a%20block%20in%20a%20note))

![Screen Recording 2023-12-13 at 18 27 42](https://github.com/RyotaUshio/obsidian-quick-preview/assets/72342591/3dec5c7d-e74e-4f8d-a0f3-43e424dbbee9)

### Quick switcher / Quick switcher++

![Screen Recording 2023-12-13 at 18 24 34](https://github.com/RyotaUshio/obsidian-quick-preview/assets/72342591/4eaae76b-b0fa-425f-a3ff-857b70e9a02a)

> [!tip]
> - You can adjust the font size for quick preview via [Style Settings](https://github.com/mgmeyers/obsidian-style-settings).
> - **Other plugins also can utilize the quick preview feature via the API**. See [below](#using-the-api) for more details.

## Installation

You can find this plugin in the community plugin browser within Obsidian.

You can also install the latest beta release using [BRAT](https://github.com/TfTHacker/obsidian42-brat):

1.  Install BRAT and enable it.
2.  Go to `Options`. In the `Beta Plugin List` section, click on the `Add Beta plugin` button.
3.  Copy and paste `RyotaUshio/obsidian-quick-preview` in the pop-up prompt and click on **Add Plugin**.
4.  _(Optional but highly recommended)_ Turn on `Auto-update plugins at startup` at the top of the page.
5.  Go to `Community plugins > Installed plugins`. You will find “Quick Preview” in the list. Click on the toggle button to enable it.

## Using the API

This plugin provides an API to allow other plugins to add the quick preview functionality to their custom suggesters. Supported suggester types are:

- [`SuggestModal`](https://docs.obsidian.md/Reference/TypeScript+API/SuggestModal)
- [`PopoverSuggest`](https://docs.obsidian.md/Reference/TypeScript+API/PopoverSuggest), including:
  - [`EditorSuggest`](https://docs.obsidian.md/Reference/TypeScript+API/EditorSuggest)
  - [`AbstractInputSuggest`](https://docs.obsidian.md/Reference/TypeScript+API/AbstractInputSuggest)

### Installation

```
npm install -D obsidian-quick-preview
```

### Usage examples

```ts
import { Plugin, EditorSuggest, SuggestModal, TFile, SectionCache } from "obsidian";
import { registerQuickPreview } from "obsidian-quick-preview";

class MyCustomEditorSuggest extends EditorSuggest<{ file: TFile }> { ... }

class MyCustomSuggestModal extends SuggestModal<{ path: string, cache: SectionCache }> { ... }

export default MyPlugin extends Plugin {
    excludedFiles: string[];

    onload() {
        registerQuickPreview(this.app, this, MyCustomEditorSuggest, (item) => {
            // - `linktext` can be any string representing a proper internal link,
            //   e.g. "note", "note.md", "folder/note", "folder/note.md", "note#heading", "note#^block-id" etc
            // - `sourcePath` is used to resolve relative links. In many cases, you can just pass an empty string.
            return { linktext: item.file.path, sourcePath: "" };
        });
        // or
        registerQuickPreview(this.app, this, MyCustomSuggestModal, (item) => {
            if (this.excludedFiles.contains(item.path)) {
                // Return `null` when you don't want to show a quick preview for the item.
                return null;
            }
            // Add a `line` parameter to focus on a specific line.
            return { linktext: item.path, sourcePath: "", line: item.cache.position.start.line };
        });
    }
}

```

## Support development

If you find my plugins useful, please support my work by buying me a coffee!

<a href="https://www.buymeacoffee.com/ryotaushio" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

---
_Source: https://npm.io/package/obsidian-quick-preview · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
