Quick Preview
approvedby Ryota Ushio
Quickly preview a suggestion before selecting it in link suggestions & quick switcher.
Obsidian Quick Preview
This Obsidian.md plugin adds a quick preview functionality to
- Link suggestions,
- Quick switcher,
- and even Quick switcher++.
- New in 0.6.0: Canvas's note/media suggestion is now supported as well!
Hold down Alt/Option (by default) to quickly preview a suggestion before actually selecting it.
Link suggestions (file/heading/block)
Quick switcher / Quick switcher++
[!tip]
- You can adjust the font size for quick preview via Style Settings.
- Other plugins also can utilize the quick preview feature via the API. See below 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:
- Install the latest version of BRAT and enable it.
- Open the following URL in browser:
obsidian://brat?plugin=RyotaUshio/obsidian-quick-preview. - Click the "Add Plugin" button.
- (Optional but highly recommended) In the BRAT settings, turn on
Auto-update plugins at startupat the top of the page.
Reporting problems
If you find a problem about this plugin, please report it by filing an issue from here.
It'd be helpful if you could attatch the following information:
- Result of the "Show debug info" command
- Screenshot of the plugin settings
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:
SuggestModalPopoverSuggest, including:
Installation
npm install -D obsidian-quick-preview
Usage examples
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!
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.
