Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add obisidian API's free functions to API #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dljsjr
Copy link
Contributor

@dljsjr dljsjr commented Feb 20, 2025

Adds the Obsidian free functions to the app object under the functions object.

This provides access to a bunch of useful built-in Obsidian utilities via the local API.

Adds the obsidian free functions to the `app` object under the
`functions` object.
@blacksmithgu
Copy link
Owner

Aren't these already available as app.<function>? I thought the Obsidian app object was already in the global context.

@FeralFlora
Copy link

Aren't these already available as app.<function>? I thought the Obsidian app object was already in the global context.

Usage of global app is discouraged, see:
https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Avoid+using+global+app+instance

and:
https://github.com/Fevol/obsidian-typings/blob/main/CHANGELOG.md#114

NOTE: the global app variable has been removed from the official Obsidian API as of 1.6.0, it will not be re-added by obsidian-typings

@dljsjr
Copy link
Contributor Author

dljsjr commented Mar 5, 2025

Aren't these already available as app.<function>? I thought the Obsidian app object was already in the global context.

No, the free functions like normalizePath aren't attached to the app object. They're exported as part of the obsidian namespace, meaning they aren't available to code blocks since you can't import "obsidian"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants