You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/Choices/MacroChoice.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,17 +115,21 @@ The **Paste with format** command preserves rich formatting when pasting content
115
115
116
116
## User Scripts
117
117
118
-
User scripts are JavaScript files that extend macro functionality. They have access to:
118
+
User scripts are JavaScript code stored in `.js` files (or markdown notes with a
119
+
single `js`/`javascript` code block). They have access to:
119
120
- The Obsidian app object
120
121
- The QuickAdd API
121
122
- A variables object for passing data between commands
122
123
123
124
:::warning Script Placement Requirements
124
125
125
-
User scripts (.js files) must be placed in your Obsidian vault, but **NOT** in the `.obsidian` directory or in hidden folders (folders starting with a dot).
126
+
User scripts (`.js` files, or `.md` notes with a single `js`/`javascript` code
127
+
block) must be placed in your Obsidian vault, but **NOT** in the `.obsidian`
128
+
directory or in hidden folders (folders starting with a dot).
126
129
127
130
✅ **Valid locations:**
128
131
-`/scripts/myScript.js`
132
+
-`/scripts/myScript.md`
129
133
-`/_quickadd/scripts/myScript.js`
130
134
-`/macros/utilities/helper.js`
131
135
-`/my-custom-folder/script.js`
@@ -143,6 +147,17 @@ Scripts placed in the `.obsidian` directory or hidden folders are intentionally
143
147
144
148
:::
145
149
150
+
### Markdown-Backed Scripts (.md)
151
+
152
+
QuickAdd also supports scripts stored inside markdown notes. The note must
Copy file name to clipboardExpand all lines: docs/docs/UserScripts.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
# User Scripts
2
2
3
-
User scripts are JavaScript files that extend QuickAdd's functionality with custom code. They can be used within macros to perform complex operations, integrate with external APIs, and automate sophisticated workflows.
3
+
User scripts are JavaScript code stored in `.js` files (or markdown notes with a
4
+
single `js`/`javascript` code block). They can be used within macros to perform
5
+
complex operations, integrate with external APIs, and automate sophisticated
6
+
workflows.
4
7
5
8
> 📚 **Obsidian API Reference**: This guide references the [Obsidian API](https://docs.obsidian.md/Home). Familiarize yourself with the [App](https://docs.obsidian.md/Reference/TypeScript+API/App), [Vault](https://docs.obsidian.md/Reference/TypeScript+API/Vault), and [Workspace](https://docs.obsidian.md/Reference/TypeScript+API/Workspace) modules for advanced scripting.
6
9
@@ -33,6 +36,26 @@ async function start(params, settings) {
33
36
}
34
37
```
35
38
39
+
## Markdown-Backed Scripts (.md)
40
+
41
+
QuickAdd can also run scripts stored inside markdown notes. To do this, the note
42
+
must contain **exactly one** fenced code block tagged `js` or `javascript`
43
+
(case-insensitive). All other text in the note is ignored.
0 commit comments