Skip to content

Commit

Permalink
Merge pull request #103 from obsidianmd/7992202596
Browse files Browse the repository at this point in the history
Auto-generate docs for obsidian.d.ts
  • Loading branch information
joethei authored Feb 21, 2024
2 parents e3ba529 + 5b5634e commit a584d19
Show file tree
Hide file tree
Showing 67 changed files with 527 additions and 407 deletions.
3 changes: 2 additions & 1 deletion en/Reference/TypeScript API/AbstractInputSuggest.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cssclasses: hide-title

## AbstractInputSuggest class

Attach to an <input> element or a &lt;<!-- -->div contentEditable<!-- -->&gt; to add type-ahead support.
Attach to an `<input>` element or a `<div contentEditable>` to add type-ahead support.

**Signature:**

Expand All @@ -34,6 +34,7 @@ export abstract class AbstractInputSuggest<T> extends PopoverSuggest<T>
| Method | Modifiers | Description |
| --- | --- | --- |
| [`getSuggestions(query)`](obsidian.AbstractInputSuggest.getSuggestions.md) | <p><code>protected</code></p><p><code>abstract</code></p> | |
| [`getValue()`](obsidian.AbstractInputSuggest.getValue.md) | | Gets the value from the input element. |
| [`onSelect(callback)`](obsidian.AbstractInputSuggest.onSelect.md) | | Registers a callback to handle when a suggestion is selected by the user. |
| [`setValue(value)`](obsidian.AbstractInputSuggest.setValue.md) | | Sets the value into the input element. |
Expand Down
28 changes: 28 additions & 0 deletions en/Reference/TypeScript API/AbstractInputSuggest/getSuggestions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
aliases: "obsidian.AbstractInputSuggest.getSuggestions.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`AbstractInputSuggest`](obsidian.AbstractInputSuggest.md)[`getSuggestions`](obsidian.AbstractInputSuggest.getSuggestions.md)

## AbstractInputSuggest.getSuggestions() method


**Signature:**

```typescript
protected abstract getSuggestions(query: string): T[] | Promise<T[]>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| <code>query</code> | <code>string</code> | |

**Returns:**

`T[] | ``Promise``<T[]>`

6 changes: 3 additions & 3 deletions en/Reference/TypeScript API/Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export interface Command
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [`callback?`](obsidian.Command.callback.md) | | <code>() =&gt; any</code> | _(Optional)_ Simple callback, triggered globally. |
| [`checkCallback?`](obsidian.Command.checkCallback.md) | | <code>(checking: boolean) =&gt; boolean &#124; void</code> | _(Optional)_ Complex callback, overrides the simple callback. Used to "check" whether your command can be performed in the current circumstances. For example, if your command requires the active focused pane to be a MarkdownSourceView, then you should only return true if the condition is satisfied. Returning false or undefined causes the command to be hidden from the command palette. |
| [`checkCallback?`](obsidian.Command.checkCallback.md) | | <code>(checking: boolean) =&gt; boolean &#124; void</code> | _(Optional)_ Complex callback, overrides the simple callback. Used to "check" whether your command can be performed in the current circumstances. For example, if your command requires the active focused pane to be a MarkdownView, then you should only return true if the condition is satisfied. Returning false or undefined causes the command to be hidden from the command palette. |
| [`editorCallback?`](obsidian.Command.editorCallback.md) | | <code>(editor: </code>[`Editor`](obsidian.Editor.md)<code>, ctx: </code>[`MarkdownView`](obsidian.MarkdownView.md)<code> &#124; </code>[`MarkdownFileInfo`](obsidian.MarkdownFileInfo.md)<code>) =&gt; any</code> | _(Optional)_ A command callback that is only triggered when the user is in an editor. Overrides <code>callback</code> and <code>checkCallback</code> |
| [`editorCheckCallback?`](obsidian.Command.editorCheckCallback.md) | | <code>(checking: boolean, editor: </code>[`Editor`](obsidian.Editor.md)<code>, ctx: </code>[`MarkdownView`](obsidian.MarkdownView.md)<code> &#124; </code>[`MarkdownFileInfo`](obsidian.MarkdownFileInfo.md)<code>) =&gt; boolean &#124; void</code> | _(Optional)_ A command callback that is only triggered when the user is in an editor. Overrides <code>editorCallback</code>, <code>callback</code> and <code>checkCallback</code> |
| [`hotkeys?`](obsidian.Command.hotkeys.md) | | [`Hotkey`](obsidian.Hotkey.md)<code>[]</code> | _(Optional)_ Sets the default hotkey. It is recommended for plugins to avoid setting default hotkeys if possible, to avoid conflicting hotkeys with one that's set by the user, even though customized hotkeys have higher priority. |
| [`icon?`](obsidian.Command.icon.md) | | [`IconName`](obsidian.IconName.md) | _(Optional)_ Icon ID to be used in the toolbar. |
| [`icon?`](obsidian.Command.icon.md) | | [`IconName`](obsidian.IconName.md) | _(Optional)_ Icon ID to be used in the toolbar. See [https://docs.obsidian.md/Plugins/User+interface/Icons](https://docs.obsidian.md/Plugins/User+interface/Icons) for available icons and how to add your own. |
| [`id`](obsidian.Command.id.md) | | <code>string</code> | Globally unique ID to identify this command. |
| [`mobileOnly?`](obsidian.Command.mobileOnly.md) | | <code>boolean</code> | _(Optional)_ |
| [`name`](obsidian.Command.name.md) | | <code>string</code> | Human friendly name for searching. |
| [`repeatable?`](obsidian.Command.repeatable.md) | | <code>boolean</code> | _(Optional)_ Whether holding the hotkey should repeatedly trigger this command. Defaults to false. |
| [`repeatable?`](obsidian.Command.repeatable.md) | | <code>boolean</code> | _(Optional)_ Whether holding the hotkey should repeatedly trigger this command. |

14 changes: 14 additions & 0 deletions en/Reference/TypeScript API/Command/callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ Simple callback, triggered globally.
```typescript
callback?: () => any;
```

## Example


```ts
this.addCommand({
id: "print-greeting-to-console",
name: "Print greeting to console",
callback: () => {
console.log("Hey, you!");
},
});
```

25 changes: 24 additions & 1 deletion en/Reference/TypeScript API/Command/checkCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,33 @@ cssclasses: hide-title

## Command.checkCallback property

Complex callback, overrides the simple callback. Used to "check" whether your command can be performed in the current circumstances. For example, if your command requires the active focused pane to be a MarkdownSourceView, then you should only return true if the condition is satisfied. Returning false or undefined causes the command to be hidden from the command palette.
Complex callback, overrides the simple callback. Used to "check" whether your command can be performed in the current circumstances. For example, if your command requires the active focused pane to be a MarkdownView, then you should only return true if the condition is satisfied. Returning false or undefined causes the command to be hidden from the command palette.

**Signature:**

```typescript
checkCallback?: (checking: boolean) => boolean | void;
```

## Example


```ts
this.addCommand({
id: 'example-command',
name: 'Example command',
checkCallback: (checking: boolean) => {
const value = getRequiredValue();

if (value) {
if (!checking) {
doCommand(value);
}
return true;
}

return false;
}
});
```

16 changes: 16 additions & 0 deletions en/Reference/TypeScript API/Command/editorCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@ A command callback that is only triggered when the user is in an editor. Overrid
```typescript
editorCallback?: (editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => any;
```

## Example


```ts
this.addCommand({
id: 'example-command',
name: 'Example command',
editorCallback: (editor: Editor, view: MarkdownView) => {
const sel = editor.getSelection();

console.log(`You have selected: ${sel}`);
}
});
```

24 changes: 24 additions & 0 deletions en/Reference/TypeScript API/Command/editorCheckCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,27 @@ A command callback that is only triggered when the user is in an editor. Overrid
```typescript
editorCheckCallback?: (checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => boolean | void;
```

## Example


```ts
this.addCommand({
id: 'example-command',
name: 'Example command',
editorCheckCallback: (checking: boolean, editor: Editor, view: MarkdownView) => {
const value = getRequiredValue();

if (value) {
if (!checking) {
doCommand(value);
}

return true;
}

return false;
}
});
```

2 changes: 1 addition & 1 deletion en/Reference/TypeScript API/Command/icon.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cssclasses: hide-title

## Command.icon property

Icon ID to be used in the toolbar.
Icon ID to be used in the toolbar. See [https://docs.obsidian.md/Plugins/User+interface/Icons](https://docs.obsidian.md/Plugins/User+interface/Icons) for available icons and how to add your own.

**Signature:**

Expand Down
2 changes: 1 addition & 1 deletion en/Reference/TypeScript API/Command/repeatable.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cssclasses: hide-title

## Command.repeatable property

Whether holding the hotkey should repeatedly trigger this command. Defaults to false.
Whether holding the hotkey should repeatedly trigger this command.

**Signature:**

Expand Down
2 changes: 1 addition & 1 deletion en/Reference/TypeScript API/DataAdapter/rmdir.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ rmdir(normalizedPath: string, recursive: boolean): Promise<void>;
| Parameter | Type | Description |
| --- | --- | --- |
| <code>normalizedPath</code> | <code>string</code> | path to folder, use [normalizePath()](obsidian.normalizePath.md) to normalize beforehand. |
| <code>recursive</code> | <code>boolean</code> | If <code>true</code>, delete folders under this folder recursively, if `<!-- -->false´ the folder needs to be empty. |
| <code>recursive</code> | <code>boolean</code> | If <code>true</code>, delete folders under this folder recursively, if <code>false</code> the folder needs to be empty. |

**Returns:**

Expand Down
1 change: 1 addition & 0 deletions en/Reference/TypeScript API/FileManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class FileManager
| Method | Modifiers | Description |
| --- | --- | --- |
| [`generateMarkdownLink(file, sourcePath, subpath, alias)`](obsidian.FileManager.generateMarkdownLink.md) | | Generate a markdown link based on the user's preferences. |
| [`getAvailablePathForAttachment(filename, sourcePath)`](obsidian.FileManager.getAvailablePathForAttachment.md) | | Resolves a unique path for the attachment file being saved. Ensures that the parent directory exists and dedupes the filename if the destination filename already exists. |
| [`getNewFileParent(sourcePath, newFilePath)`](obsidian.FileManager.getNewFileParent.md) | | Gets the folder that new files should be saved to, given the user's preferences. |
| [`processFrontMatter(file, fn, options)`](obsidian.FileManager.processFrontMatter.md) | | <p>Atomically read, modify, and save the frontmatter of a note. The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result.</p><p>Remember to handle errors thrown by this method.</p> |
| [`renameFile(file, newPath)`](obsidian.FileManager.renameFile.md) | | Rename or move a file safely, and update all links to it depending on the user's preferences. |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
aliases: "obsidian.FileManager.getAvailablePathForAttachment.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FileManager`](obsidian.FileManager.md)[`getAvailablePathForAttachment`](obsidian.FileManager.getAvailablePathForAttachment.md)

## FileManager.getAvailablePathForAttachment() method

Resolves a unique path for the attachment file being saved. Ensures that the parent directory exists and dedupes the filename if the destination filename already exists.

**Signature:**

```typescript
getAvailablePathForAttachment(filename: string, sourcePath?: string): Promise<string>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| <code>filename</code> | <code>string</code> | Name of the attachment being saved |
| <code>sourcePath</code> | <code>string</code> | _(Optional)_ The path to the note associated with this attachment, defaults to the workspace's active file. |

**Returns:**

`Promise``<string>`

Full path for where the attachment should be saved, according to the user's settings

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ processFrontMatter(file: TFile, fn: (frontmatter: any) => void, options?: DataWr
| Parameter | Type | Description |
| --- | --- | --- |
| <code>file</code> | [`TFile`](obsidian.TFile.md) | the file to be modified. Must be a markdown file. |
| <code>fn</code> | <code>(frontmatter: any) =&gt; void</code> | a callback function which mutates the frontMatter object synchronously. |
| <code>fn</code> | <code>(frontmatter: any) =&gt; void</code> | a callback function which mutates the frontmatter object synchronously. |
| <code>options</code> | [`DataWriteOptions`](obsidian.DataWriteOptions.md) | _(Optional)_ write options. |

**Returns:**
Expand Down
28 changes: 28 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
aliases: "obsidian.FrontMatterInfo.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)

## FrontMatterInfo interface


**Signature:**

```typescript
export interface FrontMatterInfo
```

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [`contentStart`](obsidian.FrontMatterInfo.contentStart.md) | | <code>number</code> | Offset where the frontmatter block ends (including the \-\-\-) |
| [`exists`](obsidian.FrontMatterInfo.exists.md) | | <code>boolean</code> | Whether this file has a frontmatter block |
| [`from`](obsidian.FrontMatterInfo.from.md) | | <code>number</code> | Start of the frontmatter contents (excluding the \-\-\-) |
| [`frontmatter`](obsidian.FrontMatterInfo.frontmatter.md) | | <code>string</code> | String representation of the frontmatter |
| [`to`](obsidian.FrontMatterInfo.to.md) | | <code>number</code> | End of the frontmatter contents (excluding the \-\-\-) |

18 changes: 18 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo/contentStart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
aliases: "obsidian.FrontMatterInfo.contentStart.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)[`contentStart`](obsidian.FrontMatterInfo.contentStart.md)

## FrontMatterInfo.contentStart property

Offset where the frontmatter block ends (including the \-\-\-)

**Signature:**

```typescript
contentStart: number;
```
18 changes: 18 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo/exists.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
aliases: "obsidian.FrontMatterInfo.exists.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)[`exists`](obsidian.FrontMatterInfo.exists.md)

## FrontMatterInfo.exists property

Whether this file has a frontmatter block

**Signature:**

```typescript
exists: boolean;
```
18 changes: 18 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo/from.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
aliases: "obsidian.FrontMatterInfo.from.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)[`from`](obsidian.FrontMatterInfo.from.md)

## FrontMatterInfo.from property

Start of the frontmatter contents (excluding the \-\-\-)

**Signature:**

```typescript
from: number;
```
18 changes: 18 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo/frontmatter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
aliases: "obsidian.FrontMatterInfo.frontmatter.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)[`frontmatter`](obsidian.FrontMatterInfo.frontmatter.md)

## FrontMatterInfo.frontmatter property

String representation of the frontmatter

**Signature:**

```typescript
frontmatter: string;
```
18 changes: 18 additions & 0 deletions en/Reference/TypeScript API/FrontMatterInfo/to.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
aliases: "obsidian.FrontMatterInfo.to.md"
cssclasses: hide-title
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[`FrontMatterInfo`](obsidian.FrontMatterInfo.md)[`to`](obsidian.FrontMatterInfo.to.md)

## FrontMatterInfo.to property

End of the frontmatter contents (excluding the \-\-\-)

**Signature:**

```typescript
to: number;
```
7 changes: 4 additions & 3 deletions en/Reference/TypeScript API/Keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cssclasses: hide-title

## Keymap class

Manages keymap lifecycle for different [Scope](obsidian.Scope.md)<!-- -->s.

**Signature:**

Expand All @@ -21,7 +22,7 @@ export class Keymap
| Method | Modifiers | Description |
| --- | --- | --- |
| [`isModEvent(evt)`](obsidian.Keymap.isModEvent.md) | <code>static</code> | Translates an event into the type of pane that should open. Returns 'tab' if the modifier key Cmd/Ctrl is pressed OR if this is a middle-click MouseEvent. Returns 'split' if Cmd/Ctrl+Alt is pressed. Returns 'window' if Cmd/Ctrl+Alt+Shift is pressed. |
| [`isModifier(evt, modifier)`](obsidian.Keymap.isModifier.md) | <code>static</code> | Checks whether the modifier key is pressed during this event |
| [`popScope(scope)`](obsidian.Keymap.popScope.md) | | |
| [`pushScope(scope)`](obsidian.Keymap.pushScope.md) | | |
| [`isModifier(evt, modifier)`](obsidian.Keymap.isModifier.md) | <code>static</code> | Checks whether the modifier key is pressed during this event. |
| [`popScope(scope)`](obsidian.Keymap.popScope.md) | | Remove a scope from the scope stack. If the given scope is active, the next scope in the stack will be made active. |
| [`pushScope(scope)`](obsidian.Keymap.pushScope.md) | | Push a scope onto the scope stack, setting it as the active scope to handle all key events. |

2 changes: 1 addition & 1 deletion en/Reference/TypeScript API/Keymap/isModifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cssclasses: hide-title

## Keymap.isModifier() method

Checks whether the modifier key is pressed during this event
Checks whether the modifier key is pressed during this event.

**Signature:**

Expand Down
Loading

0 comments on commit a584d19

Please sign in to comment.