using-obsidian-api
This rule provides instruction for interacting with the Obsidian API
Installation
Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.
Voir la source ↗GuidesInstructions
Obsidian Bases API
Main types
-
BasesEntry: Represents a note/entry with properties -
BasesViewConfig: View configuration (user options) -
BasesPropertyId: Property identifier (string) -
App: Obsidian application instance -
TFile: Obsidian file
Data access
// Get property value
const value = entry.getValue(propertyId);
// Get property display name
const displayName = config.getDisplayName(propertyId);
// Get image (resolves internal and external paths)
import { getResourcePath } from "@/lib/obsidian/link";
const imageSrc = getResourcePath(app, imageUrl, entry.file.path);
Context
The Obsidian context exposes shared Obsidian variables.
const { app, component, containerEl, isEmbedded } = useObsidian();
Available hooks
Define and use reusable hooks to wrap Obsidian features in src/hooks to simplify the workflow and increase reusability
// Get config value with default
const layout = useConfigValue<"vertical" | "horizontal">("layout", "vertical");
// Get entry data
const entry = useEntry(entryId);
// Get entry property
const property = useEntryProperty(entryId, propertyId);
// Get entry title
const title = useEntryTitle(entryId);
// Handler to open entry
const handleOpen = useEntryOpen(entryId);
// Handler for hover with preview
const handleHover = useEntryHover(entryId, linkRef);
Exemples
Consultez les exemples du dépôt source.
Voir la source ↗Historique source
- Date d’indexation
- 2026-03-11
- Mise à jour de l’index
- 2026-03-11
- Branch
- main
Les dates concernent ce répertoire. Consultez le dépôt pour l’historique du code.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!