Skip to content

Startup scripts new settings #2

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
29 changes: 29 additions & 0 deletions src/content/docs/guides/startupscripts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
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.
There you will see a list of all JavaScript files detected inside the vault and
you can enable the ones you want to run at startup.

### Setting a folder for startup-scripts

To reduce the list of shown files you can define the name of a folder you use to store your scripts.
JS-Engine will only check that folder and only list files inside it as options.

## Global Variables

JS-Engine runs the scripts in the same context as all other code-blocks.
So the available global variable are the same and can be found [here](/obsidian-js-engine-plugin-docs/api/classes/api/).