Skip to content

add usage page for startup-scripts #1

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

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/content/docs/guides/startupscripts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Startup-Scripts
description: A guide on how to use startup-scripts.
---

JS-Engine supports startup-scripts, similar to the CSS-snippets from Core-Obsidian.

You can select the script-file you want to use as startup-scripts and JS-Engine will run them for you when never Obsidian starts up.

:::note
Different from Core-Obsidian, JS-Engine startup-scripts can not be stored inside the `.obsidian/` folder.
They need to be somewhere inside your vault.
:::

## Configuring Startup-Scripts

You can configure which files you want to have run from JS-Engines settings tab.

## Global Variables

JS-Engine runs the scripts in the same context as all other code-blocks.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small correction, it's not entirely the same. Startup scripts run with a JSFileExecutionContext and code blocks run with a MarkdownCodeBlockExecutionContext, but that is also not properly documented yet.

So the available global variable are the same and can be found [here](/obsidian-js-engine-plugin-docs/api/classes/api/).