├── .github ├── FUNDING.yml └── workflows │ └── documentation.yml ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── docs ├── contribute.md ├── developer-tools.md ├── editor │ ├── _category_.json │ ├── extensions │ │ ├── _category_.json │ │ ├── communicating-with-editor-extensions.md │ │ ├── decorations.md │ │ ├── decorations.svg │ │ ├── index.md │ │ ├── state-fields.md │ │ ├── state-management.md │ │ ├── view-plugins.md │ │ ├── viewport.md │ │ └── viewport.svg │ ├── index.md │ └── markdown-post-processing.md ├── events.md ├── examples │ ├── _category_.json │ └── insert-link.md ├── getting-started │ ├── _category_.json │ ├── create-your-first-plugin.md │ ├── development-workflow.md │ ├── index.md │ ├── plugin-anatomy.md │ ├── react.md │ └── svelte.md ├── introduction.md ├── publishing │ ├── _category_.json │ ├── release-your-plugin-with-github-actions.md │ ├── submission-guidelines.md │ └── submit-your-plugin.md ├── reference │ ├── _category_.json │ ├── manifest.md │ └── typescript │ │ ├── _category_.json │ │ ├── classes │ │ ├── AbstractTextComponent.md │ │ ├── App.md │ │ ├── BaseComponent.md │ │ ├── ButtonComponent.md │ │ ├── ColorComponent.md │ │ ├── Component.md │ │ ├── DropdownComponent.md │ │ ├── EditableFileView.md │ │ ├── Editor.md │ │ ├── EditorSuggest.md │ │ ├── Events.md │ │ ├── ExtraButtonComponent.md │ │ ├── FileManager.md │ │ ├── FileSystemAdapter.md │ │ ├── FileView.md │ │ ├── FuzzySuggestModal.md │ │ ├── HoverPopover.md │ │ ├── ItemView.md │ │ ├── Keymap.md │ │ ├── MarkdownEditView.md │ │ ├── MarkdownPreviewRenderer.md │ │ ├── MarkdownPreviewView.md │ │ ├── MarkdownRenderChild.md │ │ ├── MarkdownRenderer.md │ │ ├── MarkdownSourceView.md │ │ ├── MarkdownView.md │ │ ├── Menu.md │ │ ├── MenuItem.md │ │ ├── MenuSeparator.md │ │ ├── MetadataCache.md │ │ ├── Modal.md │ │ ├── MomentFormatComponent.md │ │ ├── Notice.md │ │ ├── PluginSettingTab.md │ │ ├── Plugin_2.md │ │ ├── PopoverSuggest.md │ │ ├── Scope.md │ │ ├── SearchComponent.md │ │ ├── Setting.md │ │ ├── SettingTab.md │ │ ├── SliderComponent.md │ │ ├── SuggestModal.md │ │ ├── TAbstractFile.md │ │ ├── TFile.md │ │ ├── TFolder.md │ │ ├── Tasks.md │ │ ├── TextAreaComponent.md │ │ ├── TextComponent.md │ │ ├── TextFileView.md │ │ ├── ToggleComponent.md │ │ ├── ValueComponent.md │ │ ├── Vault.md │ │ ├── View.md │ │ ├── Workspace.md │ │ ├── WorkspaceContainer.md │ │ ├── WorkspaceFloating.md │ │ ├── WorkspaceItem.md │ │ ├── WorkspaceLeaf.md │ │ ├── WorkspaceMobileDrawer.md │ │ ├── WorkspaceParent.md │ │ ├── WorkspaceRibbon.md │ │ ├── WorkspaceRoot.md │ │ ├── WorkspaceSidedock.md │ │ ├── WorkspaceSplit.md │ │ ├── WorkspaceTabs.md │ │ ├── WorkspaceWindow.md │ │ └── _category_.json │ │ ├── enums │ │ ├── PopoverState.md │ │ └── _category_.json │ │ ├── functions │ │ ├── _category_.json │ │ ├── addIcon.md │ │ ├── ajax.md │ │ ├── ajaxPromise.md │ │ ├── arrayBufferToBase64.md │ │ ├── arrayBufferToHex.md │ │ ├── base64ToArrayBuffer.md │ │ ├── createDiv.md │ │ ├── createEl.md │ │ ├── createFragment.md │ │ ├── createSpan.md │ │ ├── createSvg.md │ │ ├── debounce.md │ │ ├── finishRenderMath.md │ │ ├── fish.md │ │ ├── fishAll.md │ │ ├── fuzzySearch.md │ │ ├── getAllTags.md │ │ ├── getBlobArrayBuffer.md │ │ ├── getIcon.md │ │ ├── getIconIds.md │ │ ├── getLinkpath.md │ │ ├── hexToArrayBuffer.md │ │ ├── htmlToMarkdown.md │ │ ├── isBoolean.md │ │ ├── iterateCacheRefs.md │ │ ├── iterateRefs.md │ │ ├── loadMathJax.md │ │ ├── loadMermaid.md │ │ ├── loadPdfJs.md │ │ ├── loadPrism.md │ │ ├── normalizePath.md │ │ ├── parseFrontMatterAliases.md │ │ ├── parseFrontMatterEntry.md │ │ ├── parseFrontMatterStringArray.md │ │ ├── parseFrontMatterTags.md │ │ ├── parseLinktext.md │ │ ├── parseYaml.md │ │ ├── prepareFuzzySearch.md │ │ ├── prepareQuery.md │ │ ├── prepareSimpleSearch.md │ │ ├── ready.md │ │ ├── removeIcon.md │ │ ├── renderMatches.md │ │ ├── renderMath.md │ │ ├── renderResults.md │ │ ├── request.md │ │ ├── requestUrl.md │ │ ├── requireApiVersion.md │ │ ├── resolveSubpath.md │ │ ├── sanitizeHTMLToDom.md │ │ ├── setIcon.md │ │ ├── sleep.md │ │ ├── sortSearchResults.md │ │ ├── stringifyYaml.md │ │ ├── stripHeading.md │ │ └── stripHeadingForLink.md │ │ ├── index.md │ │ ├── interfaces │ │ ├── AjaxOptions.md │ │ ├── Array.md │ │ ├── ArrayConstructor.md │ │ ├── BlockCache.md │ │ ├── BlockSubpathResult.md │ │ ├── CacheItem.md │ │ ├── CachedMetadata.md │ │ ├── CloseableComponent.md │ │ ├── Command.md │ │ ├── Constructor.md │ │ ├── DataAdapter.md │ │ ├── DataWriteOptions.md │ │ ├── Debouncer.md │ │ ├── Document.md │ │ ├── DocumentFragment.md │ │ ├── DomElementInfo.md │ │ ├── EditorChange.md │ │ ├── EditorPosition.md │ │ ├── EditorRange.md │ │ ├── EditorRangeOrCaret.md │ │ ├── EditorScrollInfo.md │ │ ├── EditorSelection.md │ │ ├── EditorSelectionOrCaret.md │ │ ├── EditorSuggestContext.md │ │ ├── EditorSuggestTriggerInfo.md │ │ ├── EditorTransaction.md │ │ ├── Element.md │ │ ├── EmbedCache.md │ │ ├── EventListenerInfo.md │ │ ├── EventRef.md │ │ ├── FileStats.md │ │ ├── FrontMatterCache.md │ │ ├── FuzzyMatch.md │ │ ├── HSL.md │ │ ├── HTMLElement.md │ │ ├── HeadingCache.md │ │ ├── HeadingSubpathResult.md │ │ ├── Hotkey.md │ │ ├── HoverLinkSource.md │ │ ├── HoverParent.md │ │ ├── ISuggestOwner.md │ │ ├── Instruction.md │ │ ├── KeymapContext.md │ │ ├── KeymapEventHandler.md │ │ ├── KeymapInfo.md │ │ ├── LinkCache.md │ │ ├── ListItemCache.md │ │ ├── ListedFiles.md │ │ ├── LivePreviewState.md │ │ ├── Loc.md │ │ ├── MarkdownFileInfo.md │ │ ├── MarkdownPostProcessor.md │ │ ├── MarkdownPostProcessorContext.md │ │ ├── MarkdownPreviewEvents.md │ │ ├── MarkdownSectionInformation.md │ │ ├── MarkdownSubView.md │ │ ├── Math.md │ │ ├── MenuPositionDef.md │ │ ├── Node.md │ │ ├── NumberConstructor.md │ │ ├── ObjectConstructor.md │ │ ├── ObsidianProtocolData.md │ │ ├── OpenViewState.md │ │ ├── PluginManifest.md │ │ ├── Point.md │ │ ├── Pos.md │ │ ├── PreparedQuery.md │ │ ├── RGB.md │ │ ├── Rect_2.md │ │ ├── ReferenceCache.md │ │ ├── RequestParam.md │ │ ├── RequestUrlParam.md │ │ ├── RequestUrlResponse.md │ │ ├── RequestUrlResponsePromise.md │ │ ├── SearchResult.md │ │ ├── SearchResultContainer.md │ │ ├── SectionCache.md │ │ ├── Stat.md │ │ ├── String.md │ │ ├── StringConstructor.md │ │ ├── SubpathResult.md │ │ ├── SvgElementInfo.md │ │ ├── TagCache.md │ │ ├── TooltipOptions.md │ │ ├── Touch.md │ │ ├── UIEvent.md │ │ ├── ViewState.md │ │ ├── ViewStateResult.md │ │ ├── Window.md │ │ ├── WorkspaceWindowInitData.md │ │ └── _category_.json │ │ └── types │ │ ├── Constructor.md │ │ ├── EditorCommandName.md │ │ ├── HexString.md │ │ ├── IconName.md │ │ ├── KeymapEventListener.md │ │ ├── MarkdownViewModeType.md │ │ ├── Modifier.md │ │ ├── ObsidianProtocolHandler.md │ │ ├── PaneType.md │ │ ├── SearchMatchPart.md │ │ ├── SearchMatches.md │ │ ├── SplitDirection.md │ │ ├── TooltipPlacement.md │ │ ├── UserEvent.md │ │ ├── ViewCreator.md │ │ └── _category_.json ├── testing │ ├── _category_.json │ └── mobile-devices.md ├── tutorials │ ├── _category_.json │ └── text-based-file-formats.md ├── user-interface │ ├── _category_.json │ ├── commands.md │ ├── context-menus.md │ ├── html-elements.md │ ├── icons.md │ ├── index.md │ ├── modals.md │ ├── ribbon-actions.md │ ├── settings.md │ ├── status-bar.md │ ├── user-interface.png │ ├── views.md │ └── workspace.md └── vault.md ├── docusaurus.config.js ├── obsidian.d.ts ├── package.json ├── sidebars.js ├── src ├── css │ └── custom.css └── manifest.schema.json ├── static └── img │ ├── command.png │ ├── context-menu-positions.png │ ├── default-violet.webp │ ├── editor-todays-date.gif │ ├── editor-uppercase.gif │ ├── example-insert-link.gif │ ├── fuzzy-suggestion-modal.png │ ├── logo.svg │ ├── modal-input.png │ ├── settings.png │ ├── status-bar.png │ ├── styles.png │ └── suggest-modal.gif ├── tools └── alfred-workflow │ ├── Alfred Obsidian Plugin Docs Search demo.gif │ ├── Obsidian Plugin Docs Search.alfredworkflow │ └── obsi-marcus-doc-search.js └── yarn.lock /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://buymeacoffee.com/marcusolsson 2 | -------------------------------------------------------------------------------- /.github/workflows/documentation.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | gh-release: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v1 13 | - uses: actions/setup-node@v1 14 | with: 15 | node-version: "16.x" 16 | 17 | - name: Add key to allow access to repository 18 | env: 19 | SSH_AUTH_SOCK: /tmp/ssh_agent.sock 20 | run: | 21 | mkdir -p ~/.ssh 22 | ssh-keyscan github.com >> ~/.ssh/known_hosts 23 | echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa 24 | chmod 600 ~/.ssh/id_rsa 25 | cat <> ~/.ssh/config 26 | Host github.com 27 | HostName github.com 28 | IdentityFile ~/.ssh/id_rsa 29 | EOT 30 | 31 | - name: Setup Git config 32 | run: | 33 | git config --global user.email "marcus.olsson@hey.com" 34 | git config --global user.name "Marcus Olsson" 35 | 36 | - name: Release to GitHub Pages 37 | env: 38 | USE_SSH: true 39 | GIT_USER: git 40 | run: | 41 | yarn install 42 | yarn deploy 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | .obsidian 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Obsidian Plugin Developer Docs 2 | 3 | > **Important:** This documentation is now part of the [official Obsidian Developer Docs](https://docs.obsidian.md/). Please create any PRs and issues in the [obsidian-docs](https://github.com/obsidianmd/obsidian-developer-docs) repository instead. 4 | 5 | [![Documentation](https://github.com/marcusolsson/obsidian-plugin-docs/actions/workflows/documentation.yml/badge.svg)](https://github.com/marcusolsson/obsidian-plugin-docs/actions/workflows/documentation.yml) 6 | [![Buy me a coffee](https://img.shields.io/badge/-buy_me_a%C2%A0coffee-gray?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/marcusolsson) 7 | 8 | This is an **unofficial** documentation page for Obsidian plugin development, written using [Docusaurus](https://docusaurus.io/). 9 | 10 | You can see the hosted version on https://marcus.se.net/obsidian-plugin-docs. 11 | 12 | The Obsidian logo is used with permission. 13 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/contribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 9999 3 | --- 4 | 5 | # Contribute to this site 6 | 7 | Thanks for considering contributing to the project! 8 | 9 | There's a link at the bottom of every page that says **Edit this page**. If you click it, you're taken to that docs page on GitHub where you can edit and submit a change right away. 10 | 11 | ## Style guide 12 | 13 | This site uses the [Google developer documentation style guide](https://developers.google.com/style) and the [Microsoft Style Guide](https://docs.microsoft.com/style-guide/welcome/). 14 | 15 | If you see anything that violates any of these style guides, please let me know by [creating an issue on GitHub](https://github.com/marcusolsson/obsidian-plugin-docs/issues/new). 16 | 17 | ## The four types of documentation 18 | 19 | This site hosts four types of documentation: 20 | 21 | - **Tutorials** are _learning-oriented_: they take the reader through a series of steps to complete a project. For example, [Create your first plugin](getting-started/create-your-first-plugin.md). 22 | - **Guides** are _goal-oriented_: they provide step-by-step instructions for how to solve a specific problem. For example, [Settings](user-interface/settings.md). 23 | - **Reference** is _information-oriented_: its only job is to describe. For example, [Plugin](reference/typescript/classes/Plugin_2.md). 24 | - **Concepts** is _understanding-oriented_: they deepen the reader's understanding in a topic. For example, [Workspace](user-interface/workspace.md). 25 | 26 | For more information, refer to [The documentation system](https://documentation.divio.com/) by [Divio](https://www.divio.com/). 27 | 28 | ### Tutorials 29 | 30 | Each tutorial should have the following structure: 31 | 32 | 1. Description of what the reader will have accomplished after the tutorial. 33 | 1. **Prerequisites** section that describes what the reader needs to complete the tutorial. 34 | 1. Headings for each step that start with "Step X — " (that's an [em-dash](https://en.wikipedia.org/wiki/Dash#Em_dash)), followed by a sentence in imperative form. For example, "Step 3 — Submit plugin for review". 35 | 1. Closing section that summarizes what the reader has accomplished, and where they can go next. 36 | 37 | ### Guides 38 | 39 | Each guide should have the following structure: 40 | 41 | 1. Description of the guide. 42 | 1. Summary of what the reader will build or learn in the guide. 43 | 1. Full code example 44 | 1. Detailed explanation of the code example 45 | 46 | The code block for the full code example must have a title with the filename, for example `title="main.ts"`. 47 | 48 | The example must be complete: the reader can copy-paste it into their own editor and run it without modifications. 49 | 50 | For simpler code examples, use [line highlighting](https://docusaurus.io/docs/markdown-features/code-blocks#line-highlighting) to draw the reader's attention to the important parts. 51 | 52 | For more complex code examples you may add one or more code blocks that duplicate sections of the full example, to allow for a more detailed explanation. 53 | -------------------------------------------------------------------------------- /docs/developer-tools.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 110 3 | --- 4 | 5 | # Developer tools 6 | 7 | This page lists tools for plugin developers. While they're not required for building plugins, they can simplify plugin development. 8 | 9 | ## Obsidian Tools 10 | 11 | [Obsidian Tools](https://github.com/obsidian-tools/obsidian-tools) is a collection of tools for plugin developers. 12 | 13 | ## Download all plugins locally 14 | 15 | If you run into a problem, it can be helpful to see how others have solved it. By downloading the entire plugin library to your computer, you can search the source code to find inspiration. 16 | 17 | - [konhi/obsidian-repositories-downloader](https://github.com/konhi/obsidian-repositories-downloader) 18 | - [luckman212/obsidian-plugin-downloader](https://github.com/luckman212/obsidian-plugin-downloader) 19 | - [claremacrae/obsidian-repos-downloader](https://github.com/claremacrae/obsidian-repos-downloader) 20 | 21 | ## Beta testing 22 | 23 | Before you [publish](publishing/submit-your-plugin.md) your plugin, you may want to let users try it out first. 24 | 25 | With the [BRAT](https://github.com/TfTHacker/obsidian42-brat) plugin, your beta testers can install the plugin even if it's not published yet. 26 | 27 | ## Badges 28 | 29 | To add a badge with the number of downloads for your plugin, paste the following in your README and replace `` with your plugin id: 30 | 31 | ```md 32 | ![Obsidian Downloads](https://img.shields.io/badge/dynamic/json?logo=obsidian&color=%23483699&label=downloads&query=%24%5B%22%22%5D.downloads&url=https%3A%2F%2Fraw.githubusercontent.com%2Fobsidianmd%2Fobsidian-releases%2Fmaster%2Fcommunity-plugin-stats.json) 33 | ``` 34 | 35 | For example, here's the download count for the Calendar plugin: 36 | 37 | ![Obsidian Downloads](https://img.shields.io/badge/dynamic/json?logo=obsidian&color=%23483699&label=downloads&query=%24%5B%22calendar%22%5D.downloads&url=https%3A%2F%2Fraw.githubusercontent.com%2Fobsidianmd%2Fobsidian-releases%2Fmaster%2Fcommunity-plugin-stats.json) 38 | 39 | :::tip 40 | 41 | If you'd like to customize the badge, use [Shields.io dynamic badge](https://shields.io/#dynamic-badge) with the following values: 42 | 43 | | Parameter | Value | 44 | |-|-| 45 | | `data type` | `json` | 46 | | `data url` | `https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/community-plugin-stats.json` | 47 | | `query` | `$["your-plugin-id"].downloads` | 48 | 49 | To add a logo, add `&logo=obsidian` to the image URL. 50 | 51 | ::: 52 | -------------------------------------------------------------------------------- /docs/editor/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Editor", 3 | "position": 30 4 | } 5 | -------------------------------------------------------------------------------- /docs/editor/extensions/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Editor extensions" 3 | } 4 | -------------------------------------------------------------------------------- /docs/editor/extensions/communicating-with-editor-extensions.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 40 3 | --- 4 | 5 | # Communicating with editor extensions 6 | 7 | Once you've built your editor extension, you might want to communicate with it from outside the editor. For example, through a [Command](../../user-interface/commands.md), or a [Ribbon action](../../user-interface/ribbon-actions.md). 8 | 9 | You can access the CodeMirror 6 editor from a [MarkdownView](../../reference/typescript/classes/MarkdownView.md). However, since the Obsidian API doesn't actually expose the editor, you need to tell TypeScript to trust that it's there, using `@ts-expect-error`. 10 | 11 | ```ts 12 | import { EditorView } from "@codemirror/view"; 13 | 14 | // @ts-expect-error, not typed 15 | const editorView = view.editor.cm as EditorView; 16 | ``` 17 | 18 | ## View plugin 19 | 20 | You can access the [view plugin](view-plugins.md) instance from the `EditorView.plugin()` method. 21 | 22 | ```ts title="main.ts" {8-12} 23 | this.addCommand({ 24 | id: "example-editor-command", 25 | name: "Example editor command", 26 | editorCallback: (editor, view) => { 27 | // @ts-expect-error, not typed 28 | const editorView = view.editor.cm as EditorView; 29 | 30 | const plugin = editorView.plugin(examplePlugin); 31 | 32 | if (plugin) { 33 | plugin.addPointerToSelection(editorView); 34 | } 35 | }, 36 | }); 37 | ``` 38 | 39 | ## State field 40 | 41 | You can dispatch changes and [state effects](state-fields.md#dispatching-state-effects) directly on the editor view. 42 | 43 | ```ts title="main.ts" {8-12} 44 | this.addCommand({ 45 | id: "example-editor-command", 46 | name: "Example editor command", 47 | editorCallback: (editor, view) => { 48 | // @ts-expect-error, not typed 49 | const editorView = view.editor.cm as EditorView; 50 | 51 | editorView.dispatch({ 52 | effects: [ 53 | // ... 54 | ] 55 | }); 56 | }, 57 | }); 58 | ``` 59 | -------------------------------------------------------------------------------- /docs/editor/extensions/index.md: -------------------------------------------------------------------------------- 1 | # Editor extensions 2 | 3 | Editor extensions let you customize the experience of editing notes in Obsidian. This page explains what editor extensions are, and when to use them. 4 | 5 | Obsidian uses CodeMirror 6 (CM6) to power the Markdown editor. Just like Obsidian, CM6 has plugins of its own, called _extensions_. In other words, an Obsidian _editor extension_ is the same thing as a _CodeMirror 6 extension_. 6 | 7 | The API for building editor extensions is a bit unconventional and requires that you have a basic understanding of its architecture before you get started. This section aims to give you enough context and examples for you to get started. If you want to learn more about building editor extensions, refer to the [CodeMirror 6 documentation](https://codemirror.net/docs/). 8 | 9 | ## Do I need an editor extension? 10 | 11 | Building editor extensions can be challenging, so before you start building one, consider whether you really need it. 12 | 13 | - If you want to change how to convert Markdown to HTML in the Reading view, consider building a [Markdown post processor](../../editor/markdown-post-processing.md). 14 | - If you want to change how the document looks and feels in Live Preview, you need to build an editor extension. 15 | 16 | ## Registering editor extensions 17 | 18 | CodeMirror 6 (CM6) is a powerful engine for editing code using web technologies. At its core, the editor itself has a minimal set of features. Any features you'd expect from a modern editor are available as _extensions_ that you can pick and choose. While Obsidian comes with many of these extensions out-of-the-box, you can also register your own. 19 | 20 | To register an editor extension, use [registerEditorExtension](../../reference/typescript/classes/Plugin_2.md#registereditorextension) in the `onload` method of your Obsidian plugin: 21 | 22 | ```ts 23 | onload() { 24 | this.registerEditorExtension([examplePlugin, exampleField]); 25 | } 26 | ``` 27 | 28 | While CM6 supports several types of extensions, two of the most common ones are [View plugins](view-plugins.md) and [State fields](state-fields.md). 29 | 30 | import DocCardList from '@theme/DocCardList'; 31 | import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/editor/extensions/state-fields.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 2 3 | --- 4 | 5 | # State fields 6 | 7 | A state field is an [editor extension](index.md) that lets you manage custom editor state. This page walks you through building a state field by implementing a calculator extension. 8 | 9 | The calculator should be able to add and subtract a number from the current state, and to reset the state when you want to start over. 10 | 11 | By the end of this page, you'll understand the basic concepts of building a state field. 12 | 13 | :::note 14 | This page aims to distill the official CodeMirror 6 documentation for Obsidian plugin developers. For more detailed information on state fields, refer to [State Fields](https://codemirror.net/docs/guide/#state-fields). 15 | ::: 16 | 17 | ## Prerequisites 18 | 19 | - Basic understanding of [State management](state-management.md). 20 | 21 | ## Defining state effects 22 | 23 | State effects describe the state change you'd like to make. You may think of them as methods on a class. 24 | 25 | In the calculator example, you'd define a state effect for each of the calculator operations: 26 | 27 | ```ts 28 | const addEffect = StateEffect.define(); 29 | const subtractEffect = StateEffect.define(); 30 | const resetEffect = StateEffect.define(); 31 | ``` 32 | 33 | The type between the angle brackets, `<>`, defines the input type for the effect. For example, the number you want to add or subtract. The reset effect doesn't need any input, so you can leave it out. 34 | 35 | ## Defining a state field 36 | 37 | Contrary to what one might think, state fields don't actually _store_ state. They _manage_ it. State fields take the current state, applies any state effects, and returns the new state. 38 | 39 | The state field contains the calculator logic to apply the mathematical operations depending on the effects in a transaction. Since a transaction can contain multiple effects, for example two additions, the state field needs to apply them all one after another. 40 | 41 | ```ts 42 | export const calculatorField = StateField.define({ 43 | create(state: EditorState): number { 44 | return 0; 45 | }, 46 | update(oldState: number, transaction: Transaction): number { 47 | let newState = oldState; 48 | 49 | for (let effect of transaction.effects) { 50 | if (effect.is(addEffect)) { 51 | newState += effect.value; 52 | } else if (effect.is(subtractEffect)) { 53 | newState -= effect.value; 54 | } else if (effect.is(resetEffect)) { 55 | newState = 0; 56 | } 57 | } 58 | 59 | return newState; 60 | }, 61 | }); 62 | ``` 63 | 64 | - `create` returns the value the calculator starts with. 65 | - `update` contains the logic for applying the effects. 66 | - `effect.is()` lets you check the type of the effect before you apply it. 67 | 68 | ## Dispatching state effects 69 | 70 | To apply a state effect to a state field, you need to dispatch it to the editor view as part of a transaction. 71 | 72 | ```ts 73 | view.dispatch({ 74 | effects: [addEffect.of(num)], 75 | }); 76 | ``` 77 | 78 | You can even define a set of helper functions that provide a more familiar API: 79 | 80 | ```ts 81 | export function add(view: EditorView, num: number) { 82 | view.dispatch({ 83 | effects: [addEffect.of(num)], 84 | }); 85 | } 86 | 87 | export function subtract(view: EditorView, num: number) { 88 | view.dispatch({ 89 | effects: [subtractEffect.of(num)], 90 | }); 91 | } 92 | 93 | export function reset(view: EditorView) { 94 | view.dispatch({ 95 | effects: [resetEffect.of(null)], 96 | }); 97 | } 98 | ``` 99 | 100 | ## Next steps 101 | 102 | Provide [Decorations](decorations.md) from your state fields to change how to display the document. 103 | -------------------------------------------------------------------------------- /docs/editor/extensions/state-management.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # State management 6 | 7 | This page aims to give an introduction to state management for [editor extensions](index.md). 8 | 9 | :::note 10 | This page aims to distill the official CodeMirror 6 documentation for Obsidian plugin developers. For more detailed information on state management, refer to [State and Updates](https://codemirror.net/docs/guide/#state-and-updates). 11 | ::: 12 | 13 | ## State changes 14 | 15 | In most applications, you would update state by assigning a new value to a property or variable. As a consequence, the old value is lost forever. 16 | 17 | ```ts 18 | let note = ""; 19 | note = "Heading" 20 | note = "# Heading" 21 | note = "## Heading" // How to undo this? 22 | ``` 23 | 24 | To support features like undoing and redoing changes to a user's workspace, applications like Obsidian instead keep a history of all changes that have been made. To undo a change, you can then go back to a point in time before the change was made. 25 | 26 | | | State | 27 | |---|------------| 28 | | 0 | | 29 | | 1 | Heading | 30 | | 2 | # Heading | 31 | | 3 | ## Heading | 32 | 33 | In TypeScript, you'd then end up with something like this: 34 | 35 | ```ts 36 | const changes: ChangeSpec[] = []; 37 | 38 | changes.push({ from: 0, insert: "Heading" }); 39 | changes.push({ from: 0, insert: "# " }); 40 | changes.push({ from: 0, insert: "#" }); 41 | ``` 42 | 43 | ## Transactions 44 | 45 | Imagine a feature where you select some text and press the double quote, `"` to surround the selection with quotes on both sides. One way to implement the feature would be to: 46 | 47 | 1. Insert `"` at the start of the selection. 48 | 2. Insert `"` at the end of the selection. 49 | 50 | Notice that the implementation consists of _two_ state changes. If you added these to the undo history, the user would need to undo _twice_, once for each double quote. To avoid this, what if you could group these changes so that they appear as one? 51 | 52 | For editor extensions, a group of state changes that happen together is called a _transaction_. 53 | 54 | If you combine what you've learned so far—and if you allow transactions that contain only a single state change—then you can consider state as a _history of transactions_. 55 | 56 | Bringing it all together to implement the surround feature from before in an editor extension, here's how you'd add, or _dispatch_, a transaction to the editor view: 57 | 58 | ```ts 59 | view.dispatch({ 60 | changes: [ 61 | { from: selectionStart, insert: `"` }, 62 | { from: selectionEnd, insert: `"` } 63 | ] 64 | }); 65 | ``` 66 | 67 | ## Next steps 68 | 69 | On this page, you've learned about modeling state as a series of state changes, and how to group them into transactions. 70 | 71 | To learn how to manage custom state in your editor, refer to [State fields](state-fields.md). 72 | -------------------------------------------------------------------------------- /docs/editor/extensions/view-plugins.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 10 3 | --- 4 | 5 | # View plugins 6 | 7 | A view plugin is an [editor extension](index.md) that gives you access to the editor [viewport](viewport.md). 8 | 9 | :::note 10 | This page aims to distill the official CodeMirror 6 documentation for Obsidian plugin developers. For more information on state management, refer to [Affecting the View](https://codemirror.net/docs/guide/#affecting-the-view). 11 | ::: 12 | 13 | ## Prerequisites 14 | 15 | - Basic understanding of the [Viewport](viewport.md). 16 | 17 | ## Creating a view plugin 18 | 19 | View plugins are editor extensions that run _after_ the viewport has been recomputed. While this means that they can access the viewport, it also means that a view plugin can't make any changes that would impact the viewport. For example, by inserting blocks or line breaks into the document. 20 | 21 | :::tip 22 | If you want to make changes that impact the vertical layout of the editor, by for example inserting blocks and line breaks, you need to use a [state field](state-fields.md). 23 | ::: 24 | 25 | To create a view plugin, create a class that implements [PluginValue](https://codemirror.net/docs/ref/#view.PluginValue) and pass it to the [ViewPlugin.fromClass()](https://codemirror.net/docs/ref/#view.ViewPlugin^fromClass) function. 26 | 27 | ```ts title="plugin.ts" 28 | import { 29 | ViewUpdate, 30 | PluginValue, 31 | EditorView, 32 | ViewPlugin, 33 | } from "@codemirror/view"; 34 | 35 | class ExamplePlugin implements PluginValue { 36 | constructor(view: EditorView) { 37 | // ... 38 | } 39 | 40 | update(update: ViewUpdate) { 41 | // ... 42 | } 43 | 44 | destroy() { 45 | // ... 46 | } 47 | } 48 | 49 | export const examplePlugin = ViewPlugin.fromClass(ExamplePlugin); 50 | ``` 51 | 52 | The three methods of the view plugin control its lifecycle: 53 | 54 | - `constructor()` initializes the plugin. 55 | - `update()` updates your plugin when something has changed, for example when the user entered or selected some text. 56 | - `destroy()` cleans up after the plugin. 57 | 58 | While the view plugin in the example works, it doesn't do much. If you want to better understand what causes the plugin to update, you can add a `console.log(update);` line to the `update()` method to print all updates to the console. 59 | 60 | ## Next steps 61 | 62 | Provide [Decorations](decorations.md) from your view plugin to change how to display the document. 63 | -------------------------------------------------------------------------------- /docs/editor/extensions/viewport.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 3 3 | --- 4 | 5 | # Viewport 6 | 7 | The Obsidian editor supports [huge documents](https://codemirror.net/examples/million/) with millions of lines. One of the reasons why this is possible, is because the editor only renders what's visible (and a little bit more). 8 | 9 | Imagine that you want to edit a document that is too big to fit on your monitor. The Obsidian editor creates a "window" that moves across the document, only rendering the content within the window (and ignoring what's outside). This window is known as the editor's _viewport_. 10 | 11 | ![Viewport](viewport.svg) 12 | 13 | Whenever the user scrolls through the document, or when the document itself changes, the viewport becomes out-of-date and needs to be recomputed. 14 | 15 | If you want to build an editor extension that depends on the viewport, refer to [View plugins](view-plugins.md). 16 | 17 | :::note 18 | This page aims to distill the official CodeMirror 6 documentation for Obsidian plugin developers. For more information on state management, refer to [Viewport](https://codemirror.net/docs/guide/#viewport). 19 | ::: 20 | -------------------------------------------------------------------------------- /docs/editor/index.md: -------------------------------------------------------------------------------- 1 | # Editor 2 | 3 | The [`Editor`](../reference/typescript/classes/Editor.md) class exposes operations for reading and manipulating an active Markdown document in edit mode. 4 | 5 | If you want to access the editor in a command, use the [editorCallback](../user-interface/commands.md#editor-commands). 6 | 7 | If you want to use the editor elsewhere, you can access it from the active view: 8 | 9 | ```ts 10 | const view = this.app.workspace.getActiveViewOfType(MarkdownView); 11 | 12 | // Make sure the user is editing a Markdown file. 13 | if (view) { 14 | // highlight-next-line 15 | const cursor = view.editor.getCursor(); 16 | 17 | // ... 18 | } 19 | ``` 20 | 21 | :::note 22 | Obsidian uses [CodeMirror](https://codemirror.net/) (CM) as the underlying text editor, and exposes the CodeMirror editor as part of the API. `Editor` serves as an abstraction to bridge features in CM5 (desktop) and CM6 (mobile). By using `Editor` instead of directly accessing the CodeMirror instance, you ensure that your plugin works on both platforms. 23 | ::: 24 | 25 | ## Insert text at cursor position 26 | 27 | The [`replaceRange()`](../reference/typescript/classes/Editor.md#replacerange) method replaces the text between two cursor positions. If you only give it one position, it inserts the new text between that position and the next. 28 | 29 | The following command inserts today's date at the cursor position: 30 | 31 | ```ts title="main.ts" 32 | import { Editor, moment, Plugin } from "obsidian"; 33 | 34 | export default class ExamplePlugin extends Plugin { 35 | async onload() { 36 | this.addCommand({ 37 | id: "insert-todays-date", 38 | name: "Insert today's date", 39 | editorCallback: (editor: Editor) => { 40 | // highlight-next-line 41 | editor.replaceRange(moment().format("YYYY-MM-DD"), editor.getCursor()); 42 | }, 43 | }); 44 | } 45 | } 46 | ``` 47 | 48 | ![Insert today's date](../../static/img/editor-todays-date.gif) 49 | 50 | ## Replace current selection 51 | 52 | If you want to modify the selected text, use [`replaceSelection()`](../reference/typescript/classes/Editor.md#replaceselection) to replace the current selection with a new text. 53 | 54 | The following command reads the current selection and converts it to uppercase: 55 | 56 | ```ts title="main.ts" 57 | import { Editor, Plugin } from "obsidian"; 58 | 59 | export default class ExamplePlugin extends Plugin { 60 | async onload() { 61 | this.addCommand({ 62 | id: "convert-to-uppercase", 63 | name: "Convert to uppercase", 64 | editorCallback: (editor: Editor) => { 65 | // highlight-start 66 | const selection = editor.getSelection(); 67 | editor.replaceSelection(selection.toUpperCase()); 68 | // highlight-end 69 | }, 70 | }); 71 | } 72 | } 73 | ``` 74 | 75 | ![Convert to uppercase](../../static/img/editor-uppercase.gif) 76 | -------------------------------------------------------------------------------- /docs/editor/markdown-post-processing.md: -------------------------------------------------------------------------------- 1 | # Markdown post processing 2 | 3 | If you want to change how a Markdown document is rendered in the Reading view, you can add your own _Markdown post processor_. As indicated by the name, the post processor runs _after_ the Markdown has been processed into HTML. It lets you add, remove, or replace [HTML elements](../user-interface/html-elements.md) to the rendered document. 4 | 5 | The following example looks for any code block that contains a text between two colons, `:`, and replaces it with an appropriate emoji: 6 | 7 | ```ts title="main.ts" 8 | import { Plugin } from "obsidian"; 9 | import { Emoji } from "./emoji"; 10 | 11 | export default class ExamplePlugin extends Plugin { 12 | async onload() { 13 | // highlight-next-line 14 | this.registerMarkdownPostProcessor((element, context) => { 15 | const codeblocks = element.querySelectorAll("code"); 16 | 17 | for (let index = 0; index < codeblocks.length; index++) { 18 | const codeblock = codeblocks.item(index); 19 | const text = codeblock.innerText.trim(); 20 | const isEmoji = text[0] === ":" && text[text.length - 1] === ":"; 21 | 22 | if (isEmoji) { 23 | // highlight-next-line 24 | context.addChild(new Emoji(codeblock, text)); 25 | } 26 | } 27 | }); 28 | } 29 | } 30 | ``` 31 | 32 | The `Emoji` class extends [`MarkdownRenderChild`](../reference/typescript/classes/MarkdownRenderChild.md), and replaces the code block with a `span` element with the emoji: 33 | 34 | ```ts title="emoji.ts" 35 | import { MarkdownRenderChild } from "obsidian"; 36 | 37 | // highlight-next-line 38 | export class Emoji extends MarkdownRenderChild { 39 | static ALL_EMOJIS: Record = { 40 | ":+1:": "👍", 41 | ":sunglasses:": "😎", 42 | ":smile:": "😄", 43 | }; 44 | 45 | text: string; 46 | 47 | constructor(containerEl: HTMLElement, text: string) { 48 | super(containerEl); 49 | 50 | this.text = text; 51 | } 52 | 53 | onload() { 54 | // highlight-start 55 | const emojiEl = this.containerEl.createSpan({ 56 | text: Emoji.ALL_EMOJIS[this.text] ?? this.text, 57 | }); 58 | this.containerEl.replaceWith(emojiEl); 59 | // highlight-end 60 | } 61 | } 62 | ``` 63 | 64 | ## Post-process Markdown code blocks 65 | 66 | Did you know that you can create [Mermaid](https://mermaid-js.github.io/) diagrams in Obsidian by creating a `mermaid` code block with a text definition like this one?: 67 | 68 | ````md 69 | ```mermaid 70 | flowchart LR 71 | Start --> Stop 72 | ``` 73 | ```` 74 | 75 | If you change to Preview mode, the text in the code block becomes the following diagram: 76 | 77 | ```mermaid 78 | flowchart LR 79 | Start --> Stop 80 | ``` 81 | 82 | If you want to add your own custom code blocks like the Mermaid one, you can use [`registerMarkdownCodeBlockProcessor`](../reference/typescript/classes/Plugin_2.md#registermarkdowncodeblockprocessor). The following example renders a code block with CSV data, as a table: 83 | 84 | ```ts title="main.ts" 85 | import { Plugin } from "obsidian"; 86 | 87 | export default class ExamplePlugin extends Plugin { 88 | async onload() { 89 | this.registerMarkdownCodeBlockProcessor("csv", (source, el, ctx) => { 90 | const rows = source.split("\n").filter((row) => row.length > 0); 91 | 92 | const table = el.createEl("table"); 93 | const body = table.createEl("tbody"); 94 | 95 | for (let i = 0; i < rows.length; i++) { 96 | const cols = rows[i].split(","); 97 | 98 | const row = body.createEl("tr"); 99 | 100 | for (let j = 0; j < cols.length; j++) { 101 | row.createEl("td", { text: cols[j] }); 102 | } 103 | } 104 | }); 105 | } 106 | } 107 | ``` 108 | -------------------------------------------------------------------------------- /docs/events.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 60 3 | --- 4 | 5 | # Events 6 | 7 | Many of the interfaces in the Obsidian lets you subscribe to events throughout the application, for example when the user makes changes to a file. 8 | 9 | Any registered event handlers need to be detached whenever the plugin unloads. The safest way to make sure this happens is to use the [`registerEvent()`](./reference/typescript/classes/Component.md#registerevent) method. 10 | 11 | ```ts title="main.ts" 12 | import { Plugin } from "obsidian"; 13 | 14 | export default class ExamplePlugin extends Plugin { 15 | async onload() { 16 | // highlight-start 17 | this.registerEvent(this.app.vault.on('create', () => { 18 | console.log('a new file has entered the arena') 19 | })); 20 | // highlight-end 21 | } 22 | } 23 | ``` 24 | 25 | ## Timing events 26 | 27 | If you want to repeatedly call a function with a fixed delay, use the [`window.setInterval()`](https://developer.mozilla.org/en-US/docs/Web/API/setInterval) function with the [`registerInterval()`](./reference/typescript/classes/Component.md#registerinterval) method. 28 | 29 | The following example displays the current time in the status bar, updated every second: 30 | 31 | ```ts {11-13} 32 | import { moment, Plugin } from "obsidian"; 33 | 34 | export default class ExamplePlugin extends Plugin { 35 | statusBar: HTMLElement; 36 | 37 | async onload() { 38 | this.statusBar = this.addStatusBarItem(); 39 | 40 | this.updateStatusBar(); 41 | 42 | // highlight-start 43 | this.registerInterval( 44 | window.setInterval(() => this.updateStatusBar(), 1000) 45 | ); 46 | // highlight-end 47 | } 48 | 49 | updateStatusBar() { 50 | this.statusBar.setText(moment().format("H:mm:ss")); 51 | } 52 | } 53 | ``` 54 | 55 | :::tip 56 | [Moment](https://momentjs.com/) is a popular JavaScript library for working with dates and time. Obsidian uses Moment internally, so you don't need to install it yourself. You can import it from the Obsidian API instead: 57 | 58 | ```ts 59 | import { moment } from "obsidian"; 60 | ``` 61 | 62 | ::: 63 | -------------------------------------------------------------------------------- /docs/examples/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Examples", 3 | "position": 100 4 | } 5 | -------------------------------------------------------------------------------- /docs/examples/insert-link.md: -------------------------------------------------------------------------------- 1 | # Insert link 2 | 3 | This example adds a command that opens a modal to insert a Markdown link. It uses the editor to set the current selection as the default link text, and then replaces the selection when user inserts the link. 4 | 5 | This example assumes knowledge of [commands](../user-interface/commands.md), [modals](../user-interface/modals.md), and the [editor](../editor/index.md). If you have difficulties to understand this example, refer to the corresponding guides before you continue reading. 6 | 7 | Here's what you'll create: 8 | 9 | ![Insert link modal](../../static/img/example-insert-link.gif) 10 | 11 | Here's the full source code: 12 | 13 | ```ts title="main.ts" 14 | import { Editor, Plugin } from "obsidian"; 15 | import { InsertLinkModal } from "./modal"; 16 | 17 | export default class InsertLinkPlugin extends Plugin { 18 | async onload() { 19 | this.addCommand({ 20 | id: "insert-link", 21 | name: "Insert link", 22 | editorCallback: (editor: Editor) => { 23 | const selectedText = editor.getSelection(); 24 | 25 | const onSubmit = (text: string, url: string) => { 26 | editor.replaceSelection(`[${text}](${url})`); 27 | }; 28 | 29 | new InsertLinkModal(this.app, selectedText, onSubmit).open(); 30 | }, 31 | }); 32 | } 33 | } 34 | ``` 35 | 36 | ```ts title="modal.ts" 37 | import { App, Modal, Setting } from "obsidian"; 38 | 39 | export class InsertLinkModal extends Modal { 40 | linkText: string; 41 | linkUrl: string; 42 | 43 | onSubmit: (linkText: string, linkUrl: string) => void; 44 | 45 | constructor( 46 | app: App, 47 | defaultLinkText: string, 48 | onSubmit: (linkText: string, linkUrl: string) => void 49 | ) { 50 | super(app); 51 | this.linkText = defaultLinkText; 52 | this.onSubmit = onSubmit; 53 | } 54 | 55 | onOpen() { 56 | const { contentEl } = this; 57 | 58 | contentEl.createEl("h1", { text: "Insert link" }); 59 | 60 | new Setting(contentEl).setName("Link text").addText((text) => 61 | text.setValue(this.linkText).onChange((value) => { 62 | this.linkText = value; 63 | }) 64 | ); 65 | 66 | new Setting(contentEl).setName("Link URL").addText((text) => 67 | text.setValue(this.linkUrl).onChange((value) => { 68 | this.linkUrl = value; 69 | }) 70 | ); 71 | 72 | new Setting(contentEl).addButton((btn) => 73 | btn 74 | .setButtonText("Insert") 75 | .setCta() 76 | .onClick(() => { 77 | this.close(); 78 | this.onSubmit(this.linkText, this.linkUrl); 79 | }) 80 | ); 81 | } 82 | 83 | onClose() { 84 | let { contentEl } = this; 85 | contentEl.empty(); 86 | } 87 | } 88 | ``` 89 | -------------------------------------------------------------------------------- /docs/getting-started/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Getting started", 3 | "position": 10 4 | } 5 | -------------------------------------------------------------------------------- /docs/getting-started/development-workflow.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 15 3 | --- 4 | 5 | # Development workflow 6 | 7 | Whenever you make a change to the plugin source code, the plugin needs to be reloaded. You can reload the plugin by quitting Obsidian and starting it again, but that gets tiring quickly. 8 | 9 | ## Reload plugin inside Obsidian 10 | 11 | You can reload the plugin by re-enabling it in the list of installed plugins: 12 | 13 | 1. Open **Preferences**. 14 | 2. Click **Community plugins**. 15 | 3. Find your plugin under **Installed plugins**. 16 | 4. Toggle the switch off to disable the plugin. 17 | 5. Toggle the switch on to enable the plugin. 18 | 19 | You're now running the updated version of your plugin. 20 | 21 | ## Reload plugin on file changes 22 | 23 | The [Hot-Reload](https://github.com/pjeby/hot-reload) plugin reloads your plugin whenever the source code changes. 24 | 25 | For more information, check out the [forum announcement](https://forum.obsidian.md/t/plugin-release-for-developers-hot-reload-the-plugin-s-youre-developing/12185). 26 | -------------------------------------------------------------------------------- /docs/getting-started/index.md: -------------------------------------------------------------------------------- 1 | # Getting started 2 | 3 | Are you ready to start building your first [Obsidian](https://obsidian.md) plugin? This page gives you an introduction to plugins, and how to set up your development environment. 4 | 5 | ## What are plugins? 6 | 7 | A plugin is a third-party application lets you extend or modify Obsidian to your liking. By building a plugin, you can: 8 | 9 | - Extend or modify the user interface. 10 | - Edit files and folders in your [Vault](vault.md). 11 | - Improve the [Editor](editor/index.md) for a better note-taking experience. 12 | 13 | To see what a plugin looks like, check out the [Insert link](../examples/insert-link.md) example. 14 | 15 | ## What do I need? 16 | 17 | Before you can build plugins, you need to set up your development environment. 18 | 19 | ### Git 20 | 21 | [Git](https://git-scm.com/) is a version control system that tracks changes to your code. You need Git to download the sample plugin and to publish the plugin. 22 | 23 | ### Node.js 24 | 25 | [Node.js](https://nodejs.org/) is a JavaScript runtime environment that can run JavaScript outside of a web browser. 26 | 27 | ### TypeScript 28 | 29 | To build a plugin, you need a basic understanding of [TypeScript](https://www.typescriptlang.org/). A great place to start is [The TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html). 30 | 31 | ### Code editor 32 | 33 | Use [Visual Studio Code](https://code.visualstudio.com/) to write TypeScript on Windows, Linux, and macOS. 34 | 35 | ## Next steps 36 | 37 | Now that you've set up your development environment, it's time to [Create your first plugin](create-your-first-plugin.md). 38 | 39 | -------------------------------------------------------------------------------- /docs/getting-started/plugin-anatomy.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 20 3 | --- 4 | 5 | # Anatomy of a plugin 6 | 7 | The [`Plugin`](../reference/typescript/classes/Plugin_2.md) class defines the lifecycle of a plugin and exposes the operations available to all plugins: 8 | 9 | ```ts title="main.ts" 10 | import { Plugin } from "obsidian"; 11 | 12 | export default class ExamplePlugin extends Plugin { 13 | async onload() { 14 | // Configure resources needed by the plugin. 15 | } 16 | async onunload() { 17 | // Release any resources configured by the plugin. 18 | } 19 | } 20 | ``` 21 | 22 | ## Plugin lifecycle 23 | 24 | [`onload()`](../reference/typescript/classes/Component.md#onload) runs whenever the user starts using the plugin in Obsidian. This is where you'll configure most of the plugin's capabilities. This function is also called when the plugin is updated. 25 | 26 | [`onunload()`](../reference/typescript/classes/Component.md#onunload) runs when the plugin is disabled. Any resources that your plugin is using must be released here to avoid affecting the performance of Obsidian after your plugin has been disabled. 27 | 28 | To better understand when these methods are called, you can print a message to the console whenever the plugin loads and unloads. The console is a valuable tool that lets developers monitor the status of their code. 29 | 30 | To view the console: 31 | 32 | 1. Toggle the Developer Tools by pressing Ctrl+Shift+I in Windows and Linux, or Cmd-Option-I on macOS. 33 | 1. Click on the Console tab in the Developer Tools window. 34 | 35 | ```ts title="main.ts" 36 | import { Plugin } from "obsidian"; 37 | 38 | export default class ExamplePlugin extends Plugin { 39 | async onload() { 40 | // highlight-next-line 41 | console.log('loading plugin') 42 | } 43 | async onunload() { 44 | // highlight-next-line 45 | console.log('unloading plugin') 46 | } 47 | } 48 | ``` 49 | -------------------------------------------------------------------------------- /docs/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: / 3 | sidebar_label: Introduction 4 | sidebar_position: 1 5 | --- 6 | 7 | # Obsidian Plugin Developer Docs 8 | 9 | This is the **unofficial** documentation for Obsidian plugin development. 10 | 11 | It's being maintained by [@marcusolsson](https://github.com/marcusolsson), with the help of the Obsidian community. If this site has been useful to you, you can buy the maintainer a coffee to support its continued development: 12 | 13 | 14 | 15 | 16 | 17 | If this site doesn't help you, maybe one of these resources might: 18 | 19 | **Official resources by the Obsidian team:** 20 | 21 | - [Obsidian Sample Plugin](https://github.com/obsidianmd/obsidian-sample-plugin) 22 | - [Obsidian API](https://github.com/obsidianmd/obsidian-api) 23 | 24 | **Unofficial resources by community members:** 25 | 26 | - [for Plugin Developers](https://publish.obsidian.md/hub/04+-+Guides%2C+Workflows%2C+%26+Courses/for+Plugin+Developers "for Plugin Developers - Obsidian Hub - Obsidian Publish") in Obsidian Hub 27 | - [Plugins mini FAQ](https://forum.obsidian.md/t/plugins-mini-faq/7737) 28 | - [How to create a plugin for Obsidian](https://www.youtube.com/watch?v=XaES2G3PVpg) by [@phibr0](https://github.com/phibr0) 29 | - [Create Your Own Obsidian Plugin](https://www.youtube.com/watch?v=9lA-jaMNS0k) by [Antone Heyward](https://www.youtube.com/channel/UC9w43btR2UUsfR6ZUf3AlqQ) 30 | - [Unofficial API FAQ](https://liamca.in/Obsidian/API+FAQ/index) by [Liam Cain](https://liamca.in) 31 | - [Obsidian Tools](https://github.com/obsidian-tools/obsidian-tools) 32 | - [Getting Started with CodeMirror 6](https://github.com/nothingislost/obsidian-cm6-attributes#getting-started-with-codemirror-6) by [NothingIsLost](https://github.com/nothingislost) 33 | -------------------------------------------------------------------------------- /docs/publishing/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Publishing", 3 | "position": 70 4 | } 5 | -------------------------------------------------------------------------------- /docs/publishing/submission-guidelines.md: -------------------------------------------------------------------------------- 1 | # Submission guidelines 2 | 3 | This page lists common review comments plugin authors get when submitting their plugin. 4 | 5 | ## Use `normalizePath()` to clean up user-defined paths 6 | 7 | Use [`normalizePath()`](../reference/typescript/functions/normalizePath) whenever you accept user-defined paths to files or folders in the vault, or when you construct your own paths in the plugin code. 8 | 9 | `normalizePath()` takes a path and scrubs it to be safe for the file system and for cross-platform use. This function: 10 | 11 | - Cleans up the use of forward and backward slashes, such as replacing 1 or more of `\` or `/` with a single `/`. 12 | - Removes leading and trailing forward and backward slashes. 13 | - Replaces any non-breaking spaces, `\u00A0`, with a regular space. 14 | - Runs the path through [String.prototype.normalize](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize). 15 | 16 | ```ts 17 | import { normalizePath } from "obsidian"; 18 | const pathToPlugin = normalizePath(app.vault.configDir + "//plugins/my-plugin"); 19 | // pathToPlugin contains ".obsidian/plugins/my-plugin" not .obsidian//plugins/my-plugin 20 | ``` 21 | -------------------------------------------------------------------------------- /docs/reference/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Reference", 3 | "position": 80 4 | } 5 | -------------------------------------------------------------------------------- /docs/reference/manifest.md: -------------------------------------------------------------------------------- 1 | # Manifest 2 | 3 | This page describe the schema for the plugin manifest, `manifest.json`. 4 | 5 | ## Properties 6 | 7 | | Property | Type | Required | Description | 8 | |-----------------|---------|----------|--------------------------------------------------------| 9 | | `author` | string | **Yes** | The plugin author's name. | 10 | | `description` | string | **Yes** | The long description of your plugin. | 11 | | `id` | string | **Yes** | The ID of your plugin. | 12 | | `isDesktopOnly` | boolean | **Yes** | Whether your plugin uses NodeJS or Electron APIs. | 13 | | `minAppVersion` | string | **Yes** | The minimum required Obsidian version for your plugin. | 14 | | `name` | string | **Yes** | The display name of your plugin. | 15 | | `version` | string | **Yes** | The version of your plugin. | 16 | | `authorUrl` | string | No | A URL to your own website. | 17 | | `fundingUrl` | string | No | A URL to where the users can support your project. | 18 | 19 | -------------------------------------------------------------------------------- /docs/reference/typescript/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "TypeScript API", 3 | "position": 70 4 | } 5 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/AbstractTextComponent.md: -------------------------------------------------------------------------------- 1 | # AbstractTextComponent 2 | 3 | Extends `ValueComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(inputEl: T); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### inputEl 14 | 15 | ```ts 16 | inputEl: T 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### getValue 28 | 29 | ```ts 30 | getValue(): string; 31 | ``` 32 | 33 | ### setValue 34 | 35 | ```ts 36 | setValue(value: string): this; 37 | ``` 38 | 39 | ### setPlaceholder 40 | 41 | ```ts 42 | setPlaceholder(placeholder: string): this; 43 | ``` 44 | 45 | ### onChanged 46 | 47 | ```ts 48 | onChanged(): void; 49 | ``` 50 | 51 | ### onChange 52 | 53 | ```ts 54 | onChange(callback: (value: string) => any): this; 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/App.md: -------------------------------------------------------------------------------- 1 | # App 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Properties 10 | 11 | ### keymap 12 | 13 | ```ts 14 | keymap: Keymap 15 | ``` 16 | 17 | ### scope 18 | 19 | ```ts 20 | scope: Scope 21 | ``` 22 | 23 | ### workspace 24 | 25 | ```ts 26 | workspace: Workspace 27 | ``` 28 | 29 | ### vault 30 | 31 | ```ts 32 | vault: Vault 33 | ``` 34 | 35 | ### metadataCache 36 | 37 | ```ts 38 | metadataCache: MetadataCache 39 | ``` 40 | 41 | ### fileManager 42 | 43 | ```ts 44 | fileManager: FileManager 45 | ``` 46 | 47 | ### lastEvent 48 | 49 | ```ts 50 | lastEvent: UserEvent 51 | ``` 52 | 53 | The last known user interaction event, to help commands find out what modifier keys are pressed. 54 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/BaseComponent.md: -------------------------------------------------------------------------------- 1 | # BaseComponent 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Properties 10 | 11 | ### disabled 12 | 13 | ```ts 14 | disabled: boolean 15 | ``` 16 | 17 | ## Methods 18 | 19 | ### then 20 | 21 | ```ts 22 | then(cb: (component: this) => any): this; 23 | ``` 24 | 25 | Facilitates chaining 26 | 27 | ### setDisabled 28 | 29 | ```ts 30 | setDisabled(disabled: boolean): this; 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ButtonComponent.md: -------------------------------------------------------------------------------- 1 | # ButtonComponent 2 | 3 | Extends `BaseComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### buttonEl 14 | 15 | ```ts 16 | buttonEl: HTMLButtonElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### setCta 28 | 29 | ```ts 30 | setCta(): this; 31 | ``` 32 | 33 | ### removeCta 34 | 35 | ```ts 36 | removeCta(): this; 37 | ``` 38 | 39 | ### setWarning 40 | 41 | ```ts 42 | setWarning(): this; 43 | ``` 44 | 45 | ### setTooltip 46 | 47 | ```ts 48 | setTooltip(tooltip: string, options?: TooltipOptions): this; 49 | ``` 50 | 51 | ### setButtonText 52 | 53 | ```ts 54 | setButtonText(name: string): this; 55 | ``` 56 | 57 | ### setIcon 58 | 59 | ```ts 60 | setIcon(icon: IconName): this; 61 | ``` 62 | 63 | ### setClass 64 | 65 | ```ts 66 | setClass(cls: string): this; 67 | ``` 68 | 69 | ### onClick 70 | 71 | ```ts 72 | onClick(callback: (evt: MouseEvent) => any): this; 73 | ``` 74 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ColorComponent.md: -------------------------------------------------------------------------------- 1 | # ColorComponent 2 | 3 | Extends `ValueComponent` 4 | 5 | Color picker component. Values are by default 6-digit hash-prefixed hex strings like `#000000`. 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(containerEl: HTMLElement); 11 | ``` 12 | 13 | ## Methods 14 | 15 | ### getValue 16 | 17 | ```ts 18 | getValue(): HexString; 19 | ``` 20 | 21 | ### getValueRgb 22 | 23 | ```ts 24 | getValueRgb(): RGB; 25 | ``` 26 | 27 | ### getValueHsl 28 | 29 | ```ts 30 | getValueHsl(): HSL; 31 | ``` 32 | 33 | ### setValue 34 | 35 | ```ts 36 | setValue(value: HexString): this; 37 | ``` 38 | 39 | ### setValueRgb 40 | 41 | ```ts 42 | setValueRgb(rgb: RGB): this; 43 | ``` 44 | 45 | ### setValueHsl 46 | 47 | ```ts 48 | setValueHsl(hsl: HSL): this; 49 | ``` 50 | 51 | ### onChange 52 | 53 | ```ts 54 | onChange(callback: (value: string) => any): this; 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Component.md: -------------------------------------------------------------------------------- 1 | # Component 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### load 12 | 13 | ```ts 14 | load(): void; 15 | ``` 16 | 17 | Load this component and its children 18 | 19 | ### onload 20 | 21 | ```ts 22 | onload(): void; 23 | ``` 24 | 25 | Override this to load your component 26 | 27 | ### unload 28 | 29 | ```ts 30 | unload(): void; 31 | ``` 32 | 33 | Unload this component and its children 34 | 35 | ### onunload 36 | 37 | ```ts 38 | onunload(): void; 39 | ``` 40 | 41 | Override this to unload your component 42 | 43 | ### addChild 44 | 45 | ```ts 46 | addChild(component: T): T; 47 | ``` 48 | 49 | Adds a child component, loading it if this component is loaded 50 | 51 | ### removeChild 52 | 53 | ```ts 54 | removeChild(component: T): T; 55 | ``` 56 | 57 | Removes a child component, unloading it 58 | 59 | ### register 60 | 61 | ```ts 62 | register(cb: () => any): void; 63 | ``` 64 | 65 | Registers a callback to be called when unloading 66 | 67 | ### registerEvent 68 | 69 | ```ts 70 | registerEvent(eventRef: EventRef): void; 71 | ``` 72 | 73 | Registers an event to be detached when unloading 74 | 75 | ### registerDomEvent 76 | 77 | ```ts 78 | registerDomEvent(el: Window, type: K, callback: (this: HTMLElement, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; 79 | ``` 80 | 81 | Registers an DOM event to be detached when unloading 82 | 83 | ### registerDomEvent 84 | 85 | ```ts 86 | registerDomEvent(el: Document, type: K, callback: (this: HTMLElement, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; 87 | ``` 88 | 89 | Registers an DOM event to be detached when unloading 90 | 91 | ### registerDomEvent 92 | 93 | ```ts 94 | registerDomEvent(el: HTMLElement, type: K, callback: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; 95 | ``` 96 | 97 | Registers an DOM event to be detached when unloading 98 | 99 | ### registerScopeEvent 100 | 101 | ```ts 102 | registerScopeEvent(keyHandler: KeymapEventHandler): void; 103 | ``` 104 | 105 | Registers an key event to be detached when unloading 106 | 107 | ### registerInterval 108 | 109 | ```ts 110 | registerInterval(id: number): number; 111 | ``` 112 | 113 | Registers an interval (from setInterval) to be cancelled when unloading 114 | Use {@link window.setInterval} instead of {@link setInterval} to avoid TypeScript confusing between NodeJS vs Browser API 115 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/DropdownComponent.md: -------------------------------------------------------------------------------- 1 | # DropdownComponent 2 | 3 | Extends `ValueComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### selectEl 14 | 15 | ```ts 16 | selectEl: HTMLSelectElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### addOption 28 | 29 | ```ts 30 | addOption(value: string, display: string): this; 31 | ``` 32 | 33 | ### addOptions 34 | 35 | ```ts 36 | addOptions(options: Record): this; 37 | ``` 38 | 39 | ### getValue 40 | 41 | ```ts 42 | getValue(): string; 43 | ``` 44 | 45 | ### setValue 46 | 47 | ```ts 48 | setValue(value: string): this; 49 | ``` 50 | 51 | ### onChange 52 | 53 | ```ts 54 | onChange(callback: (value: string) => any): this; 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/EditableFileView.md: -------------------------------------------------------------------------------- 1 | # EditableFileView 2 | 3 | Extends `FileView` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(leaf: WorkspaceLeaf); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Editor.md: -------------------------------------------------------------------------------- 1 | # Editor 2 | 3 | A common interface that bridges the gap between CodeMirror 5 and CodeMirror 6. 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### getDoc 14 | 15 | ```ts 16 | getDoc(): this; 17 | ``` 18 | 19 | ### refresh 20 | 21 | ```ts 22 | abstract refresh(): void; 23 | ``` 24 | 25 | ### getValue 26 | 27 | ```ts 28 | abstract getValue(): string; 29 | ``` 30 | 31 | ### setValue 32 | 33 | ```ts 34 | abstract setValue(content: string): void; 35 | ``` 36 | 37 | ### getLine 38 | 39 | ```ts 40 | abstract getLine(line: number): string; 41 | ``` 42 | 43 | Get the text at line (0-indexed) 44 | 45 | ### setLine 46 | 47 | ```ts 48 | setLine(n: number, text: string): void; 49 | ``` 50 | 51 | ### lineCount 52 | 53 | ```ts 54 | abstract lineCount(): number; 55 | ``` 56 | 57 | Gets the number of lines in the document 58 | 59 | ### lastLine 60 | 61 | ```ts 62 | abstract lastLine(): number; 63 | ``` 64 | 65 | ### getSelection 66 | 67 | ```ts 68 | abstract getSelection(): string; 69 | ``` 70 | 71 | ### somethingSelected 72 | 73 | ```ts 74 | somethingSelected(): boolean; 75 | ``` 76 | 77 | ### getRange 78 | 79 | ```ts 80 | abstract getRange(from: EditorPosition, to: EditorPosition): string; 81 | ``` 82 | 83 | ### replaceSelection 84 | 85 | ```ts 86 | abstract replaceSelection(replacement: string, origin?: string): void; 87 | ``` 88 | 89 | ### replaceRange 90 | 91 | ```ts 92 | abstract replaceRange(replacement: string, from: EditorPosition, to?: EditorPosition, origin?: string): void; 93 | ``` 94 | 95 | ### getCursor 96 | 97 | ```ts 98 | abstract getCursor(string?: 'from' | 'to' | 'head' | 'anchor'): EditorPosition; 99 | ``` 100 | 101 | ### listSelections 102 | 103 | ```ts 104 | abstract listSelections(): EditorSelection[]; 105 | ``` 106 | 107 | ### setCursor 108 | 109 | ```ts 110 | setCursor(pos: EditorPosition | number, ch?: number): void; 111 | ``` 112 | 113 | ### setSelection 114 | 115 | ```ts 116 | abstract setSelection(anchor: EditorPosition, head?: EditorPosition): void; 117 | ``` 118 | 119 | ### setSelections 120 | 121 | ```ts 122 | abstract setSelections(ranges: EditorSelectionOrCaret[], main?: number): void; 123 | ``` 124 | 125 | ### focus 126 | 127 | ```ts 128 | abstract focus(): void; 129 | ``` 130 | 131 | ### blur 132 | 133 | ```ts 134 | abstract blur(): void; 135 | ``` 136 | 137 | ### hasFocus 138 | 139 | ```ts 140 | abstract hasFocus(): boolean; 141 | ``` 142 | 143 | ### getScrollInfo 144 | 145 | ```ts 146 | abstract getScrollInfo(): { 147 | top: number; 148 | left: number; 149 | }; 150 | ``` 151 | 152 | ### scrollTo 153 | 154 | ```ts 155 | abstract scrollTo(x?: number | null, y?: number | null): void; 156 | ``` 157 | 158 | ### scrollIntoView 159 | 160 | ```ts 161 | abstract scrollIntoView(range: EditorRange, center?: boolean): void; 162 | ``` 163 | 164 | ### undo 165 | 166 | ```ts 167 | abstract undo(): void; 168 | ``` 169 | 170 | ### redo 171 | 172 | ```ts 173 | abstract redo(): void; 174 | ``` 175 | 176 | ### exec 177 | 178 | ```ts 179 | abstract exec(command: EditorCommandName): void; 180 | ``` 181 | 182 | ### transaction 183 | 184 | ```ts 185 | abstract transaction(tx: EditorTransaction, origin?: string): void; 186 | ``` 187 | 188 | ### wordAt 189 | 190 | ```ts 191 | abstract wordAt(pos: EditorPosition): EditorRange | null; 192 | ``` 193 | 194 | ### posToOffset 195 | 196 | ```ts 197 | abstract posToOffset(pos: EditorPosition): number; 198 | ``` 199 | 200 | ### offsetToPos 201 | 202 | ```ts 203 | abstract offsetToPos(offset: number): EditorPosition; 204 | ``` 205 | 206 | ### processLines 207 | 208 | ```ts 209 | processLines(read: (line: number, lineText: string) => T | null, write: (line: number, lineText: string, value: T | null) => EditorChange | void, ignoreEmpty?: boolean): void; 210 | ``` 211 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/EditorSuggest.md: -------------------------------------------------------------------------------- 1 | # EditorSuggest 2 | 3 | Extends `PopoverSuggest` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### context 14 | 15 | ```ts 16 | context: EditorSuggestContext 17 | ``` 18 | 19 | Current suggestion context, containing the result of `onTrigger`. 20 | This will be null any time the EditorSuggest is not supposed to run. 21 | 22 | ### limit 23 | 24 | ```ts 25 | limit: number 26 | ``` 27 | 28 | Override this to use a different limit for suggestion items 29 | 30 | ## Methods 31 | 32 | ### setInstructions 33 | 34 | ```ts 35 | setInstructions(instructions: Instruction[]): void; 36 | ``` 37 | 38 | ### onTrigger 39 | 40 | ```ts 41 | abstract onTrigger(cursor: EditorPosition, editor: Editor, file: TFile): EditorSuggestTriggerInfo | null; 42 | ``` 43 | 44 | Based on the editor line and cursor position, determine if this EditorSuggest should be triggered at this moment. 45 | Typically, you would run a regular expression on the current line text before the cursor. 46 | Return null to indicate that this editor suggest is not supposed to be triggered. 47 | 48 | Please be mindful of performance when implementing this function, as it will be triggered very often (on each keypress). 49 | Keep it simple, and return null as early as possible if you determine that it is not the right time. 50 | 51 | ### getSuggestions 52 | 53 | ```ts 54 | abstract getSuggestions(context: EditorSuggestContext): T[] | Promise; 55 | ``` 56 | 57 | Generate suggestion items based on this context. Can be async, but preferably sync. 58 | When generating async suggestions, you should pass the context along. 59 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Events.md: -------------------------------------------------------------------------------- 1 | # Events 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### on 12 | 13 | ```ts 14 | on(name: string, callback: (...data: any) => any, ctx?: any): EventRef; 15 | ``` 16 | 17 | ### off 18 | 19 | ```ts 20 | off(name: string, callback: (...data: any) => any): void; 21 | ``` 22 | 23 | ### offref 24 | 25 | ```ts 26 | offref(ref: EventRef): void; 27 | ``` 28 | 29 | ### trigger 30 | 31 | ```ts 32 | trigger(name: string, ...data: any[]): void; 33 | ``` 34 | 35 | ### tryTrigger 36 | 37 | ```ts 38 | tryTrigger(evt: EventRef, args: any[]): void; 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ExtraButtonComponent.md: -------------------------------------------------------------------------------- 1 | # ExtraButtonComponent 2 | 3 | Extends `BaseComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### extraSettingsEl 14 | 15 | ```ts 16 | extraSettingsEl: HTMLElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### setTooltip 28 | 29 | ```ts 30 | setTooltip(tooltip: string, options?: TooltipOptions): this; 31 | ``` 32 | 33 | ### setIcon 34 | 35 | ```ts 36 | setIcon(icon: IconName): this; 37 | ``` 38 | 39 | ### onClick 40 | 41 | ```ts 42 | onClick(callback: () => any): this; 43 | ``` 44 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/FileManager.md: -------------------------------------------------------------------------------- 1 | # FileManager 2 | 3 | Manage the creation, deletion and renaming of files from the UI. 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### getNewFileParent 14 | 15 | ```ts 16 | getNewFileParent(sourcePath: string): TFolder; 17 | ``` 18 | 19 | Gets the folder that new files should be saved to, given the user's preferences. 20 | 21 | ### renameFile 22 | 23 | ```ts 24 | renameFile(file: TAbstractFile, newPath: string): Promise; 25 | ``` 26 | 27 | Rename or move a file safely, and update all links to it depending on the user's preferences. 28 | 29 | ### generateMarkdownLink 30 | 31 | ```ts 32 | generateMarkdownLink(file: TFile, sourcePath: string, subpath?: string, alias?: string): string; 33 | ``` 34 | 35 | Generate a markdown link based on the user's preferences. 36 | 37 | ### processFrontMatter 38 | 39 | ```ts 40 | processFrontMatter(file: TFile, fn: (frontMatter: any) => void): Promise; 41 | ``` 42 | 43 | Atomically read, modify, and save the frontmatter of a note. 44 | The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result. 45 | 46 | Remember to handle errors thrown by this method. 47 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/FileSystemAdapter.md: -------------------------------------------------------------------------------- 1 | # FileSystemAdapter 2 | 3 | Implements `DataAdapter` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### getName 14 | 15 | ```ts 16 | getName(): string; 17 | ``` 18 | 19 | ### getBasePath 20 | 21 | ```ts 22 | getBasePath(): string; 23 | ``` 24 | 25 | ### mkdir 26 | 27 | ```ts 28 | mkdir(normalizedPath: string): Promise; 29 | ``` 30 | 31 | ### trashSystem 32 | 33 | ```ts 34 | trashSystem(normalizedPath: string): Promise; 35 | ``` 36 | 37 | ### trashLocal 38 | 39 | ```ts 40 | trashLocal(normalizedPath: string): Promise; 41 | ``` 42 | 43 | ### rmdir 44 | 45 | ```ts 46 | rmdir(normalizedPath: string, recursive: boolean): Promise; 47 | ``` 48 | 49 | ### read 50 | 51 | ```ts 52 | read(normalizedPath: string): Promise; 53 | ``` 54 | 55 | ### readBinary 56 | 57 | ```ts 58 | readBinary(normalizedPath: string): Promise; 59 | ``` 60 | 61 | ### write 62 | 63 | ```ts 64 | write(normalizedPath: string, data: string, options?: DataWriteOptions): Promise; 65 | ``` 66 | 67 | ### writeBinary 68 | 69 | ```ts 70 | writeBinary(normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions): Promise; 71 | ``` 72 | 73 | ### append 74 | 75 | ```ts 76 | append(normalizedPath: string, data: string, options?: DataWriteOptions): Promise; 77 | ``` 78 | 79 | ### process 80 | 81 | ```ts 82 | process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions): Promise; 83 | ``` 84 | 85 | ### getResourcePath 86 | 87 | ```ts 88 | getResourcePath(normalizedPath: string): string; 89 | ``` 90 | 91 | ### getFilePath 92 | 93 | ```ts 94 | getFilePath(normalizedPath: string): string; 95 | ``` 96 | 97 | Returns the file:// path of this file 98 | 99 | ### remove 100 | 101 | ```ts 102 | remove(normalizedPath: string): Promise; 103 | ``` 104 | 105 | ### rename 106 | 107 | ```ts 108 | rename(normalizedPath: string, normalizedNewPath: string): Promise; 109 | ``` 110 | 111 | ### copy 112 | 113 | ```ts 114 | copy(normalizedPath: string, normalizedNewPath: string): Promise; 115 | ``` 116 | 117 | ### exists 118 | 119 | ```ts 120 | exists(normalizedPath: string, sensitive?: boolean): Promise; 121 | ``` 122 | 123 | ### stat 124 | 125 | ```ts 126 | stat(normalizedPath: string): Promise; 127 | ``` 128 | 129 | ### list 130 | 131 | ```ts 132 | list(normalizedPath: string): Promise; 133 | ``` 134 | 135 | ### getFullPath 136 | 137 | ```ts 138 | getFullPath(normalizedPath: string): string; 139 | ``` 140 | 141 | ### readLocalFile 142 | 143 | ```ts 144 | static readLocalFile(path: string): Promise; 145 | ``` 146 | 147 | ### mkdir 148 | 149 | ```ts 150 | static mkdir(path: string): Promise; 151 | ``` 152 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/FileView.md: -------------------------------------------------------------------------------- 1 | # FileView 2 | 3 | Extends `ItemView` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(leaf: WorkspaceLeaf); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### allowNoFile 14 | 15 | ```ts 16 | allowNoFile: boolean 17 | ``` 18 | 19 | ### file 20 | 21 | ```ts 22 | file: TFile 23 | ``` 24 | 25 | ### navigation 26 | 27 | ```ts 28 | navigation: boolean 29 | ``` 30 | 31 | Whether or not the view is intended for navigation. 32 | If your view is a static view that is not intended to be navigated away, set this to false. 33 | (For example: File explorer, calendar, etc.) 34 | If your view opens a file or can be otherwise navigated, set this to true. 35 | (For example: Markdown editor view, Kanban view, PDF view, etc.) 36 | File views can be navigated by default. 37 | 38 | ## Methods 39 | 40 | ### getDisplayText 41 | 42 | ```ts 43 | getDisplayText(): string; 44 | ``` 45 | 46 | ### onload 47 | 48 | ```ts 49 | onload(): void; 50 | ``` 51 | 52 | Override this to load your component 53 | 54 | ### getState 55 | 56 | ```ts 57 | getState(): any; 58 | ``` 59 | 60 | ### setState 61 | 62 | ```ts 63 | setState(state: any, result: ViewStateResult): Promise; 64 | ``` 65 | 66 | ### onLoadFile 67 | 68 | ```ts 69 | onLoadFile(file: TFile): Promise; 70 | ``` 71 | 72 | ### onUnloadFile 73 | 74 | ```ts 75 | onUnloadFile(file: TFile): Promise; 76 | ``` 77 | 78 | ### onRename 79 | 80 | ```ts 81 | onRename(file: TFile): Promise; 82 | ``` 83 | 84 | ### canAcceptExtension 85 | 86 | ```ts 87 | canAcceptExtension(extension: string): boolean; 88 | ``` 89 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/FuzzySuggestModal.md: -------------------------------------------------------------------------------- 1 | # FuzzySuggestModal 2 | 3 | Extends `SuggestModal>` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### getSuggestions 14 | 15 | ```ts 16 | getSuggestions(query: string): FuzzyMatch[]; 17 | ``` 18 | 19 | ### renderSuggestion 20 | 21 | ```ts 22 | renderSuggestion(item: FuzzyMatch, el: HTMLElement): void; 23 | ``` 24 | 25 | Render the suggestion item into DOM. 26 | 27 | ### onChooseSuggestion 28 | 29 | ```ts 30 | onChooseSuggestion(item: FuzzyMatch, evt: MouseEvent | KeyboardEvent): void; 31 | ``` 32 | 33 | ### getItems 34 | 35 | ```ts 36 | abstract getItems(): T[]; 37 | ``` 38 | 39 | ### getItemText 40 | 41 | ```ts 42 | abstract getItemText(item: T): string; 43 | ``` 44 | 45 | ### onChooseItem 46 | 47 | ```ts 48 | abstract onChooseItem(item: T, evt: MouseEvent | KeyboardEvent): void; 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/HoverPopover.md: -------------------------------------------------------------------------------- 1 | # HoverPopover 2 | 3 | Extends `Component` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(parent: HoverParent, targetEl: HTMLElement, waitTime: number); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### hoverEl 14 | 15 | ```ts 16 | hoverEl: HTMLElement 17 | ``` 18 | 19 | ### state 20 | 21 | ```ts 22 | state: PopoverState 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ItemView.md: -------------------------------------------------------------------------------- 1 | # ItemView 2 | 3 | Extends `View` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(leaf: WorkspaceLeaf); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### contentEl 14 | 15 | ```ts 16 | contentEl: HTMLElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### addAction 22 | 23 | ```ts 24 | addAction(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement; 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Keymap.md: -------------------------------------------------------------------------------- 1 | # Keymap 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### pushScope 12 | 13 | ```ts 14 | pushScope(scope: Scope): void; 15 | ``` 16 | 17 | ### popScope 18 | 19 | ```ts 20 | popScope(scope: Scope): void; 21 | ``` 22 | 23 | ### isModifier 24 | 25 | ```ts 26 | static isModifier(evt: MouseEvent | TouchEvent | KeyboardEvent, modifier: Modifier): boolean; 27 | ``` 28 | 29 | Checks whether the modifier key is pressed during this event 30 | 31 | ### isModEvent 32 | 33 | ```ts 34 | static isModEvent(evt?: UserEvent | null): PaneType | boolean; 35 | ``` 36 | 37 | Translates an event into the type of pane that should open. 38 | Returns 'tab' if the modifier key Cmd/Ctrl is pressed OR if this is a middle-click MouseEvent. 39 | Returns 'split' if Cmd/Ctrl+Alt is pressed. 40 | Returns 'window' if Cmd/Ctrl+Alt+Shift is pressed. 41 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownEditView.md: -------------------------------------------------------------------------------- 1 | # MarkdownEditView 2 | 3 | Implements `MarkdownSubView`, `HoverParent`, `MarkdownFileInfo` 4 | 5 | This is the editor for Obsidian Mobile as well as the upcoming WYSIWYG editor. 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(view: MarkdownView); 11 | ``` 12 | 13 | ## Properties 14 | 15 | ### app 16 | 17 | ```ts 18 | app: App 19 | ``` 20 | 21 | ### hoverPopover 22 | 23 | ```ts 24 | hoverPopover: HoverPopover 25 | ``` 26 | 27 | ## Methods 28 | 29 | ### clear 30 | 31 | ```ts 32 | clear(): void; 33 | ``` 34 | 35 | ### get 36 | 37 | ```ts 38 | get(): string; 39 | ``` 40 | 41 | ### set 42 | 43 | ```ts 44 | set(data: string, clear: boolean): void; 45 | ``` 46 | 47 | ### getSelection 48 | 49 | ```ts 50 | getSelection(): string; 51 | ``` 52 | 53 | ### getScroll 54 | 55 | ```ts 56 | getScroll(): number; 57 | ``` 58 | 59 | ### applyScroll 60 | 61 | ```ts 62 | applyScroll(scroll: number): void; 63 | ``` 64 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownPreviewRenderer.md: -------------------------------------------------------------------------------- 1 | # MarkdownPreviewRenderer 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### registerPostProcessor 12 | 13 | ```ts 14 | static registerPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): void; 15 | ``` 16 | 17 | ### unregisterPostProcessor 18 | 19 | ```ts 20 | static unregisterPostProcessor(postProcessor: MarkdownPostProcessor): void; 21 | ``` 22 | 23 | ### createCodeBlockPostProcessor 24 | 25 | ```ts 26 | static createCodeBlockPostProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise | void): (el: HTMLElement, ctx: MarkdownPostProcessorContext) => void; 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownPreviewView.md: -------------------------------------------------------------------------------- 1 | # MarkdownPreviewView 2 | 3 | Extends `MarkdownRenderer` 4 | 5 | Implements `MarkdownSubView`, `MarkdownPreviewEvents` 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(containerEl: HTMLElement); 11 | ``` 12 | 13 | ## Properties 14 | 15 | ### containerEl 16 | 17 | ```ts 18 | containerEl: HTMLElement 19 | ``` 20 | 21 | ## Methods 22 | 23 | ### get 24 | 25 | ```ts 26 | get(): string; 27 | ``` 28 | 29 | ### set 30 | 31 | ```ts 32 | set(data: string, clear: boolean): void; 33 | ``` 34 | 35 | ### clear 36 | 37 | ```ts 38 | clear(): void; 39 | ``` 40 | 41 | ### rerender 42 | 43 | ```ts 44 | rerender(full?: boolean): void; 45 | ``` 46 | 47 | ### getScroll 48 | 49 | ```ts 50 | getScroll(): number; 51 | ``` 52 | 53 | ### applyScroll 54 | 55 | ```ts 56 | applyScroll(scroll: number): void; 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownRenderChild.md: -------------------------------------------------------------------------------- 1 | # MarkdownRenderChild 2 | 3 | Extends `Component` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### containerEl 14 | 15 | ```ts 16 | containerEl: HTMLElement 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownRenderer.md: -------------------------------------------------------------------------------- 1 | # MarkdownRenderer 2 | 3 | Extends `MarkdownRenderChild` 4 | 5 | Implements `MarkdownPreviewEvents`, `HoverParent` 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(containerEl: HTMLElement); 11 | ``` 12 | 13 | ## Properties 14 | 15 | ### app 16 | 17 | ```ts 18 | app: App 19 | ``` 20 | 21 | ### hoverPopover 22 | 23 | ```ts 24 | hoverPopover: HoverPopover 25 | ``` 26 | 27 | ## Methods 28 | 29 | ### renderMarkdown 30 | 31 | ```ts 32 | static renderMarkdown(markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise; 33 | ``` 34 | 35 | Renders markdown string to an HTML element. 36 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownSourceView.md: -------------------------------------------------------------------------------- 1 | # MarkdownSourceView 2 | 3 | Implements `MarkdownSubView`, `HoverParent`, `MarkdownFileInfo` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(view: MarkdownView); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### app 14 | 15 | ```ts 16 | app: App 17 | ``` 18 | 19 | ### cmEditor 20 | 21 | ```ts 22 | cmEditor: any 23 | ``` 24 | 25 | ### hoverPopover 26 | 27 | ```ts 28 | hoverPopover: HoverPopover 29 | ``` 30 | 31 | ## Methods 32 | 33 | ### clear 34 | 35 | ```ts 36 | clear(): void; 37 | ``` 38 | 39 | ### get 40 | 41 | ```ts 42 | get(): string; 43 | ``` 44 | 45 | ### set 46 | 47 | ```ts 48 | set(data: string, clear: boolean): void; 49 | ``` 50 | 51 | ### getSelection 52 | 53 | ```ts 54 | getSelection(): string; 55 | ``` 56 | 57 | ### getScroll 58 | 59 | ```ts 60 | getScroll(): number; 61 | ``` 62 | 63 | ### applyScroll 64 | 65 | ```ts 66 | applyScroll(scroll: number): void; 67 | ``` 68 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MarkdownView.md: -------------------------------------------------------------------------------- 1 | # MarkdownView 2 | 3 | Extends `TextFileView` 4 | 5 | Implements `MarkdownFileInfo` 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(leaf: WorkspaceLeaf); 11 | ``` 12 | 13 | ## Properties 14 | 15 | ### editor 16 | 17 | ```ts 18 | editor: Editor 19 | ``` 20 | 21 | ### previewMode 22 | 23 | ```ts 24 | previewMode: MarkdownPreviewView 25 | ``` 26 | 27 | ### currentMode 28 | 29 | ```ts 30 | currentMode: MarkdownSubView 31 | ``` 32 | 33 | ### hoverPopover 34 | 35 | ```ts 36 | hoverPopover: HoverPopover 37 | ``` 38 | 39 | ## Methods 40 | 41 | ### getViewType 42 | 43 | ```ts 44 | getViewType(): string; 45 | ``` 46 | 47 | ### getMode 48 | 49 | ```ts 50 | getMode(): MarkdownViewModeType; 51 | ``` 52 | 53 | ### getViewData 54 | 55 | ```ts 56 | getViewData(): string; 57 | ``` 58 | 59 | Gets the data from the editor. This will be called to save the editor contents to the file. 60 | 61 | ### clear 62 | 63 | ```ts 64 | clear(): void; 65 | ``` 66 | 67 | Clear the editor. This is usually called when we're about to open a completely 68 | different file, so it's best to clear any editor states like undo-redo history, 69 | and any caches/indexes associated with the previous file contents. 70 | 71 | ### setViewData 72 | 73 | ```ts 74 | setViewData(data: string, clear: boolean): void; 75 | ``` 76 | 77 | Set the data to the editor. This is used to load the file contents. 78 | 79 | If clear is set, then it means we're opening a completely different file. 80 | In that case, you should call clear(), or implement a slightly more efficient 81 | clearing mechanism given the new data to be set. 82 | 83 | ### showSearch 84 | 85 | ```ts 86 | showSearch(replace?: boolean): void; 87 | ``` 88 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Menu.md: -------------------------------------------------------------------------------- 1 | # Menu 2 | 3 | Extends `Component` 4 | 5 | Implements `CloseableComponent` 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(); 11 | ``` 12 | 13 | ## Methods 14 | 15 | ### setNoIcon 16 | 17 | ```ts 18 | setNoIcon(): this; 19 | ``` 20 | 21 | ### setUseNativeMenu 22 | 23 | ```ts 24 | setUseNativeMenu(useNativeMenu: boolean): this; 25 | ``` 26 | 27 | Force this menu to use native or DOM. 28 | (Only works on the desktop app) 29 | 30 | ### addItem 31 | 32 | ```ts 33 | addItem(cb: (item: MenuItem) => any): this; 34 | ``` 35 | 36 | Adds a menu item. Only works when menu is not shown yet. 37 | 38 | ### addSeparator 39 | 40 | ```ts 41 | addSeparator(): this; 42 | ``` 43 | 44 | Adds a separator. Only works when menu is not shown yet. 45 | 46 | ### showAtMouseEvent 47 | 48 | ```ts 49 | showAtMouseEvent(evt: MouseEvent): this; 50 | ``` 51 | 52 | ### showAtPosition 53 | 54 | ```ts 55 | showAtPosition(position: MenuPositionDef, doc?: Document): this; 56 | ``` 57 | 58 | ### hide 59 | 60 | ```ts 61 | hide(): this; 62 | ``` 63 | 64 | ### close 65 | 66 | ```ts 67 | close(): void; 68 | ``` 69 | 70 | ### onHide 71 | 72 | ```ts 73 | onHide(callback: () => any): void; 74 | ``` 75 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MenuItem.md: -------------------------------------------------------------------------------- 1 | # MenuItem 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### setTitle 12 | 13 | ```ts 14 | setTitle(title: string | DocumentFragment): this; 15 | ``` 16 | 17 | ### setIcon 18 | 19 | ```ts 20 | setIcon(icon: IconName | null): this; 21 | ``` 22 | 23 | ### setChecked 24 | 25 | ```ts 26 | setChecked(checked: boolean | null): this; 27 | ``` 28 | 29 | ### setDisabled 30 | 31 | ```ts 32 | setDisabled(disabled: boolean): this; 33 | ``` 34 | 35 | ### setIsLabel 36 | 37 | ```ts 38 | setIsLabel(isLabel: boolean): this; 39 | ``` 40 | 41 | ### onClick 42 | 43 | ```ts 44 | onClick(callback: (evt: MouseEvent | KeyboardEvent) => any): this; 45 | ``` 46 | 47 | ### setSection 48 | 49 | ```ts 50 | setSection(section: string): this; 51 | ``` 52 | 53 | Sets the section this menu item should belong in. 54 | To find the section IDs of an existing menu, inspect the DOM elements 55 | to see their `data-section` attribute. 56 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MenuSeparator.md: -------------------------------------------------------------------------------- 1 | # MenuSeparator 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Modal.md: -------------------------------------------------------------------------------- 1 | # Modal 2 | 3 | Implements `CloseableComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### app 14 | 15 | ```ts 16 | app: App 17 | ``` 18 | 19 | ### scope 20 | 21 | ```ts 22 | scope: Scope 23 | ``` 24 | 25 | ### containerEl 26 | 27 | ```ts 28 | containerEl: HTMLElement 29 | ``` 30 | 31 | ### modalEl 32 | 33 | ```ts 34 | modalEl: HTMLElement 35 | ``` 36 | 37 | ### titleEl 38 | 39 | ```ts 40 | titleEl: HTMLElement 41 | ``` 42 | 43 | ### contentEl 44 | 45 | ```ts 46 | contentEl: HTMLElement 47 | ``` 48 | 49 | ### shouldRestoreSelection 50 | 51 | ```ts 52 | shouldRestoreSelection: boolean 53 | ``` 54 | 55 | ## Methods 56 | 57 | ### open 58 | 59 | ```ts 60 | open(): void; 61 | ``` 62 | 63 | ### close 64 | 65 | ```ts 66 | close(): void; 67 | ``` 68 | 69 | ### onOpen 70 | 71 | ```ts 72 | onOpen(): void; 73 | ``` 74 | 75 | ### onClose 76 | 77 | ```ts 78 | onClose(): void; 79 | ``` 80 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/MomentFormatComponent.md: -------------------------------------------------------------------------------- 1 | # MomentFormatComponent 2 | 3 | Extends `TextComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### sampleEl 14 | 15 | ```ts 16 | sampleEl: HTMLElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDefaultFormat 22 | 23 | ```ts 24 | setDefaultFormat(defaultFormat: string): this; 25 | ``` 26 | 27 | Sets the default format when input is cleared. Also used for placeholder. 28 | 29 | ### setSampleEl 30 | 31 | ```ts 32 | setSampleEl(sampleEl: HTMLElement): this; 33 | ``` 34 | 35 | ### setValue 36 | 37 | ```ts 38 | setValue(value: string): this; 39 | ``` 40 | 41 | ### onChanged 42 | 43 | ```ts 44 | onChanged(): void; 45 | ``` 46 | 47 | ### updateSample 48 | 49 | ```ts 50 | updateSample(): void; 51 | ``` 52 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Notice.md: -------------------------------------------------------------------------------- 1 | # Notice 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(message: string | DocumentFragment, timeout: number); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### setMessage 12 | 13 | ```ts 14 | setMessage(message: string | DocumentFragment): this; 15 | ``` 16 | 17 | Change the message of this notice. 18 | 19 | ### hide 20 | 21 | ```ts 22 | hide(): void; 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/PluginSettingTab.md: -------------------------------------------------------------------------------- 1 | # PluginSettingTab 2 | 3 | Extends `SettingTab` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App, plugin: Plugin_2); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Plugin_2.md: -------------------------------------------------------------------------------- 1 | # Plugin_2 2 | 3 | Extends `Component` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App, manifest: PluginManifest); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### app 14 | 15 | ```ts 16 | app: App 17 | ``` 18 | 19 | ### manifest 20 | 21 | ```ts 22 | manifest: PluginManifest 23 | ``` 24 | 25 | ## Methods 26 | 27 | ### addRibbonIcon 28 | 29 | ```ts 30 | addRibbonIcon(icon: IconName, title: string, callback: (evt: MouseEvent) => any): HTMLElement; 31 | ``` 32 | 33 | Adds a ribbon icon to the left bar. 34 | 35 | ### addStatusBarItem 36 | 37 | ```ts 38 | addStatusBarItem(): HTMLElement; 39 | ``` 40 | 41 | ### addCommand 42 | 43 | ```ts 44 | addCommand(command: Command): Command; 45 | ``` 46 | 47 | Register a command globally. The command id and name will be automatically prefixed with this plugin's id and name. 48 | 49 | ### addSettingTab 50 | 51 | ```ts 52 | addSettingTab(settingTab: PluginSettingTab): void; 53 | ``` 54 | 55 | ### registerView 56 | 57 | ```ts 58 | registerView(type: string, viewCreator: ViewCreator): void; 59 | ``` 60 | 61 | ### registerHoverLinkSource 62 | 63 | ```ts 64 | registerHoverLinkSource(id: string, info: HoverLinkSource): void; 65 | ``` 66 | 67 | Register your view with the 'Page preview' core plugin as an emitter of the 'hover-link' on the event. 68 | 69 | ### registerExtensions 70 | 71 | ```ts 72 | registerExtensions(extensions: string[], viewType: string): void; 73 | ``` 74 | 75 | ### registerMarkdownPostProcessor 76 | 77 | ```ts 78 | registerMarkdownPostProcessor(postProcessor: MarkdownPostProcessor, sortOrder?: number): MarkdownPostProcessor; 79 | ``` 80 | 81 | ### registerMarkdownCodeBlockProcessor 82 | 83 | ```ts 84 | registerMarkdownCodeBlockProcessor(language: string, handler: (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => Promise | void, sortOrder?: number): MarkdownPostProcessor; 85 | ``` 86 | 87 | Register a special post processor that handles fenced code given a language and a handler. 88 | This special post processor takes care of removing the <pre><code> and create a <div> that 89 | will be passed to your handler, and is expected to be filled with your custom elements. 90 | 91 | ### registerCodeMirror 92 | 93 | ```ts 94 | registerCodeMirror(callback: (cm: CodeMirror.Editor) => any): void; 95 | ``` 96 | 97 | Runs callback on all currently loaded instances of CodeMirror, 98 | then registers the callback for all future CodeMirror instances. 99 | 100 | ### registerEditorExtension 101 | 102 | ```ts 103 | registerEditorExtension(extension: Extension): void; 104 | ``` 105 | 106 | Registers a CodeMirror 6 extension. 107 | To reconfigure cm6 extensions for your plugin on the fly, you can pass an array here and dynamically 108 | modify it. Once this array is modified, call `Workspace.updateOptions()` to have the changes applied. 109 | 110 | ### registerObsidianProtocolHandler 111 | 112 | ```ts 113 | registerObsidianProtocolHandler(action: string, handler: ObsidianProtocolHandler): void; 114 | ``` 115 | 116 | Register a handler for obsidian:// URLs. 117 | 118 | ### registerEditorSuggest 119 | 120 | ```ts 121 | registerEditorSuggest(editorSuggest: EditorSuggest): void; 122 | ``` 123 | 124 | Register an EditorSuggest which can provide live suggestions while the user is typing. 125 | 126 | ### loadData 127 | 128 | ```ts 129 | loadData(): Promise; 130 | ``` 131 | 132 | ### saveData 133 | 134 | ```ts 135 | saveData(data: any): Promise; 136 | ``` 137 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/PopoverSuggest.md: -------------------------------------------------------------------------------- 1 | # PopoverSuggest 2 | 3 | Implements `ISuggestOwner`, `CloseableComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(app: App, scope: Scope); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### open 14 | 15 | ```ts 16 | open(): void; 17 | ``` 18 | 19 | ### close 20 | 21 | ```ts 22 | close(): void; 23 | ``` 24 | 25 | ### renderSuggestion 26 | 27 | ```ts 28 | abstract renderSuggestion(value: T, el: HTMLElement): void; 29 | ``` 30 | 31 | Render the suggestion item into DOM. 32 | 33 | ### selectSuggestion 34 | 35 | ```ts 36 | abstract selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void; 37 | ``` 38 | 39 | Called when the user makes a selection. 40 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Scope.md: -------------------------------------------------------------------------------- 1 | # Scope 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(parent: Scope); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### register 12 | 13 | ```ts 14 | register(modifiers: Modifier[], key: string | null, func: KeymapEventListener): KeymapEventHandler; 15 | ``` 16 | 17 | ### unregister 18 | 19 | ```ts 20 | unregister(handler: KeymapEventHandler): void; 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/SearchComponent.md: -------------------------------------------------------------------------------- 1 | # SearchComponent 2 | 3 | Extends `AbstractTextComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### clearButtonEl 14 | 15 | ```ts 16 | clearButtonEl: HTMLElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### onChanged 22 | 23 | ```ts 24 | onChanged(): void; 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Setting.md: -------------------------------------------------------------------------------- 1 | # Setting 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(containerEl: HTMLElement); 7 | ``` 8 | 9 | ## Properties 10 | 11 | ### settingEl 12 | 13 | ```ts 14 | settingEl: HTMLElement 15 | ``` 16 | 17 | ### infoEl 18 | 19 | ```ts 20 | infoEl: HTMLElement 21 | ``` 22 | 23 | ### nameEl 24 | 25 | ```ts 26 | nameEl: HTMLElement 27 | ``` 28 | 29 | ### descEl 30 | 31 | ```ts 32 | descEl: HTMLElement 33 | ``` 34 | 35 | ### controlEl 36 | 37 | ```ts 38 | controlEl: HTMLElement 39 | ``` 40 | 41 | ### components 42 | 43 | ```ts 44 | components: BaseComponent[] 45 | ``` 46 | 47 | ## Methods 48 | 49 | ### setName 50 | 51 | ```ts 52 | setName(name: string | DocumentFragment): this; 53 | ``` 54 | 55 | ### setDesc 56 | 57 | ```ts 58 | setDesc(desc: string | DocumentFragment): this; 59 | ``` 60 | 61 | ### setClass 62 | 63 | ```ts 64 | setClass(cls: string): this; 65 | ``` 66 | 67 | ### setTooltip 68 | 69 | ```ts 70 | setTooltip(tooltip: string, options?: TooltipOptions): this; 71 | ``` 72 | 73 | ### setHeading 74 | 75 | ```ts 76 | setHeading(): this; 77 | ``` 78 | 79 | ### setDisabled 80 | 81 | ```ts 82 | setDisabled(disabled: boolean): this; 83 | ``` 84 | 85 | ### addButton 86 | 87 | ```ts 88 | addButton(cb: (component: ButtonComponent) => any): this; 89 | ``` 90 | 91 | ### addExtraButton 92 | 93 | ```ts 94 | addExtraButton(cb: (component: ExtraButtonComponent) => any): this; 95 | ``` 96 | 97 | ### addToggle 98 | 99 | ```ts 100 | addToggle(cb: (component: ToggleComponent) => any): this; 101 | ``` 102 | 103 | ### addText 104 | 105 | ```ts 106 | addText(cb: (component: TextComponent) => any): this; 107 | ``` 108 | 109 | ### addSearch 110 | 111 | ```ts 112 | addSearch(cb: (component: SearchComponent) => any): this; 113 | ``` 114 | 115 | ### addTextArea 116 | 117 | ```ts 118 | addTextArea(cb: (component: TextAreaComponent) => any): this; 119 | ``` 120 | 121 | ### addMomentFormat 122 | 123 | ```ts 124 | addMomentFormat(cb: (component: MomentFormatComponent) => any): this; 125 | ``` 126 | 127 | ### addDropdown 128 | 129 | ```ts 130 | addDropdown(cb: (component: DropdownComponent) => any): this; 131 | ``` 132 | 133 | ### addColorPicker 134 | 135 | ```ts 136 | addColorPicker(cb: (component: ColorComponent) => any): this; 137 | ``` 138 | 139 | ### addSlider 140 | 141 | ```ts 142 | addSlider(cb: (component: SliderComponent) => any): this; 143 | ``` 144 | 145 | ### then 146 | 147 | ```ts 148 | then(cb: (setting: this) => any): this; 149 | ``` 150 | 151 | Facilitates chaining 152 | 153 | ### clear 154 | 155 | ```ts 156 | clear(): this; 157 | ``` 158 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/SettingTab.md: -------------------------------------------------------------------------------- 1 | # SettingTab 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Properties 10 | 11 | ### app 12 | 13 | ```ts 14 | app: App 15 | ``` 16 | 17 | ### containerEl 18 | 19 | ```ts 20 | containerEl: HTMLElement 21 | ``` 22 | 23 | ## Methods 24 | 25 | ### display 26 | 27 | ```ts 28 | abstract display(): any; 29 | ``` 30 | 31 | ### hide 32 | 33 | ```ts 34 | hide(): any; 35 | ``` 36 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/SliderComponent.md: -------------------------------------------------------------------------------- 1 | # SliderComponent 2 | 3 | Extends `ValueComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### sliderEl 14 | 15 | ```ts 16 | sliderEl: HTMLInputElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### setLimits 28 | 29 | ```ts 30 | setLimits(min: number, max: number, step: number | 'any'): this; 31 | ``` 32 | 33 | ### getValue 34 | 35 | ```ts 36 | getValue(): number; 37 | ``` 38 | 39 | ### setValue 40 | 41 | ```ts 42 | setValue(value: number): this; 43 | ``` 44 | 45 | ### getValuePretty 46 | 47 | ```ts 48 | getValuePretty(): string; 49 | ``` 50 | 51 | ### setDynamicTooltip 52 | 53 | ```ts 54 | setDynamicTooltip(): this; 55 | ``` 56 | 57 | ### showTooltip 58 | 59 | ```ts 60 | showTooltip(): void; 61 | ``` 62 | 63 | ### onChange 64 | 65 | ```ts 66 | onChange(callback: (value: number) => any): this; 67 | ``` 68 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/SuggestModal.md: -------------------------------------------------------------------------------- 1 | # SuggestModal 2 | 3 | Extends `Modal` 4 | 5 | Implements `ISuggestOwner` 6 | 7 | ## Constructor 8 | 9 | ```ts 10 | constructor(app: App); 11 | ``` 12 | 13 | ## Properties 14 | 15 | ### limit 16 | 17 | ```ts 18 | limit: number 19 | ``` 20 | 21 | ### emptyStateText 22 | 23 | ```ts 24 | emptyStateText: string 25 | ``` 26 | 27 | ### inputEl 28 | 29 | ```ts 30 | inputEl: HTMLInputElement 31 | ``` 32 | 33 | ### resultContainerEl 34 | 35 | ```ts 36 | resultContainerEl: HTMLElement 37 | ``` 38 | 39 | ## Methods 40 | 41 | ### setPlaceholder 42 | 43 | ```ts 44 | setPlaceholder(placeholder: string): void; 45 | ``` 46 | 47 | ### setInstructions 48 | 49 | ```ts 50 | setInstructions(instructions: Instruction[]): void; 51 | ``` 52 | 53 | ### onNoSuggestion 54 | 55 | ```ts 56 | onNoSuggestion(): void; 57 | ``` 58 | 59 | ### selectSuggestion 60 | 61 | ```ts 62 | selectSuggestion(value: T, evt: MouseEvent | KeyboardEvent): void; 63 | ``` 64 | 65 | Called when the user makes a selection. 66 | 67 | ### getSuggestions 68 | 69 | ```ts 70 | abstract getSuggestions(query: string): T[] | Promise; 71 | ``` 72 | 73 | ### renderSuggestion 74 | 75 | ```ts 76 | abstract renderSuggestion(value: T, el: HTMLElement): any; 77 | ``` 78 | 79 | Render the suggestion item into DOM. 80 | 81 | ### onChooseSuggestion 82 | 83 | ```ts 84 | abstract onChooseSuggestion(item: T, evt: MouseEvent | KeyboardEvent): any; 85 | ``` 86 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TAbstractFile.md: -------------------------------------------------------------------------------- 1 | # TAbstractFile 2 | 3 | This can be either a `TFile` or a `TFolder`. 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### vault 14 | 15 | ```ts 16 | vault: Vault 17 | ``` 18 | 19 | ### path 20 | 21 | ```ts 22 | path: string 23 | ``` 24 | 25 | ### name 26 | 27 | ```ts 28 | name: string 29 | ``` 30 | 31 | ### parent 32 | 33 | ```ts 34 | parent: TFolder 35 | ``` 36 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TFile.md: -------------------------------------------------------------------------------- 1 | # TFile 2 | 3 | Extends `TAbstractFile` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### stat 14 | 15 | ```ts 16 | stat: FileStats 17 | ``` 18 | 19 | ### basename 20 | 21 | ```ts 22 | basename: string 23 | ``` 24 | 25 | ### extension 26 | 27 | ```ts 28 | extension: string 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TFolder.md: -------------------------------------------------------------------------------- 1 | # TFolder 2 | 3 | Extends `TAbstractFile` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### children 14 | 15 | ```ts 16 | children: TAbstractFile[] 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### isRoot 22 | 23 | ```ts 24 | isRoot(): boolean; 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Tasks.md: -------------------------------------------------------------------------------- 1 | # Tasks 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | 9 | ## Methods 10 | 11 | ### add 12 | 13 | ```ts 14 | add(callback: () => Promise): void; 15 | ``` 16 | 17 | ### addPromise 18 | 19 | ```ts 20 | addPromise(promise: Promise): void; 21 | ``` 22 | 23 | ### isEmpty 24 | 25 | ```ts 26 | isEmpty(): boolean; 27 | ``` 28 | 29 | ### promise 30 | 31 | ```ts 32 | promise(): Promise; 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TextAreaComponent.md: -------------------------------------------------------------------------------- 1 | # TextAreaComponent 2 | 3 | Extends `AbstractTextComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TextComponent.md: -------------------------------------------------------------------------------- 1 | # TextComponent 2 | 3 | Extends `AbstractTextComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/TextFileView.md: -------------------------------------------------------------------------------- 1 | # TextFileView 2 | 3 | Extends `EditableFileView` 4 | 5 | This class implements a plaintext-based editable file view, which can be loaded and saved given an editor. 6 | 7 | Note that by default, this view only saves when it's closing. To implement auto-save, your editor should 8 | call `this.requestSave()` when the content is changed. 9 | 10 | ## Constructor 11 | 12 | ```ts 13 | constructor(leaf: WorkspaceLeaf); 14 | ``` 15 | 16 | ## Properties 17 | 18 | ### data 19 | 20 | ```ts 21 | data: string 22 | ``` 23 | 24 | In memory data 25 | 26 | ### requestSave 27 | 28 | ```ts 29 | requestSave: () => void 30 | ``` 31 | 32 | Debounced save in 2 seconds from now 33 | 34 | ## Methods 35 | 36 | ### onUnloadFile 37 | 38 | ```ts 39 | onUnloadFile(file: TFile): Promise; 40 | ``` 41 | 42 | ### onLoadFile 43 | 44 | ```ts 45 | onLoadFile(file: TFile): Promise; 46 | ``` 47 | 48 | ### save 49 | 50 | ```ts 51 | save(clear?: boolean): Promise; 52 | ``` 53 | 54 | ### getViewData 55 | 56 | ```ts 57 | abstract getViewData(): string; 58 | ``` 59 | 60 | Gets the data from the editor. This will be called to save the editor contents to the file. 61 | 62 | ### setViewData 63 | 64 | ```ts 65 | abstract setViewData(data: string, clear: boolean): void; 66 | ``` 67 | 68 | Set the data to the editor. This is used to load the file contents. 69 | 70 | If clear is set, then it means we're opening a completely different file. 71 | In that case, you should call clear(), or implement a slightly more efficient 72 | clearing mechanism given the new data to be set. 73 | 74 | ### clear 75 | 76 | ```ts 77 | abstract clear(): void; 78 | ``` 79 | 80 | Clear the editor. This is usually called when we're about to open a completely 81 | different file, so it's best to clear any editor states like undo-redo history, 82 | and any caches/indexes associated with the previous file contents. 83 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ToggleComponent.md: -------------------------------------------------------------------------------- 1 | # ToggleComponent 2 | 3 | Extends `ValueComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(containerEl: HTMLElement); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### toggleEl 14 | 15 | ```ts 16 | toggleEl: HTMLElement 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### setDisabled 22 | 23 | ```ts 24 | setDisabled(disabled: boolean): this; 25 | ``` 26 | 27 | ### getValue 28 | 29 | ```ts 30 | getValue(): boolean; 31 | ``` 32 | 33 | ### setValue 34 | 35 | ```ts 36 | setValue(on: boolean): this; 37 | ``` 38 | 39 | ### setTooltip 40 | 41 | ```ts 42 | setTooltip(tooltip: string, options?: TooltipOptions): this; 43 | ``` 44 | 45 | ### onClick 46 | 47 | ```ts 48 | onClick(): void; 49 | ``` 50 | 51 | ### onChange 52 | 53 | ```ts 54 | onChange(callback: (value: boolean) => any): this; 55 | ``` 56 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/ValueComponent.md: -------------------------------------------------------------------------------- 1 | # ValueComponent 2 | 3 | Extends `BaseComponent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### registerOptionListener 14 | 15 | ```ts 16 | registerOptionListener(listeners: Record T>, key: string): this; 17 | ``` 18 | 19 | ### getValue 20 | 21 | ```ts 22 | abstract getValue(): T; 23 | ``` 24 | 25 | ### setValue 26 | 27 | ```ts 28 | abstract setValue(value: T): this; 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/Vault.md: -------------------------------------------------------------------------------- 1 | # Vault 2 | 3 | Extends `Events` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### adapter 14 | 15 | ```ts 16 | adapter: DataAdapter 17 | ``` 18 | 19 | ### configDir 20 | 21 | ```ts 22 | configDir: string 23 | ``` 24 | 25 | Gets the path to the config folder. 26 | This value is typically `.obsidian` but it could be different. 27 | 28 | ## Methods 29 | 30 | ### getName 31 | 32 | ```ts 33 | getName(): string; 34 | ``` 35 | 36 | Gets the name of the vault 37 | 38 | ### getAbstractFileByPath 39 | 40 | ```ts 41 | getAbstractFileByPath(path: string): TAbstractFile | null; 42 | ``` 43 | 44 | ### getRoot 45 | 46 | ```ts 47 | getRoot(): TFolder; 48 | ``` 49 | 50 | ### create 51 | 52 | ```ts 53 | create(path: string, data: string, options?: DataWriteOptions): Promise; 54 | ``` 55 | 56 | ### createBinary 57 | 58 | ```ts 59 | createBinary(path: string, data: ArrayBuffer, options?: DataWriteOptions): Promise; 60 | ``` 61 | 62 | ### createFolder 63 | 64 | ```ts 65 | createFolder(path: string): Promise; 66 | ``` 67 | 68 | ### read 69 | 70 | ```ts 71 | read(file: TFile): Promise; 72 | ``` 73 | 74 | ### cachedRead 75 | 76 | ```ts 77 | cachedRead(file: TFile): Promise; 78 | ``` 79 | 80 | ### readBinary 81 | 82 | ```ts 83 | readBinary(file: TFile): Promise; 84 | ``` 85 | 86 | ### getResourcePath 87 | 88 | ```ts 89 | getResourcePath(file: TFile): string; 90 | ``` 91 | 92 | ### delete 93 | 94 | ```ts 95 | delete(file: TAbstractFile, force?: boolean): Promise; 96 | ``` 97 | 98 | ### trash 99 | 100 | ```ts 101 | trash(file: TAbstractFile, system: boolean): Promise; 102 | ``` 103 | 104 | Tries to move to system trash. If that isn't successful/allowed, use local trash 105 | 106 | ### rename 107 | 108 | ```ts 109 | rename(file: TAbstractFile, newPath: string): Promise; 110 | ``` 111 | 112 | ### modify 113 | 114 | ```ts 115 | modify(file: TFile, data: string, options?: DataWriteOptions): Promise; 116 | ``` 117 | 118 | ### modifyBinary 119 | 120 | ```ts 121 | modifyBinary(file: TFile, data: ArrayBuffer, options?: DataWriteOptions): Promise; 122 | ``` 123 | 124 | ### append 125 | 126 | ```ts 127 | append(file: TFile, data: string, options?: DataWriteOptions): Promise; 128 | ``` 129 | 130 | ### process 131 | 132 | ```ts 133 | process(file: TFile, fn: (data: string) => string, options?: DataWriteOptions): Promise; 134 | ``` 135 | 136 | Atomically read, modify, and save the contents of a note. 137 | 138 | ### copy 139 | 140 | ```ts 141 | copy(file: TFile, newPath: string): Promise; 142 | ``` 143 | 144 | ### getAllLoadedFiles 145 | 146 | ```ts 147 | getAllLoadedFiles(): TAbstractFile[]; 148 | ``` 149 | 150 | ### recurseChildren 151 | 152 | ```ts 153 | static recurseChildren(root: TFolder, cb: (file: TAbstractFile) => any): void; 154 | ``` 155 | 156 | ### getMarkdownFiles 157 | 158 | ```ts 159 | getMarkdownFiles(): TFile[]; 160 | ``` 161 | 162 | ### getFiles 163 | 164 | ```ts 165 | getFiles(): TFile[]; 166 | ``` 167 | 168 | ### on 169 | 170 | ```ts 171 | on(name: 'create', callback: (file: TAbstractFile) => any, ctx?: any): EventRef; 172 | ``` 173 | 174 | ### on 175 | 176 | ```ts 177 | on(name: 'modify', callback: (file: TAbstractFile) => any, ctx?: any): EventRef; 178 | ``` 179 | 180 | ### on 181 | 182 | ```ts 183 | on(name: 'delete', callback: (file: TAbstractFile) => any, ctx?: any): EventRef; 184 | ``` 185 | 186 | ### on 187 | 188 | ```ts 189 | on(name: 'rename', callback: (file: TAbstractFile, oldPath: string) => any, ctx?: any): EventRef; 190 | ``` 191 | 192 | ### on 193 | 194 | ```ts 195 | on(name: 'closed', callback: () => any, ctx?: any): EventRef; 196 | ``` 197 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/View.md: -------------------------------------------------------------------------------- 1 | # View 2 | 3 | Extends `Component` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(leaf: WorkspaceLeaf); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### app 14 | 15 | ```ts 16 | app: App 17 | ``` 18 | 19 | ### icon 20 | 21 | ```ts 22 | icon: string 23 | ``` 24 | 25 | ### navigation 26 | 27 | ```ts 28 | navigation: boolean 29 | ``` 30 | 31 | Whether or not the view is intended for navigation. 32 | If your view is a static view that is not intended to be navigated away, set this to false. 33 | (For example: File explorer, calendar, etc.) 34 | If your view opens a file or can be otherwise navigated, set this to true. 35 | (For example: Markdown editor view, Kanban view, PDF view, etc.) 36 | 37 | ### leaf 38 | 39 | ```ts 40 | leaf: WorkspaceLeaf 41 | ``` 42 | 43 | ### containerEl 44 | 45 | ```ts 46 | containerEl: HTMLElement 47 | ``` 48 | 49 | ## Methods 50 | 51 | ### onOpen 52 | 53 | ```ts 54 | protected onOpen(): Promise; 55 | ``` 56 | 57 | ### onClose 58 | 59 | ```ts 60 | protected onClose(): Promise; 61 | ``` 62 | 63 | ### getViewType 64 | 65 | ```ts 66 | abstract getViewType(): string; 67 | ``` 68 | 69 | ### getState 70 | 71 | ```ts 72 | getState(): any; 73 | ``` 74 | 75 | ### setState 76 | 77 | ```ts 78 | setState(state: any, result: ViewStateResult): Promise; 79 | ``` 80 | 81 | ### getEphemeralState 82 | 83 | ```ts 84 | getEphemeralState(): any; 85 | ``` 86 | 87 | ### setEphemeralState 88 | 89 | ```ts 90 | setEphemeralState(state: any): void; 91 | ``` 92 | 93 | ### getIcon 94 | 95 | ```ts 96 | getIcon(): IconName; 97 | ``` 98 | 99 | ### onResize 100 | 101 | ```ts 102 | onResize(): void; 103 | ``` 104 | 105 | Called when the size of this view is changed. 106 | 107 | ### getDisplayText 108 | 109 | ```ts 110 | abstract getDisplayText(): string; 111 | ``` 112 | 113 | ### onPaneMenu 114 | 115 | ```ts 116 | onPaneMenu(menu: Menu, source: 'more-options' | 'tab-header' | string): void; 117 | ``` 118 | 119 | Populates the pane menu. 120 | 121 | (Replaces the previously removed `onHeaderMenu` and `onMoreOptionsMenu`) 122 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceContainer.md: -------------------------------------------------------------------------------- 1 | # WorkspaceContainer 2 | 3 | Extends `WorkspaceSplit` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### win 14 | 15 | ```ts 16 | win: Window 17 | ``` 18 | 19 | ### doc 20 | 21 | ```ts 22 | doc: Document 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceFloating.md: -------------------------------------------------------------------------------- 1 | # WorkspaceFloating 2 | 3 | Extends `WorkspaceParent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceItem.md: -------------------------------------------------------------------------------- 1 | # WorkspaceItem 2 | 3 | Extends `Events` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Methods 12 | 13 | ### getRoot 14 | 15 | ```ts 16 | getRoot(): WorkspaceItem; 17 | ``` 18 | 19 | ### getContainer 20 | 21 | ```ts 22 | getContainer(): WorkspaceContainer; 23 | ``` 24 | 25 | Get the root container parent item, which can be one of: 26 | - {@link WorkspaceRoot} 27 | - {@link WorkspaceWindow} 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceLeaf.md: -------------------------------------------------------------------------------- 1 | # WorkspaceLeaf 2 | 3 | Extends `WorkspaceItem` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### view 14 | 15 | ```ts 16 | view: View 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### openFile 22 | 23 | ```ts 24 | openFile(file: TFile, openState?: OpenViewState): Promise; 25 | ``` 26 | 27 | By default, `openFile` will also make the leaf active. 28 | Pass in `{ active: false }` to override. 29 | 30 | ### open 31 | 32 | ```ts 33 | open(view: View): Promise; 34 | ``` 35 | 36 | ### getViewState 37 | 38 | ```ts 39 | getViewState(): ViewState; 40 | ``` 41 | 42 | ### setViewState 43 | 44 | ```ts 45 | setViewState(viewState: ViewState, eState?: any): Promise; 46 | ``` 47 | 48 | ### getEphemeralState 49 | 50 | ```ts 51 | getEphemeralState(): any; 52 | ``` 53 | 54 | ### setEphemeralState 55 | 56 | ```ts 57 | setEphemeralState(state: any): void; 58 | ``` 59 | 60 | ### togglePinned 61 | 62 | ```ts 63 | togglePinned(): void; 64 | ``` 65 | 66 | ### setPinned 67 | 68 | ```ts 69 | setPinned(pinned: boolean): void; 70 | ``` 71 | 72 | ### setGroupMember 73 | 74 | ```ts 75 | setGroupMember(other: WorkspaceLeaf): void; 76 | ``` 77 | 78 | ### setGroup 79 | 80 | ```ts 81 | setGroup(group: string): void; 82 | ``` 83 | 84 | ### detach 85 | 86 | ```ts 87 | detach(): void; 88 | ``` 89 | 90 | ### getIcon 91 | 92 | ```ts 93 | getIcon(): IconName; 94 | ``` 95 | 96 | ### getDisplayText 97 | 98 | ```ts 99 | getDisplayText(): string; 100 | ``` 101 | 102 | ### onResize 103 | 104 | ```ts 105 | onResize(): void; 106 | ``` 107 | 108 | ### on 109 | 110 | ```ts 111 | on(name: 'pinned-change', callback: (pinned: boolean) => any, ctx?: any): EventRef; 112 | ``` 113 | 114 | ### on 115 | 116 | ```ts 117 | on(name: 'group-change', callback: (group: string) => any, ctx?: any): EventRef; 118 | ``` 119 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceMobileDrawer.md: -------------------------------------------------------------------------------- 1 | # WorkspaceMobileDrawer 2 | 3 | Extends `WorkspaceParent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### collapsed 14 | 15 | ```ts 16 | collapsed: boolean 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### expand 22 | 23 | ```ts 24 | expand(): void; 25 | ``` 26 | 27 | ### collapse 28 | 29 | ```ts 30 | collapse(): void; 31 | ``` 32 | 33 | ### toggle 34 | 35 | ```ts 36 | toggle(): void; 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceParent.md: -------------------------------------------------------------------------------- 1 | # WorkspaceParent 2 | 3 | Extends `WorkspaceItem` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceRibbon.md: -------------------------------------------------------------------------------- 1 | # WorkspaceRibbon 2 | 3 | ## Constructor 4 | 5 | ```ts 6 | constructor(); 7 | ``` 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceRoot.md: -------------------------------------------------------------------------------- 1 | # WorkspaceRoot 2 | 3 | Extends `WorkspaceContainer` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### win 14 | 15 | ```ts 16 | win: Window 17 | ``` 18 | 19 | ### doc 20 | 21 | ```ts 22 | doc: Document 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceSidedock.md: -------------------------------------------------------------------------------- 1 | # WorkspaceSidedock 2 | 3 | Extends `WorkspaceSplit` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### collapsed 14 | 15 | ```ts 16 | collapsed: boolean 17 | ``` 18 | 19 | ## Methods 20 | 21 | ### toggle 22 | 23 | ```ts 24 | toggle(): void; 25 | ``` 26 | 27 | ### collapse 28 | 29 | ```ts 30 | collapse(): void; 31 | ``` 32 | 33 | ### expand 34 | 35 | ```ts 36 | expand(): void; 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceSplit.md: -------------------------------------------------------------------------------- 1 | # WorkspaceSplit 2 | 3 | Extends `WorkspaceParent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceTabs.md: -------------------------------------------------------------------------------- 1 | # WorkspaceTabs 2 | 3 | Extends `WorkspaceParent` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/WorkspaceWindow.md: -------------------------------------------------------------------------------- 1 | # WorkspaceWindow 2 | 3 | Extends `WorkspaceContainer` 4 | 5 | ## Constructor 6 | 7 | ```ts 8 | constructor(); 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### win 14 | 15 | ```ts 16 | win: Window 17 | ``` 18 | 19 | ### doc 20 | 21 | ```ts 22 | doc: Document 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/classes/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Classes" 3 | } 4 | -------------------------------------------------------------------------------- /docs/reference/typescript/enums/PopoverState.md: -------------------------------------------------------------------------------- 1 | # PopoverState 2 | 3 | ```ts 4 | export enum PopoverState { 5 | } 6 | ``` 7 | -------------------------------------------------------------------------------- /docs/reference/typescript/enums/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Enums" 3 | } 4 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Functions" 3 | } 4 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/addIcon.md: -------------------------------------------------------------------------------- 1 | # addIcon 2 | 3 | ```ts 4 | export function addIcon(iconId: string, svgContent: string): void; 5 | ``` 6 | 7 | Adds an icon to the library 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `iconId` | the icon ID | 14 | | `svgContent` | the content of the SVG. | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/ajax.md: -------------------------------------------------------------------------------- 1 | # ajax 2 | 3 | ```ts 4 | function ajax(options: AjaxOptions): void; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `options` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/ajaxPromise.md: -------------------------------------------------------------------------------- 1 | # ajaxPromise 2 | 3 | ```ts 4 | function ajaxPromise(options: AjaxOptions): Promise; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `options` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/arrayBufferToBase64.md: -------------------------------------------------------------------------------- 1 | # arrayBufferToBase64 2 | 3 | ```ts 4 | export function arrayBufferToBase64(buffer: ArrayBuffer): string; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `buffer` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/arrayBufferToHex.md: -------------------------------------------------------------------------------- 1 | # arrayBufferToHex 2 | 3 | ```ts 4 | export function arrayBufferToHex(data: ArrayBuffer): string; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `data` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/base64ToArrayBuffer.md: -------------------------------------------------------------------------------- 1 | # base64ToArrayBuffer 2 | 3 | ```ts 4 | export function base64ToArrayBuffer(base64: string): ArrayBuffer; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `base64` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/createDiv.md: -------------------------------------------------------------------------------- 1 | # createDiv 2 | 3 | ```ts 4 | function createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `o` | | 12 | | `callback` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/createEl.md: -------------------------------------------------------------------------------- 1 | # createEl 2 | 3 | ```ts 4 | function createEl(tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K]; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `tag` | | 12 | | `o` | | 13 | | `callback` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/createFragment.md: -------------------------------------------------------------------------------- 1 | # createFragment 2 | 3 | ```ts 4 | function createFragment(callback?: (el: DocumentFragment) => void): DocumentFragment; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `callback` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/createSpan.md: -------------------------------------------------------------------------------- 1 | # createSpan 2 | 3 | ```ts 4 | function createSpan(o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `o` | | 12 | | `callback` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/createSvg.md: -------------------------------------------------------------------------------- 1 | # createSvg 2 | 3 | ```ts 4 | function createSvg(tag: K, o?: SvgElementInfo | string, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K]; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `tag` | | 12 | | `o` | | 13 | | `callback` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/debounce.md: -------------------------------------------------------------------------------- 1 | # debounce 2 | 3 | ```ts 4 | export function debounce(cb: (...args: [ 5 | ...T 6 | ]) => V, timeout?: number, resetTimer?: boolean): Debouncer; 7 | ``` 8 | 9 | A standard debounce function. 10 | 11 | ## Parameters 12 | 13 | | Parameter | Description | 14 | |-----------|-------------| 15 | | `cb` | The function to call. | 16 | | `timeout` | The timeout to wait. | 17 | | `resetTimer` | Whether to reset the timeout when the debouncer is called again. | 18 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/finishRenderMath.md: -------------------------------------------------------------------------------- 1 | # finishRenderMath 2 | 3 | ```ts 4 | export function finishRenderMath(): Promise; 5 | ``` 6 | 7 | Flush the MathJax stylesheet. 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/fish.md: -------------------------------------------------------------------------------- 1 | # fish 2 | 3 | ```ts 4 | function fish(selector: string): HTMLElement | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `selector` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/fishAll.md: -------------------------------------------------------------------------------- 1 | # fishAll 2 | 3 | ```ts 4 | function fishAll(selector: string): HTMLElement[]; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `selector` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/fuzzySearch.md: -------------------------------------------------------------------------------- 1 | # fuzzySearch 2 | 3 | ```ts 4 | export function fuzzySearch(q: PreparedQuery, text: string): SearchResult | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `q` | | 12 | | `text` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/getAllTags.md: -------------------------------------------------------------------------------- 1 | # getAllTags 2 | 3 | ```ts 4 | export function getAllTags(cache: CachedMetadata): string[] | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `cache` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/getBlobArrayBuffer.md: -------------------------------------------------------------------------------- 1 | # getBlobArrayBuffer 2 | 3 | ```ts 4 | export function getBlobArrayBuffer(blob: Blob): Promise; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `blob` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/getIcon.md: -------------------------------------------------------------------------------- 1 | # getIcon 2 | 3 | ```ts 4 | export function getIcon(iconId: string): SVGSVGElement | null; 5 | ``` 6 | 7 | Create an SVG from an iconId. Returns null if no icon associated with the iconId. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `iconId` | the icon ID | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/getIconIds.md: -------------------------------------------------------------------------------- 1 | # getIconIds 2 | 3 | ```ts 4 | export function getIconIds(): IconName[]; 5 | ``` 6 | 7 | Get the list of registered icons 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/getLinkpath.md: -------------------------------------------------------------------------------- 1 | # getLinkpath 2 | 3 | ```ts 4 | export function getLinkpath(linktext: string): string; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `linktext` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/hexToArrayBuffer.md: -------------------------------------------------------------------------------- 1 | # hexToArrayBuffer 2 | 3 | ```ts 4 | export function hexToArrayBuffer(hex: string): ArrayBuffer; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `hex` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/htmlToMarkdown.md: -------------------------------------------------------------------------------- 1 | # htmlToMarkdown 2 | 3 | ```ts 4 | export function htmlToMarkdown(html: string): string; 5 | ``` 6 | 7 | Converts HTML to Markdown using Turndown Service. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `html` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/isBoolean.md: -------------------------------------------------------------------------------- 1 | # isBoolean 2 | 3 | ```ts 4 | function isBoolean(obj: any): obj is boolean; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `obj` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/iterateCacheRefs.md: -------------------------------------------------------------------------------- 1 | # iterateCacheRefs 2 | 3 | ```ts 4 | export function iterateCacheRefs(cache: CachedMetadata, cb: (ref: ReferenceCache) => boolean | void): boolean; 5 | ``` 6 | 7 | Iterate links and embeds. If callback returns true, the iteration process will be interrupted. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `cache` | | 14 | | `cb` | | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/iterateRefs.md: -------------------------------------------------------------------------------- 1 | # iterateRefs 2 | 3 | ```ts 4 | export function iterateRefs(refs: ReferenceCache[], cb: (ref: ReferenceCache) => boolean | void): boolean; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `refs` | | 12 | | `cb` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/loadMathJax.md: -------------------------------------------------------------------------------- 1 | # loadMathJax 2 | 3 | ```ts 4 | export function loadMathJax(): Promise; 5 | ``` 6 | 7 | Load MathJax. 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/loadMermaid.md: -------------------------------------------------------------------------------- 1 | # loadMermaid 2 | 3 | ```ts 4 | export function loadMermaid(): Promise; 5 | ``` 6 | 7 | Load Mermaid and return a promise to the global mermaid object. 8 | Can also use `mermaid` after this promise resolves to get the same reference. 9 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/loadPdfJs.md: -------------------------------------------------------------------------------- 1 | # loadPdfJs 2 | 3 | ```ts 4 | export function loadPdfJs(): Promise; 5 | ``` 6 | 7 | Load PDF.js and return a promise to the global pdfjsLib object. 8 | Can also use `window.pdfjsLib` after this promise resolves to get the same reference. 9 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/loadPrism.md: -------------------------------------------------------------------------------- 1 | # loadPrism 2 | 3 | ```ts 4 | export function loadPrism(): Promise; 5 | ``` 6 | 7 | Load Prism.js and return a promise to the global Prism object. 8 | Can also use `Prism` after this promise resolves to get the same reference. 9 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/normalizePath.md: -------------------------------------------------------------------------------- 1 | # normalizePath 2 | 3 | ```ts 4 | export function normalizePath(path: string): string; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `path` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseFrontMatterAliases.md: -------------------------------------------------------------------------------- 1 | # parseFrontMatterAliases 2 | 3 | ```ts 4 | export function parseFrontMatterAliases(frontmatter: any | null): string[] | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `frontmatter` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseFrontMatterEntry.md: -------------------------------------------------------------------------------- 1 | # parseFrontMatterEntry 2 | 3 | ```ts 4 | export function parseFrontMatterEntry(frontmatter: any | null, key: string | RegExp): any | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `frontmatter` | | 12 | | `key` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseFrontMatterStringArray.md: -------------------------------------------------------------------------------- 1 | # parseFrontMatterStringArray 2 | 3 | ```ts 4 | export function parseFrontMatterStringArray(frontmatter: any | null, key: string | RegExp, nospaces?: boolean): string[] | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `frontmatter` | | 12 | | `key` | | 13 | | `nospaces` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseFrontMatterTags.md: -------------------------------------------------------------------------------- 1 | # parseFrontMatterTags 2 | 3 | ```ts 4 | export function parseFrontMatterTags(frontmatter: any | null): string[] | null; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `frontmatter` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseLinktext.md: -------------------------------------------------------------------------------- 1 | # parseLinktext 2 | 3 | ```ts 4 | export function parseLinktext(linktext: string): { 5 | path: string; 6 | subpath: string; 7 | }; 8 | ``` 9 | 10 | ## Parameters 11 | 12 | | Parameter | Description | 13 | |-----------|-------------| 14 | | `linktext` | | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/parseYaml.md: -------------------------------------------------------------------------------- 1 | # parseYaml 2 | 3 | ```ts 4 | export function parseYaml(yaml: string): any; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `yaml` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/prepareFuzzySearch.md: -------------------------------------------------------------------------------- 1 | # prepareFuzzySearch 2 | 3 | ```ts 4 | export function prepareFuzzySearch(query: string): (text: string) => SearchResult | null; 5 | ``` 6 | 7 | Construct a fuzzy search callback that runs on a target string. 8 | Performance may be an issue if you are running the search for more than a few thousand times. 9 | If performance is a problem, consider using `prepareSimpleSearch` instead. 10 | 11 | ## Parameters 12 | 13 | | Parameter | Description | 14 | |-----------|-------------| 15 | | `query` | the fuzzy query. | 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/prepareQuery.md: -------------------------------------------------------------------------------- 1 | # prepareQuery 2 | 3 | ```ts 4 | export function prepareQuery(query: string): PreparedQuery; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `query` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/prepareSimpleSearch.md: -------------------------------------------------------------------------------- 1 | # prepareSimpleSearch 2 | 3 | ```ts 4 | export function prepareSimpleSearch(query: string): (text: string) => SearchResult | null; 5 | ``` 6 | 7 | Construct a simple search callback that runs on a target string. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `query` | the space-separated words | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/ready.md: -------------------------------------------------------------------------------- 1 | # ready 2 | 3 | ```ts 4 | function ready(fn: () => any): void; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `fn` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/removeIcon.md: -------------------------------------------------------------------------------- 1 | # removeIcon 2 | 3 | ```ts 4 | export function removeIcon(iconId: string): void; 5 | ``` 6 | 7 | Remove a custom icon from the library 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `iconId` | the icon ID | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/renderMatches.md: -------------------------------------------------------------------------------- 1 | # renderMatches 2 | 3 | ```ts 4 | export function renderMatches(el: HTMLElement | DocumentFragment, text: string, matches: SearchMatches | null, offset?: number): void; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `el` | | 12 | | `text` | | 13 | | `matches` | | 14 | | `offset` | | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/renderMath.md: -------------------------------------------------------------------------------- 1 | # renderMath 2 | 3 | ```ts 4 | export function renderMath(source: string, display: boolean): HTMLElement; 5 | ``` 6 | 7 | Render some LaTeX math using the MathJax engine. Returns an HTMLElement. 8 | Requires calling `finishRenderMath` when rendering is all done to flush the MathJax stylesheet. 9 | 10 | ## Parameters 11 | 12 | | Parameter | Description | 13 | |-----------|-------------| 14 | | `source` | | 15 | | `display` | | 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/renderResults.md: -------------------------------------------------------------------------------- 1 | # renderResults 2 | 3 | ```ts 4 | export function renderResults(el: HTMLElement, text: string, result: SearchResult, offset?: number): void; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `el` | | 12 | | `text` | | 13 | | `result` | | 14 | | `offset` | | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/request.md: -------------------------------------------------------------------------------- 1 | # request 2 | 3 | ```ts 4 | export function request(request: RequestUrlParam | string): Promise; 5 | ``` 6 | 7 | Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions. 8 | Returns the text value of the response. 9 | 10 | ## Parameters 11 | 12 | | Parameter | Description | 13 | |-----------|-------------| 14 | | `request` | | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/requestUrl.md: -------------------------------------------------------------------------------- 1 | # requestUrl 2 | 3 | ```ts 4 | export function requestUrl(request: RequestUrlParam | string): RequestUrlResponsePromise; 5 | ``` 6 | 7 | Similar to `fetch()`, request a URL using HTTP/HTTPS, without any CORS restrictions. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `request` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/requireApiVersion.md: -------------------------------------------------------------------------------- 1 | # requireApiVersion 2 | 3 | ```ts 4 | export function requireApiVersion(version: string): boolean; 5 | ``` 6 | 7 | Returns true if the API version is equal or higher than the requested version. 8 | Use this to limit functionality that require specific API versions to avoid 9 | crashing on older Obsidian builds. 10 | 11 | ## Parameters 12 | 13 | | Parameter | Description | 14 | |-----------|-------------| 15 | | `version` | | 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/resolveSubpath.md: -------------------------------------------------------------------------------- 1 | # resolveSubpath 2 | 3 | ```ts 4 | export function resolveSubpath(cache: CachedMetadata, subpath: string): HeadingSubpathResult | BlockSubpathResult; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `cache` | | 12 | | `subpath` | | 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/sanitizeHTMLToDom.md: -------------------------------------------------------------------------------- 1 | # sanitizeHTMLToDom 2 | 3 | ```ts 4 | export function sanitizeHTMLToDom(html: string): DocumentFragment; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `html` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/setIcon.md: -------------------------------------------------------------------------------- 1 | # setIcon 2 | 3 | ```ts 4 | export function setIcon(parent: HTMLElement, iconId: IconName): void; 5 | ``` 6 | 7 | Insert an SVG into the element from an iconId. Does nothing if no icon associated with the iconId. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `parent` | the HTML element to insert the icon | 14 | | `iconId` | the icon ID | 15 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/sleep.md: -------------------------------------------------------------------------------- 1 | # sleep 2 | 3 | ```ts 4 | function sleep(ms: number): Promise; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `ms` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/sortSearchResults.md: -------------------------------------------------------------------------------- 1 | # sortSearchResults 2 | 3 | ```ts 4 | export function sortSearchResults(results: SearchResultContainer[]): void; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `results` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/stringifyYaml.md: -------------------------------------------------------------------------------- 1 | # stringifyYaml 2 | 3 | ```ts 4 | export function stringifyYaml(obj: any): string; 5 | ``` 6 | 7 | ## Parameters 8 | 9 | | Parameter | Description | 10 | |-----------|-------------| 11 | | `obj` | | 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/stripHeading.md: -------------------------------------------------------------------------------- 1 | # stripHeading 2 | 3 | ```ts 4 | export function stripHeading(heading: string): string; 5 | ``` 6 | 7 | This function normalizes headings for link matching by stripping out special characters and shrinking consecutive spaces. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `heading` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/functions/stripHeadingForLink.md: -------------------------------------------------------------------------------- 1 | # stripHeadingForLink 2 | 3 | ```ts 4 | export function stripHeadingForLink(heading: string): string; 5 | ``` 6 | 7 | This function prepares headings for linking. It strips out some bad combinations of special characters that could break links. 8 | 9 | ## Parameters 10 | 11 | | Parameter | Description | 12 | |-----------|-------------| 13 | | `heading` | | 14 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/AjaxOptions.md: -------------------------------------------------------------------------------- 1 | # AjaxOptions 2 | 3 | ## Properties 4 | 5 | ### method 6 | 7 | ```ts 8 | method: "GET" | "POST" 9 | ``` 10 | 11 | ### url 12 | 13 | ```ts 14 | url: string 15 | ``` 16 | 17 | ### success 18 | 19 | ```ts 20 | success: (response: any, req: XMLHttpRequest) => any 21 | ``` 22 | 23 | ### error 24 | 25 | ```ts 26 | error: (error: any, req: XMLHttpRequest) => any 27 | ``` 28 | 29 | ### data 30 | 31 | ```ts 32 | data: string | object | ArrayBuffer 33 | ``` 34 | 35 | ### headers 36 | 37 | ```ts 38 | headers: Record 39 | ``` 40 | 41 | ### withCredentials 42 | 43 | ```ts 44 | withCredentials: boolean 45 | ``` 46 | 47 | ### req 48 | 49 | ```ts 50 | req: XMLHttpRequest 51 | ``` 52 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Array.md: -------------------------------------------------------------------------------- 1 | # Array 2 | 3 | ## Methods 4 | 5 | ### first 6 | 7 | ```ts 8 | first: () => T 9 | ``` 10 | 11 | ### last 12 | 13 | ```ts 14 | last: () => T 15 | ``` 16 | 17 | ### contains 18 | 19 | ```ts 20 | contains: (target: T) => boolean 21 | ``` 22 | 23 | ### remove 24 | 25 | ```ts 26 | remove: (target: T) => void 27 | ``` 28 | 29 | ### shuffle 30 | 31 | ```ts 32 | shuffle: () => this 33 | ``` 34 | 35 | ### unique 36 | 37 | ```ts 38 | unique: () => T[] 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ArrayConstructor.md: -------------------------------------------------------------------------------- 1 | # ArrayConstructor 2 | 3 | ## Methods 4 | 5 | ### combine 6 | 7 | ```ts 8 | combine: (arrays: T[][]) => T[] 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/BlockCache.md: -------------------------------------------------------------------------------- 1 | # BlockCache 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | ```ts 8 | id: string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/BlockSubpathResult.md: -------------------------------------------------------------------------------- 1 | # BlockSubpathResult 2 | 3 | ## Properties 4 | 5 | ### type 6 | 7 | ```ts 8 | type: "block" 9 | ``` 10 | 11 | ### block 12 | 13 | ```ts 14 | block: BlockCache 15 | ``` 16 | 17 | ### list 18 | 19 | ```ts 20 | list: ListItemCache 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/CacheItem.md: -------------------------------------------------------------------------------- 1 | # CacheItem 2 | 3 | ## Properties 4 | 5 | ### position 6 | 7 | ```ts 8 | position: Pos 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/CachedMetadata.md: -------------------------------------------------------------------------------- 1 | # CachedMetadata 2 | 3 | ## Properties 4 | 5 | ### links 6 | 7 | ```ts 8 | links: LinkCache[] 9 | ``` 10 | 11 | ### embeds 12 | 13 | ```ts 14 | embeds: EmbedCache[] 15 | ``` 16 | 17 | ### tags 18 | 19 | ```ts 20 | tags: TagCache[] 21 | ``` 22 | 23 | ### headings 24 | 25 | ```ts 26 | headings: HeadingCache[] 27 | ``` 28 | 29 | ### sections 30 | 31 | ```ts 32 | sections: SectionCache[] 33 | ``` 34 | 35 | Sections are root level markdown blocks, which can be used to divide the document up. 36 | 37 | ### listItems 38 | 39 | ```ts 40 | listItems: ListItemCache[] 41 | ``` 42 | 43 | ### frontmatter 44 | 45 | ```ts 46 | frontmatter: FrontMatterCache 47 | ``` 48 | 49 | ### blocks 50 | 51 | ```ts 52 | blocks: Record 53 | ``` 54 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/CloseableComponent.md: -------------------------------------------------------------------------------- 1 | # CloseableComponent 2 | 3 | ## Methods 4 | 5 | ### close 6 | 7 | ```ts 8 | close: () => any 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Command.md: -------------------------------------------------------------------------------- 1 | # Command 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | ```ts 8 | id: string 9 | ``` 10 | 11 | Globally unique ID to identify this command. 12 | 13 | ### name 14 | 15 | ```ts 16 | name: string 17 | ``` 18 | 19 | Human friendly name for searching. 20 | 21 | ### icon 22 | 23 | ```ts 24 | icon: string 25 | ``` 26 | 27 | Icon ID to be used in the toolbar. 28 | 29 | ### mobileOnly 30 | 31 | ```ts 32 | mobileOnly: boolean 33 | ``` 34 | 35 | ### repeatable 36 | 37 | ```ts 38 | repeatable: boolean 39 | ``` 40 | 41 | Whether holding the hotkey should repeatedly trigger this command. Defaults to false. 42 | 43 | ### callback 44 | 45 | ```ts 46 | callback: () => any 47 | ``` 48 | 49 | Simple callback, triggered globally. 50 | 51 | ### checkCallback 52 | 53 | ```ts 54 | checkCallback: (checking: boolean) => boolean | void 55 | ``` 56 | 57 | Complex callback, overrides the simple callback. 58 | Used to "check" whether your command can be performed in the current circumstances. 59 | For example, if your command requires the active focused pane to be a MarkdownSourceView, then 60 | you should only return true if the condition is satisfied. Returning false or undefined causes 61 | the command to be hidden from the command palette. 62 | 63 | ### editorCallback 64 | 65 | ```ts 66 | editorCallback: (editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => any 67 | ``` 68 | 69 | A command callback that is only triggered when the user is in an editor. 70 | Overrides `callback` and `checkCallback` 71 | 72 | ### editorCheckCallback 73 | 74 | ```ts 75 | editorCheckCallback: (checking: boolean, editor: Editor, ctx: MarkdownView | MarkdownFileInfo) => boolean | void 76 | ``` 77 | 78 | A command callback that is only triggered when the user is in an editor. 79 | Overrides `editorCallback`, `callback` and `checkCallback` 80 | 81 | ### hotkeys 82 | 83 | ```ts 84 | hotkeys: Hotkey[] 85 | ``` 86 | 87 | Sets the default hotkey. It is recommended for plugins to avoid setting default hotkeys if possible, 88 | to avoid conflicting hotkeys with one that's set by the user, even though customized hotkeys have higher priority. 89 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Constructor.md: -------------------------------------------------------------------------------- 1 | # Constructor 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/DataAdapter.md: -------------------------------------------------------------------------------- 1 | # DataAdapter 2 | 3 | ## Methods 4 | 5 | ### getName 6 | 7 | ```ts 8 | getName: () => string 9 | ``` 10 | 11 | ### exists 12 | 13 | ```ts 14 | exists: (normalizedPath: string, sensitive?: boolean) => Promise 15 | ``` 16 | 17 | ### stat 18 | 19 | ```ts 20 | stat: (normalizedPath: string) => Promise 21 | ``` 22 | 23 | ### list 24 | 25 | ```ts 26 | list: (normalizedPath: string) => Promise 27 | ``` 28 | 29 | ### read 30 | 31 | ```ts 32 | read: (normalizedPath: string) => Promise 33 | ``` 34 | 35 | ### readBinary 36 | 37 | ```ts 38 | readBinary: (normalizedPath: string) => Promise 39 | ``` 40 | 41 | ### write 42 | 43 | ```ts 44 | write: (normalizedPath: string, data: string, options?: DataWriteOptions) => Promise 45 | ``` 46 | 47 | ### writeBinary 48 | 49 | ```ts 50 | writeBinary: (normalizedPath: string, data: ArrayBuffer, options?: DataWriteOptions) => Promise 51 | ``` 52 | 53 | ### append 54 | 55 | ```ts 56 | append: (normalizedPath: string, data: string, options?: DataWriteOptions) => Promise 57 | ``` 58 | 59 | ### process 60 | 61 | ```ts 62 | process: (normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions) => Promise 63 | ``` 64 | 65 | ### getResourcePath 66 | 67 | ```ts 68 | getResourcePath: (normalizedPath: string) => string 69 | ``` 70 | 71 | ### mkdir 72 | 73 | ```ts 74 | mkdir: (normalizedPath: string) => Promise 75 | ``` 76 | 77 | ### trashSystem 78 | 79 | ```ts 80 | trashSystem: (normalizedPath: string) => Promise 81 | ``` 82 | 83 | ### trashLocal 84 | 85 | ```ts 86 | trashLocal: (normalizedPath: string) => Promise 87 | ``` 88 | 89 | ### rmdir 90 | 91 | ```ts 92 | rmdir: (normalizedPath: string, recursive: boolean) => Promise 93 | ``` 94 | 95 | ### remove 96 | 97 | ```ts 98 | remove: (normalizedPath: string) => Promise 99 | ``` 100 | 101 | ### rename 102 | 103 | ```ts 104 | rename: (normalizedPath: string, normalizedNewPath: string) => Promise 105 | ``` 106 | 107 | ### copy 108 | 109 | ```ts 110 | copy: (normalizedPath: string, normalizedNewPath: string) => Promise 111 | ``` 112 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/DataWriteOptions.md: -------------------------------------------------------------------------------- 1 | # DataWriteOptions 2 | 3 | ## Properties 4 | 5 | ### ctime 6 | 7 | ```ts 8 | ctime: number 9 | ``` 10 | 11 | ### mtime 12 | 13 | ```ts 14 | mtime: number 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Debouncer.md: -------------------------------------------------------------------------------- 1 | # Debouncer 2 | 3 | ## Methods 4 | 5 | ### cancel 6 | 7 | ```ts 8 | cancel: () => this 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Document.md: -------------------------------------------------------------------------------- 1 | # Document 2 | 3 | Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. 4 | 5 | ## Properties 6 | 7 | ### _EVENTS 8 | 9 | ```ts 10 | _EVENTS: { fullscreenchange?: EventListenerInfo[]; fullscreenerror?: EventListenerInfo[]; pointerlockchange?: EventListenerInfo[]; pointerlockerror?: EventListenerInfo[]; ... 91 more ...; paste?: EventListenerInfo[]; } 11 | ``` 12 | 13 | ## Methods 14 | 15 | ### on 16 | 17 | ```ts 18 | on: (this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[... 19 | ``` 20 | 21 | ### off 22 | 23 | ```ts 24 | off: (this: Document, type: K, selector: string, listener: (this: Document, ev: DocumentEventMap[... 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/DocumentFragment.md: -------------------------------------------------------------------------------- 1 | # DocumentFragment 2 | 3 | A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. 4 | 5 | ## Methods 6 | 7 | ### find 8 | 9 | ```ts 10 | find: (selector: string) => HTMLElement 11 | ``` 12 | 13 | ### findAll 14 | 15 | ```ts 16 | findAll: (selector: string) => HTMLElement[] 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/DomElementInfo.md: -------------------------------------------------------------------------------- 1 | # DomElementInfo 2 | 3 | ## Properties 4 | 5 | ### cls 6 | 7 | ```ts 8 | cls: string | string[] 9 | ``` 10 | 11 | The class to be assigned. Can be a space-separated string or an array of strings. 12 | 13 | ### text 14 | 15 | ```ts 16 | text: string | DocumentFragment 17 | ``` 18 | 19 | The textContent to be assigned. 20 | 21 | ### attr 22 | 23 | ```ts 24 | attr: { [key: string]: string | number | boolean; } 25 | ``` 26 | 27 | HTML attributes to be added. 28 | 29 | ### title 30 | 31 | ```ts 32 | title: string 33 | ``` 34 | 35 | HTML title (for hover tooltip). 36 | 37 | ### parent 38 | 39 | ```ts 40 | parent: Node 41 | ``` 42 | 43 | The parent element to be assigned to. 44 | 45 | ### value 46 | 47 | ```ts 48 | value: string 49 | ``` 50 | 51 | ### type 52 | 53 | ```ts 54 | type: string 55 | ``` 56 | 57 | ### prepend 58 | 59 | ```ts 60 | prepend: boolean 61 | ``` 62 | 63 | ### placeholder 64 | 65 | ```ts 66 | placeholder: string 67 | ``` 68 | 69 | ### href 70 | 71 | ```ts 72 | href: string 73 | ``` 74 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorChange.md: -------------------------------------------------------------------------------- 1 | # EditorChange 2 | 3 | ## Properties 4 | 5 | ### text 6 | 7 | ```ts 8 | text: string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorPosition.md: -------------------------------------------------------------------------------- 1 | # EditorPosition 2 | 3 | ## Properties 4 | 5 | ### line 6 | 7 | ```ts 8 | line: number 9 | ``` 10 | 11 | ### ch 12 | 13 | ```ts 14 | ch: number 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorRange.md: -------------------------------------------------------------------------------- 1 | # EditorRange 2 | 3 | ## Properties 4 | 5 | ### from 6 | 7 | ```ts 8 | from: EditorPosition 9 | ``` 10 | 11 | ### to 12 | 13 | ```ts 14 | to: EditorPosition 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorRangeOrCaret.md: -------------------------------------------------------------------------------- 1 | # EditorRangeOrCaret 2 | 3 | ## Properties 4 | 5 | ### from 6 | 7 | ```ts 8 | from: EditorPosition 9 | ``` 10 | 11 | ### to 12 | 13 | ```ts 14 | to: EditorPosition 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorScrollInfo.md: -------------------------------------------------------------------------------- 1 | # EditorScrollInfo 2 | 3 | ## Properties 4 | 5 | ### left 6 | 7 | ```ts 8 | left: number 9 | ``` 10 | 11 | ### top 12 | 13 | ```ts 14 | top: number 15 | ``` 16 | 17 | ### width 18 | 19 | ```ts 20 | width: number 21 | ``` 22 | 23 | ### height 24 | 25 | ```ts 26 | height: number 27 | ``` 28 | 29 | ### clientWidth 30 | 31 | ```ts 32 | clientWidth: number 33 | ``` 34 | 35 | ### clientHeight 36 | 37 | ```ts 38 | clientHeight: number 39 | ``` 40 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorSelection.md: -------------------------------------------------------------------------------- 1 | # EditorSelection 2 | 3 | ## Properties 4 | 5 | ### anchor 6 | 7 | ```ts 8 | anchor: EditorPosition 9 | ``` 10 | 11 | ### head 12 | 13 | ```ts 14 | head: EditorPosition 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorSelectionOrCaret.md: -------------------------------------------------------------------------------- 1 | # EditorSelectionOrCaret 2 | 3 | ## Properties 4 | 5 | ### anchor 6 | 7 | ```ts 8 | anchor: EditorPosition 9 | ``` 10 | 11 | ### head 12 | 13 | ```ts 14 | head: EditorPosition 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorSuggestContext.md: -------------------------------------------------------------------------------- 1 | # EditorSuggestContext 2 | 3 | ## Properties 4 | 5 | ### editor 6 | 7 | ```ts 8 | editor: Editor 9 | ``` 10 | 11 | ### file 12 | 13 | ```ts 14 | file: TFile 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorSuggestTriggerInfo.md: -------------------------------------------------------------------------------- 1 | # EditorSuggestTriggerInfo 2 | 3 | ## Properties 4 | 5 | ### start 6 | 7 | ```ts 8 | start: EditorPosition 9 | ``` 10 | 11 | The start position of the triggering text. This is used to position the popover. 12 | 13 | ### end 14 | 15 | ```ts 16 | end: EditorPosition 17 | ``` 18 | 19 | The end position of the triggering text. This is used to position the popover. 20 | 21 | ### query 22 | 23 | ```ts 24 | query: string 25 | ``` 26 | 27 | They query string (usually the text between start and end) that will be used to generate the suggestion content. 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EditorTransaction.md: -------------------------------------------------------------------------------- 1 | # EditorTransaction 2 | 3 | ## Properties 4 | 5 | ### replaceSelection 6 | 7 | ```ts 8 | replaceSelection: string 9 | ``` 10 | 11 | ### changes 12 | 13 | ```ts 14 | changes: EditorChange[] 15 | ``` 16 | 17 | ### selections 18 | 19 | ```ts 20 | selections: EditorRangeOrCaret[] 21 | ``` 22 | 23 | Multiple selections, overrides `selection`. 24 | 25 | ### selection 26 | 27 | ```ts 28 | selection: EditorRangeOrCaret 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Element.md: -------------------------------------------------------------------------------- 1 | # Element 2 | 3 | Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. 4 | 5 | ## Methods 6 | 7 | ### find 8 | 9 | ```ts 10 | find: (selector: string) => Element 11 | ``` 12 | 13 | ### findAll 14 | 15 | ```ts 16 | findAll: (selector: string) => HTMLElement[] 17 | ``` 18 | 19 | ### findAllSelf 20 | 21 | ```ts 22 | findAllSelf: (selector: string) => HTMLElement[] 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EmbedCache.md: -------------------------------------------------------------------------------- 1 | # EmbedCache 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EventListenerInfo.md: -------------------------------------------------------------------------------- 1 | # EventListenerInfo 2 | 3 | ## Properties 4 | 5 | ### selector 6 | 7 | ```ts 8 | selector: string 9 | ``` 10 | 11 | ### listener 12 | 13 | ```ts 14 | listener: Function 15 | ``` 16 | 17 | ### options 18 | 19 | ```ts 20 | options: boolean | AddEventListenerOptions 21 | ``` 22 | 23 | ### callback 24 | 25 | ```ts 26 | callback: Function 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/EventRef.md: -------------------------------------------------------------------------------- 1 | # EventRef 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/FileStats.md: -------------------------------------------------------------------------------- 1 | # FileStats 2 | 3 | ## Properties 4 | 5 | ### ctime 6 | 7 | ```ts 8 | ctime: number 9 | ``` 10 | 11 | ### mtime 12 | 13 | ```ts 14 | mtime: number 15 | ``` 16 | 17 | ### size 18 | 19 | ```ts 20 | size: number 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/FrontMatterCache.md: -------------------------------------------------------------------------------- 1 | # FrontMatterCache 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/FuzzyMatch.md: -------------------------------------------------------------------------------- 1 | # FuzzyMatch 2 | 3 | ## Properties 4 | 5 | ### item 6 | 7 | ```ts 8 | item: T 9 | ``` 10 | 11 | ### match 12 | 13 | ```ts 14 | match: SearchResult 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HSL.md: -------------------------------------------------------------------------------- 1 | # HSL 2 | 3 | ## Properties 4 | 5 | ### h 6 | 7 | ```ts 8 | h: number 9 | ``` 10 | 11 | Hue integer value between 0 and 360 12 | 13 | ### s 14 | 15 | ```ts 16 | s: number 17 | ``` 18 | 19 | Saturation integer value between 0 and 100 20 | 21 | ### l 22 | 23 | ```ts 24 | l: number 25 | ``` 26 | 27 | Lightness integer value between 0 and 100 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HTMLElement.md: -------------------------------------------------------------------------------- 1 | # HTMLElement 2 | 3 | Any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. 4 | 5 | ## Properties 6 | 7 | ### _EVENTS 8 | 9 | ```ts 10 | _EVENTS: { fullscreenchange?: EventListenerInfo[]; fullscreenerror?: EventListenerInfo[]; abort?: EventListenerInfo[]; animationcancel?: EventListenerInfo[]; ... 87 more ...; paste?: EventListenerInfo[]; } 11 | ``` 12 | 13 | ## Methods 14 | 15 | ### on 16 | 17 | ```ts 18 | on: (this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]... 19 | ``` 20 | 21 | ### off 22 | 23 | ```ts 24 | off: (this: HTMLElement, type: K, selector: string, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]... 25 | ``` 26 | 27 | ### onClickEvent 28 | 29 | ```ts 30 | onClickEvent: (this: HTMLElement, listener: (this: HTMLElement, ev: MouseEvent) => any, options?: boolean | AddEventListenerOptions) => void 31 | ``` 32 | 33 | ### onNodeInserted 34 | 35 | ```ts 36 | onNodeInserted: (this: HTMLElement, listener: () => any, once?: boolean) => () => void 37 | ``` 38 | 39 | ### onWindowMigrated 40 | 41 | ```ts 42 | onWindowMigrated: (this: HTMLElement, listener: (win: Window) => any) => () => void 43 | ``` 44 | 45 | ### trigger 46 | 47 | ```ts 48 | trigger: (eventType: string) => void 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HeadingCache.md: -------------------------------------------------------------------------------- 1 | # HeadingCache 2 | 3 | ## Properties 4 | 5 | ### heading 6 | 7 | ```ts 8 | heading: string 9 | ``` 10 | 11 | ### level 12 | 13 | ```ts 14 | level: number 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HeadingSubpathResult.md: -------------------------------------------------------------------------------- 1 | # HeadingSubpathResult 2 | 3 | ## Properties 4 | 5 | ### type 6 | 7 | ```ts 8 | type: "heading" 9 | ``` 10 | 11 | ### current 12 | 13 | ```ts 14 | current: HeadingCache 15 | ``` 16 | 17 | ### next 18 | 19 | ```ts 20 | next: HeadingCache 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Hotkey.md: -------------------------------------------------------------------------------- 1 | # Hotkey 2 | 3 | ## Properties 4 | 5 | ### modifiers 6 | 7 | ```ts 8 | modifiers: Modifier[] 9 | ``` 10 | 11 | ### key 12 | 13 | ```ts 14 | key: string 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HoverLinkSource.md: -------------------------------------------------------------------------------- 1 | # HoverLinkSource 2 | 3 | ## Properties 4 | 5 | ### display 6 | 7 | ```ts 8 | display: string 9 | ``` 10 | 11 | The string that will be displayed in the 'Page preview' plugin settings. It should match your plugin's display name. 12 | 13 | ### defaultMod 14 | 15 | ```ts 16 | defaultMod: boolean 17 | ``` 18 | 19 | Whether or not the `hover-link` event requires the 'Mod' key to be pressed to trigger. 20 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/HoverParent.md: -------------------------------------------------------------------------------- 1 | # HoverParent 2 | 3 | ## Properties 4 | 5 | ### hoverPopover 6 | 7 | ```ts 8 | hoverPopover: HoverPopover 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ISuggestOwner.md: -------------------------------------------------------------------------------- 1 | # ISuggestOwner 2 | 3 | ## Methods 4 | 5 | ### renderSuggestion 6 | 7 | ```ts 8 | renderSuggestion: (value: T, el: HTMLElement) => void 9 | ``` 10 | 11 | Render the suggestion item into DOM. 12 | 13 | ### selectSuggestion 14 | 15 | ```ts 16 | selectSuggestion: (value: T, evt: MouseEvent | KeyboardEvent) => void 17 | ``` 18 | 19 | Called when the user makes a selection. 20 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Instruction.md: -------------------------------------------------------------------------------- 1 | # Instruction 2 | 3 | ## Properties 4 | 5 | ### command 6 | 7 | ```ts 8 | command: string 9 | ``` 10 | 11 | ### purpose 12 | 13 | ```ts 14 | purpose: string 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/KeymapContext.md: -------------------------------------------------------------------------------- 1 | # KeymapContext 2 | 3 | ## Properties 4 | 5 | ### vkey 6 | 7 | ```ts 8 | vkey: string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/KeymapEventHandler.md: -------------------------------------------------------------------------------- 1 | # KeymapEventHandler 2 | 3 | ## Properties 4 | 5 | ### scope 6 | 7 | ```ts 8 | scope: Scope 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/KeymapInfo.md: -------------------------------------------------------------------------------- 1 | # KeymapInfo 2 | 3 | ## Properties 4 | 5 | ### modifiers 6 | 7 | ```ts 8 | modifiers: string 9 | ``` 10 | 11 | ### key 12 | 13 | ```ts 14 | key: string 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/LinkCache.md: -------------------------------------------------------------------------------- 1 | # LinkCache 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ListItemCache.md: -------------------------------------------------------------------------------- 1 | # ListItemCache 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | ```ts 8 | id: string 9 | ``` 10 | 11 | The block ID of this list item, if defined. 12 | 13 | ### task 14 | 15 | ```ts 16 | task: string 17 | ``` 18 | 19 | A single character indicating the checked status of a task. 20 | The space character `' '` is interpreted as an incomplete task. 21 | An other character is interpreted as completed task. 22 | `undefined` if this item isn't a task. 23 | 24 | ### parent 25 | 26 | ```ts 27 | parent: number 28 | ``` 29 | 30 | Line number of the parent list item (position.start.line). 31 | If this item has no parent (e.g. it's a root level list), 32 | then this value is the negative of the line number of the first list item (start of the list). 33 | 34 | Can be used to deduce which list items belongs to the same group (item1.parent === item2.parent). 35 | Can be used to reconstruct hierarchy information (parentItem.position.start.line === childItem.parent). 36 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ListedFiles.md: -------------------------------------------------------------------------------- 1 | # ListedFiles 2 | 3 | ## Properties 4 | 5 | ### files 6 | 7 | ```ts 8 | files: string[] 9 | ``` 10 | 11 | ### folders 12 | 13 | ```ts 14 | folders: string[] 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/LivePreviewState.md: -------------------------------------------------------------------------------- 1 | # LivePreviewState 2 | 3 | ## Properties 4 | 5 | ### mousedown 6 | 7 | ```ts 8 | mousedown: boolean 9 | ``` 10 | 11 | True if the left mouse is currently held down in the editor 12 | (for example, when drag-to-select text). 13 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Loc.md: -------------------------------------------------------------------------------- 1 | # Loc 2 | 3 | ## Properties 4 | 5 | ### line 6 | 7 | ```ts 8 | line: number 9 | ``` 10 | 11 | ### col 12 | 13 | ```ts 14 | col: number 15 | ``` 16 | 17 | ### offset 18 | 19 | ```ts 20 | offset: number 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownFileInfo.md: -------------------------------------------------------------------------------- 1 | # MarkdownFileInfo 2 | 3 | ## Properties 4 | 5 | ### app 6 | 7 | ```ts 8 | app: App 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownPostProcessor.md: -------------------------------------------------------------------------------- 1 | # MarkdownPostProcessor 2 | 3 | A post processor receives an element which is a section of the preview. 4 | 5 | Post processors can mutate the DOM to render various things, such as mermaid graphs, latex equations, or custom controls. 6 | 7 | If your post processor requires lifecycle management, for example, to clear an interval, kill a subprocess, etc when this element is 8 | removed from the app, look into {@link MarkdownPostProcessorContext#addChild} 9 | 10 | ## Properties 11 | 12 | ### sortOrder 13 | 14 | ```ts 15 | sortOrder: number 16 | ``` 17 | 18 | An optional integer sort order. Defaults to 0. Lower number runs before higher numbers. 19 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownPostProcessorContext.md: -------------------------------------------------------------------------------- 1 | # MarkdownPostProcessorContext 2 | 3 | ## Properties 4 | 5 | ### docId 6 | 7 | ```ts 8 | docId: string 9 | ``` 10 | 11 | ### sourcePath 12 | 13 | ```ts 14 | sourcePath: string 15 | ``` 16 | 17 | ### frontmatter 18 | 19 | ```ts 20 | frontmatter: any 21 | ``` 22 | 23 | ## Methods 24 | 25 | ### addChild 26 | 27 | ```ts 28 | addChild: (child: MarkdownRenderChild) => void 29 | ``` 30 | 31 | Adds a child component that will have its lifecycle managed by the renderer. 32 | 33 | Use this to add a dependent child to the renderer such that if the containerEl 34 | of the child is ever removed, the component's unload will be called. 35 | 36 | ### getSectionInfo 37 | 38 | ```ts 39 | getSectionInfo: (el: HTMLElement) => MarkdownSectionInformation 40 | ``` 41 | 42 | Gets the section information of this element at this point in time. 43 | Only call this function right before you need this information to get the most up-to-date version. 44 | This function may also return null in many circumstances; if you use it, you must be prepared to deal with nulls. 45 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownPreviewEvents.md: -------------------------------------------------------------------------------- 1 | # MarkdownPreviewEvents 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownSectionInformation.md: -------------------------------------------------------------------------------- 1 | # MarkdownSectionInformation 2 | 3 | ## Properties 4 | 5 | ### text 6 | 7 | ```ts 8 | text: string 9 | ``` 10 | 11 | ### lineStart 12 | 13 | ```ts 14 | lineStart: number 15 | ``` 16 | 17 | ### lineEnd 18 | 19 | ```ts 20 | lineEnd: number 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MarkdownSubView.md: -------------------------------------------------------------------------------- 1 | # MarkdownSubView 2 | 3 | ## Methods 4 | 5 | ### getScroll 6 | 7 | ```ts 8 | getScroll: () => number 9 | ``` 10 | 11 | ### applyScroll 12 | 13 | ```ts 14 | applyScroll: (scroll: number) => void 15 | ``` 16 | 17 | ### get 18 | 19 | ```ts 20 | get: () => string 21 | ``` 22 | 23 | ### set 24 | 25 | ```ts 26 | set: (data: string, clear: boolean) => void 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Math.md: -------------------------------------------------------------------------------- 1 | # Math 2 | 3 | An intrinsic object that provides basic mathematics functionality and constants. 4 | 5 | ## Methods 6 | 7 | ### clamp 8 | 9 | ```ts 10 | clamp: (value: number, min: number, max: number) => number 11 | ``` 12 | 13 | ### square 14 | 15 | ```ts 16 | square: (value: number) => number 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/MenuPositionDef.md: -------------------------------------------------------------------------------- 1 | # MenuPositionDef 2 | 3 | ## Properties 4 | 5 | ### x 6 | 7 | ```ts 8 | x: number 9 | ``` 10 | 11 | ### y 12 | 13 | ```ts 14 | y: number 15 | ``` 16 | 17 | ### width 18 | 19 | ```ts 20 | width: number 21 | ``` 22 | 23 | ### overlap 24 | 25 | ```ts 26 | overlap: boolean 27 | ``` 28 | 29 | ### left 30 | 31 | ```ts 32 | left: boolean 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Node.md: -------------------------------------------------------------------------------- 1 | # Node 2 | 3 | Node is an interface from which a number of DOM API object types inherit. It allows those types to be treated similarly; for example, inheriting the same set of methods, or being tested in the same way. 4 | 5 | ## Methods 6 | 7 | ### createEl 8 | 9 | ```ts 10 | createEl: (tag: K, o?: string | DomElementInfo, callback?: (el: HTMLElementTagNameMap[K]) => void) => HTM... 11 | ``` 12 | 13 | Create an element and append it to this node. 14 | 15 | ### createDiv 16 | 17 | ```ts 18 | createDiv: (o?: string | DomElementInfo, callback?: (el: HTMLDivElement) => void) => HTMLDivElement 19 | ``` 20 | 21 | ### createSpan 22 | 23 | ```ts 24 | createSpan: (o?: string | DomElementInfo, callback?: (el: HTMLSpanElement) => void) => HTMLSpanElement 25 | ``` 26 | 27 | ### createSvg 28 | 29 | ```ts 30 | createSvg: (tag: K, o?: string | SvgElementInfo, callback?: (el: SVGElementTagNameMap[K]) => void) ... 31 | ``` 32 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/NumberConstructor.md: -------------------------------------------------------------------------------- 1 | # NumberConstructor 2 | 3 | ## Methods 4 | 5 | ### isNumber 6 | 7 | ```ts 8 | isNumber: (obj: any) => obj is number 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ObjectConstructor.md: -------------------------------------------------------------------------------- 1 | # ObjectConstructor 2 | 3 | ## Methods 4 | 5 | ### isEmpty 6 | 7 | ```ts 8 | isEmpty: (object: Record) => boolean 9 | ``` 10 | 11 | ### each 12 | 13 | ```ts 14 | each: (object: { [key: string]: T; }, callback: (value: T, key?: string) => boolean | void, context?: any) => boolean 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ObsidianProtocolData.md: -------------------------------------------------------------------------------- 1 | # ObsidianProtocolData 2 | 3 | ## Properties 4 | 5 | ### action 6 | 7 | ```ts 8 | action: string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/OpenViewState.md: -------------------------------------------------------------------------------- 1 | # OpenViewState 2 | 3 | ## Properties 4 | 5 | ### state 6 | 7 | ```ts 8 | state: any 9 | ``` 10 | 11 | ### eState 12 | 13 | ```ts 14 | eState: any 15 | ``` 16 | 17 | ### active 18 | 19 | ```ts 20 | active: boolean 21 | ``` 22 | 23 | ### group 24 | 25 | ```ts 26 | group: WorkspaceLeaf 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/PluginManifest.md: -------------------------------------------------------------------------------- 1 | # PluginManifest 2 | 3 | ## Properties 4 | 5 | ### dir 6 | 7 | ```ts 8 | dir: string 9 | ``` 10 | 11 | ### id 12 | 13 | ```ts 14 | id: string 15 | ``` 16 | 17 | ### name 18 | 19 | ```ts 20 | name: string 21 | ``` 22 | 23 | ### author 24 | 25 | ```ts 26 | author: string 27 | ``` 28 | 29 | ### version 30 | 31 | ```ts 32 | version: string 33 | ``` 34 | 35 | ### minAppVersion 36 | 37 | ```ts 38 | minAppVersion: string 39 | ``` 40 | 41 | ### description 42 | 43 | ```ts 44 | description: string 45 | ``` 46 | 47 | ### authorUrl 48 | 49 | ```ts 50 | authorUrl: string 51 | ``` 52 | 53 | ### isDesktopOnly 54 | 55 | ```ts 56 | isDesktopOnly: boolean 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Point.md: -------------------------------------------------------------------------------- 1 | # Point 2 | 3 | ## Properties 4 | 5 | ### x 6 | 7 | ```ts 8 | x: number 9 | ``` 10 | 11 | ### y 12 | 13 | ```ts 14 | y: number 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Pos.md: -------------------------------------------------------------------------------- 1 | # Pos 2 | 3 | ## Properties 4 | 5 | ### start 6 | 7 | ```ts 8 | start: Loc 9 | ``` 10 | 11 | ### end 12 | 13 | ```ts 14 | end: Loc 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/PreparedQuery.md: -------------------------------------------------------------------------------- 1 | # PreparedQuery 2 | 3 | ## Properties 4 | 5 | ### query 6 | 7 | ```ts 8 | query: string 9 | ``` 10 | 11 | ### tokens 12 | 13 | ```ts 14 | tokens: string[] 15 | ``` 16 | 17 | ### fuzzy 18 | 19 | ```ts 20 | fuzzy: string[] 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/RGB.md: -------------------------------------------------------------------------------- 1 | # RGB 2 | 3 | ## Properties 4 | 5 | ### r 6 | 7 | ```ts 8 | r: number 9 | ``` 10 | 11 | Red integer value between 0 and 255 12 | 13 | ### g 14 | 15 | ```ts 16 | g: number 17 | ``` 18 | 19 | Green integer value between 0 and 255 20 | 21 | ### b 22 | 23 | ```ts 24 | b: number 25 | ``` 26 | 27 | Blue integer value between 0 and 255 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Rect_2.md: -------------------------------------------------------------------------------- 1 | # Rect_2 2 | 3 | ## Properties 4 | 5 | ### x 6 | 7 | ```ts 8 | x: number 9 | ``` 10 | 11 | ### y 12 | 13 | ```ts 14 | y: number 15 | ``` 16 | 17 | ### width 18 | 19 | ```ts 20 | width: number 21 | ``` 22 | 23 | ### height 24 | 25 | ```ts 26 | height: number 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ReferenceCache.md: -------------------------------------------------------------------------------- 1 | # ReferenceCache 2 | 3 | ## Properties 4 | 5 | ### link 6 | 7 | ```ts 8 | link: string 9 | ``` 10 | 11 | ### original 12 | 13 | ```ts 14 | original: string 15 | ``` 16 | 17 | ### displayText 18 | 19 | ```ts 20 | displayText: string 21 | ``` 22 | 23 | if title is different than link text, in the case of [[page name|display name]] 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/RequestParam.md: -------------------------------------------------------------------------------- 1 | # RequestParam 2 | 3 | ## Properties 4 | 5 | ### url 6 | 7 | ```ts 8 | url: string 9 | ``` 10 | 11 | ### method 12 | 13 | ```ts 14 | method: string 15 | ``` 16 | 17 | ### contentType 18 | 19 | ```ts 20 | contentType: string 21 | ``` 22 | 23 | ### body 24 | 25 | ```ts 26 | body: string 27 | ``` 28 | 29 | ### headers 30 | 31 | ```ts 32 | headers: Record 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/RequestUrlParam.md: -------------------------------------------------------------------------------- 1 | # RequestUrlParam 2 | 3 | ## Properties 4 | 5 | ### url 6 | 7 | ```ts 8 | url: string 9 | ``` 10 | 11 | ### method 12 | 13 | ```ts 14 | method: string 15 | ``` 16 | 17 | ### contentType 18 | 19 | ```ts 20 | contentType: string 21 | ``` 22 | 23 | ### body 24 | 25 | ```ts 26 | body: string | ArrayBuffer 27 | ``` 28 | 29 | ### headers 30 | 31 | ```ts 32 | headers: Record 33 | ``` 34 | 35 | ### throw 36 | 37 | ```ts 38 | throw: boolean 39 | ``` 40 | 41 | Whether to throw an error when the status code is >= 400 42 | Defaults to true 43 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/RequestUrlResponse.md: -------------------------------------------------------------------------------- 1 | # RequestUrlResponse 2 | 3 | ## Properties 4 | 5 | ### status 6 | 7 | ```ts 8 | status: number 9 | ``` 10 | 11 | ### headers 12 | 13 | ```ts 14 | headers: Record 15 | ``` 16 | 17 | ### arrayBuffer 18 | 19 | ```ts 20 | arrayBuffer: ArrayBuffer 21 | ``` 22 | 23 | ### json 24 | 25 | ```ts 26 | json: any 27 | ``` 28 | 29 | ### text 30 | 31 | ```ts 32 | text: string 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/RequestUrlResponsePromise.md: -------------------------------------------------------------------------------- 1 | # RequestUrlResponsePromise 2 | 3 | ## Properties 4 | 5 | ### arrayBuffer 6 | 7 | ```ts 8 | arrayBuffer: Promise 9 | ``` 10 | 11 | ### json 12 | 13 | ```ts 14 | json: Promise 15 | ``` 16 | 17 | ### text 18 | 19 | ```ts 20 | text: Promise 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/SearchResult.md: -------------------------------------------------------------------------------- 1 | # SearchResult 2 | 3 | ## Properties 4 | 5 | ### score 6 | 7 | ```ts 8 | score: number 9 | ``` 10 | 11 | ### matches 12 | 13 | ```ts 14 | matches: SearchMatches 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/SearchResultContainer.md: -------------------------------------------------------------------------------- 1 | # SearchResultContainer 2 | 3 | ## Properties 4 | 5 | ### match 6 | 7 | ```ts 8 | match: SearchResult 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/SectionCache.md: -------------------------------------------------------------------------------- 1 | # SectionCache 2 | 3 | ## Properties 4 | 5 | ### id 6 | 7 | ```ts 8 | id: string 9 | ``` 10 | 11 | The block ID of this section, if defined. 12 | 13 | ### type 14 | 15 | ```ts 16 | type: string 17 | ``` 18 | 19 | The type string generated by the parser. 20 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Stat.md: -------------------------------------------------------------------------------- 1 | # Stat 2 | 3 | ## Properties 4 | 5 | ### type 6 | 7 | ```ts 8 | type: "file" | "folder" 9 | ``` 10 | 11 | ### ctime 12 | 13 | ```ts 14 | ctime: number 15 | ``` 16 | 17 | ### mtime 18 | 19 | ```ts 20 | mtime: number 21 | ``` 22 | 23 | ### size 24 | 25 | ```ts 26 | size: number 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/String.md: -------------------------------------------------------------------------------- 1 | # String 2 | 3 | Allows manipulation and formatting of text strings and determination and location of substrings within strings. 4 | 5 | ## Methods 6 | 7 | ### contains 8 | 9 | ```ts 10 | contains: (target: string) => boolean 11 | ``` 12 | 13 | ### startsWith 14 | 15 | ```ts 16 | startsWith: { (searchString: string, position?: number): boolean; (searchString: string, position?: number): boolean; } 17 | ``` 18 | 19 | Returns true if the sequence of elements of searchString converted to a String is the 20 | same as the corresponding elements of this object (converted to a String) starting at 21 | position. Otherwise returns false. 22 | 23 | ### endsWith 24 | 25 | ```ts 26 | endsWith: { (searchString: string, endPosition?: number): boolean; (target: string, length?: number): boolean; } 27 | ``` 28 | 29 | Returns true if the sequence of elements of searchString converted to a String is the 30 | same as the corresponding elements of this object (converted to a String) starting at 31 | endPosition – length(this). Otherwise returns false. 32 | 33 | ### format 34 | 35 | ```ts 36 | format: (...args: string[]) => string 37 | ``` 38 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/StringConstructor.md: -------------------------------------------------------------------------------- 1 | # StringConstructor 2 | 3 | ## Methods 4 | 5 | ### isString 6 | 7 | ```ts 8 | isString: (obj: any) => obj is string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/SubpathResult.md: -------------------------------------------------------------------------------- 1 | # SubpathResult 2 | 3 | ## Properties 4 | 5 | ### start 6 | 7 | ```ts 8 | start: Loc 9 | ``` 10 | 11 | ### end 12 | 13 | ```ts 14 | end: Loc 15 | ``` 16 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/SvgElementInfo.md: -------------------------------------------------------------------------------- 1 | # SvgElementInfo 2 | 3 | ## Properties 4 | 5 | ### cls 6 | 7 | ```ts 8 | cls: string | string[] 9 | ``` 10 | 11 | The class to be assigned. Can be a space-separated string or an array of strings. 12 | 13 | ### attr 14 | 15 | ```ts 16 | attr: { [key: string]: string | number | boolean; } 17 | ``` 18 | 19 | HTML attributes to be added. 20 | 21 | ### parent 22 | 23 | ```ts 24 | parent: Node 25 | ``` 26 | 27 | The parent element to be assigned to. 28 | 29 | ### prepend 30 | 31 | ```ts 32 | prepend: boolean 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/TagCache.md: -------------------------------------------------------------------------------- 1 | # TagCache 2 | 3 | ## Properties 4 | 5 | ### tag 6 | 7 | ```ts 8 | tag: string 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/TooltipOptions.md: -------------------------------------------------------------------------------- 1 | # TooltipOptions 2 | 3 | ## Properties 4 | 5 | ### placement 6 | 7 | ```ts 8 | placement: TooltipPlacement 9 | ``` 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Touch.md: -------------------------------------------------------------------------------- 1 | # Touch 2 | 3 | A single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. 4 | 5 | ## Properties 6 | 7 | ### touchType 8 | 9 | ```ts 10 | touchType: TouchType 11 | ``` 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/UIEvent.md: -------------------------------------------------------------------------------- 1 | # UIEvent 2 | 3 | Simple user interface events. 4 | 5 | ## Properties 6 | 7 | ### targetNode 8 | 9 | ```ts 10 | targetNode: Node 11 | ``` 12 | 13 | ### win 14 | 15 | ```ts 16 | win: Window 17 | ``` 18 | 19 | ### doc 20 | 21 | ```ts 22 | doc: Document 23 | ``` 24 | 25 | ## Methods 26 | 27 | ### instanceOf 28 | 29 | ```ts 30 | instanceOf: (type: new (...data: any[]) => T) => this is T 31 | ``` 32 | 33 | Cross-window capable instanceof check, a drop-in replacement 34 | for instanceof checks on UIEvents. 35 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ViewState.md: -------------------------------------------------------------------------------- 1 | # ViewState 2 | 3 | ## Properties 4 | 5 | ### type 6 | 7 | ```ts 8 | type: string 9 | ``` 10 | 11 | ### state 12 | 13 | ```ts 14 | state: any 15 | ``` 16 | 17 | ### active 18 | 19 | ```ts 20 | active: boolean 21 | ``` 22 | 23 | ### pinned 24 | 25 | ```ts 26 | pinned: boolean 27 | ``` 28 | 29 | ### group 30 | 31 | ```ts 32 | group: WorkspaceLeaf 33 | ``` 34 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/ViewStateResult.md: -------------------------------------------------------------------------------- 1 | # ViewStateResult 2 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/Window.md: -------------------------------------------------------------------------------- 1 | # Window 2 | 3 | A window containing a DOM document; the document property points to the DOM document loaded in that window. 4 | 5 | ## Properties 6 | 7 | ### activeWindow 8 | 9 | ```ts 10 | activeWindow: Window 11 | ``` 12 | 13 | The actively focused Window object. This is usually the same as `window` but 14 | it will be different when using popout windows. 15 | 16 | ### activeDocument 17 | 18 | ```ts 19 | activeDocument: Document 20 | ``` 21 | 22 | The actively focused Document object. This is usually the same as `document` but 23 | it will be different when using popout windows. 24 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/WorkspaceWindowInitData.md: -------------------------------------------------------------------------------- 1 | # WorkspaceWindowInitData 2 | 3 | ## Properties 4 | 5 | ### size 6 | 7 | ```ts 8 | size: { width: number; height: number; } 9 | ``` 10 | 11 | The suggested size 12 | -------------------------------------------------------------------------------- /docs/reference/typescript/interfaces/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Interfaces" 3 | } 4 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/Constructor.md: -------------------------------------------------------------------------------- 1 | # Constructor 2 | 3 | ```ts 4 | export type Constructor = abstract; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/EditorCommandName.md: -------------------------------------------------------------------------------- 1 | # EditorCommandName 2 | 3 | ```ts 4 | export type EditorCommandName = 'goUp' | 'goDown' | 'goLeft' | 'goRight' | 'goStart' | 'goEnd' | 'goWordLeft' | 'goWordRight' | 'indentMore' | 'indentLess' | 'newlineAndIndent' | 'swapLineUp' | 'swapLineDown' | 'deleteLine' | 'toggleFold' | 'foldAll' | 'unfoldAll'; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/HexString.md: -------------------------------------------------------------------------------- 1 | # HexString 2 | 3 | ```ts 4 | export type HexString = string; 5 | ``` 6 | 7 | Hex strings are 6-digit hash-prefixed rgb strings in lowercase form. 8 | Example: #ffffff 9 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/IconName.md: -------------------------------------------------------------------------------- 1 | # IconName 2 | 3 | ```ts 4 | type IconName = string; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/KeymapEventListener.md: -------------------------------------------------------------------------------- 1 | # KeymapEventListener 2 | 3 | ```ts 4 | export type KeymapEventListener = (evt: KeyboardEvent, ctx: KeymapContext) => false | any; 5 | ``` 6 | 7 | Return `false` to automatically preventDefault 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/MarkdownViewModeType.md: -------------------------------------------------------------------------------- 1 | # MarkdownViewModeType 2 | 3 | ```ts 4 | export type MarkdownViewModeType = 'source' | 'preview'; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/Modifier.md: -------------------------------------------------------------------------------- 1 | # Modifier 2 | 3 | ```ts 4 | export type Modifier = 'Mod' | 'Ctrl' | 'Meta' | 'Shift' | 'Alt'; 5 | ``` 6 | 7 | Mod = Cmd on MacOS and Ctrl on other OS 8 | Ctrl = Ctrl key for every OS 9 | Meta = Cmd on MacOS and Win key on other OS 10 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/ObsidianProtocolHandler.md: -------------------------------------------------------------------------------- 1 | # ObsidianProtocolHandler 2 | 3 | ```ts 4 | export type ObsidianProtocolHandler = (params: ObsidianProtocolData) => any; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/PaneType.md: -------------------------------------------------------------------------------- 1 | # PaneType 2 | 3 | ```ts 4 | export type PaneType = 'tab' | 'split' | 'window'; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/SearchMatchPart.md: -------------------------------------------------------------------------------- 1 | # SearchMatchPart 2 | 3 | ```ts 4 | export type SearchMatchPart = [ 5 | number, 6 | number 7 | ]; 8 | ``` 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/SearchMatches.md: -------------------------------------------------------------------------------- 1 | # SearchMatches 2 | 3 | ```ts 4 | export type SearchMatches = SearchMatchPart[]; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/SplitDirection.md: -------------------------------------------------------------------------------- 1 | # SplitDirection 2 | 3 | ```ts 4 | export type SplitDirection = 'vertical' | 'horizontal'; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/TooltipPlacement.md: -------------------------------------------------------------------------------- 1 | # TooltipPlacement 2 | 3 | ```ts 4 | export type TooltipPlacement = 'bottom' | 'right' | 'left' | 'top'; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/UserEvent.md: -------------------------------------------------------------------------------- 1 | # UserEvent 2 | 3 | ```ts 4 | export type UserEvent = MouseEvent | KeyboardEvent | TouchEvent | PointerEvent; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/ViewCreator.md: -------------------------------------------------------------------------------- 1 | # ViewCreator 2 | 3 | ```ts 4 | export type ViewCreator = (leaf: WorkspaceLeaf) => View; 5 | ``` 6 | 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/typescript/types/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Types" 3 | } 4 | -------------------------------------------------------------------------------- /docs/testing/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Testing", 3 | "position": 65 4 | } 5 | -------------------------------------------------------------------------------- /docs/testing/mobile-devices.md: -------------------------------------------------------------------------------- 1 | # Develop for mobile devices 2 | 3 | Learn how you can develop your plugin for mobile devices. 4 | 5 | ## Emulate mobile device on desktop 6 | 7 | You can emulate Obsidian running a mobile device directly from the Developer Tools. 8 | 9 | 1. Open the **Developer Tools**. 10 | 1. Select the **Console** tab. 11 | 1. Enter the following and then press `Enter`. 12 | 13 | ```ts 14 | this.app.emulateMobile(true); 15 | ``` 16 | 17 | To disable mobile emulation, enter the following and press `Enter`: 18 | 19 | ```ts 20 | this.app.emulateMobile(false); 21 | ``` 22 | 23 | :::tip 24 | 25 | To instead toggle mobile emulation back and forth, you can use the `this.app.isMobile` flag: 26 | 27 | ```ts 28 | this.app.emulateMobile(!this.app.isMobile); 29 | ``` 30 | 31 | ::: 32 | 33 | ## Platform-specific features 34 | 35 | To detect the platform your plugin is running on, you can use `Platform`: 36 | 37 | ```ts 38 | import { Platform } from "obsidian"; 39 | 40 | if (Platform.isIosApp) { 41 | // ... 42 | } 43 | 44 | if (Platform.isAndroidApp) { 45 | // ... 46 | } 47 | ``` 48 | 49 | ## Disable your plugin on mobile devices 50 | 51 | If your plugin requires the Node.js or Electron API, you can prevent users from installing the plugin on mobile devices. 52 | 53 | To only support the desktop app, set `isDesktopOnly` to `true` in the [manifest.json](../reference/manifest.md). 54 | 55 | ## Troubleshooting 56 | 57 | This section lists common issues when developing for mobile devices. 58 | 59 | ### Node and Electron APIs 60 | 61 | The Node.js API and the Electron API aren't available on mobile devices. Any calls to these libraries result cause your plugin to crash. 62 | 63 | ### Lookbehind in regular expressions 64 | 65 | Lookbehind in regular expressions is currently not supported on iOS. To implement a fallback for iOS users, refer to [Platform-specific features](#platform-specific-features). 66 | 67 | Refer to [Can I Use](https://caniuse.com/js-regexp-lookbehind) for an up-to-date status. Look for "Safari on iOS". 68 | -------------------------------------------------------------------------------- /docs/tutorials/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Tutorials", 3 | "position": 90 4 | } 5 | -------------------------------------------------------------------------------- /docs/user-interface/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "User interface", 3 | "position": 20 4 | } 5 | -------------------------------------------------------------------------------- /docs/user-interface/context-menus.md: -------------------------------------------------------------------------------- 1 | # Context menus 2 | 3 | If you want to open up a context menu, use [`Menu`](../reference/typescript/classes/Menu.md): 4 | 5 | ```ts 6 | import { Menu, Notice, Plugin } from "obsidian"; 7 | 8 | export default class ExamplePlugin extends Plugin { 9 | async onload() { 10 | this.addRibbonIcon("dice", "Open menu", (event) => { 11 | // highlight-start 12 | const menu = new Menu(this.app); 13 | 14 | menu.addItem((item) => 15 | item 16 | .setTitle("Copy") 17 | .setIcon("documents") 18 | .onClick(() => { 19 | new Notice("Copied"); 20 | }) 21 | ); 22 | 23 | menu.addItem((item) => 24 | item 25 | .setTitle("Paste") 26 | .setIcon("paste") 27 | .onClick(() => { 28 | new Notice("Pasted"); 29 | }) 30 | ); 31 | 32 | menu.showAtMouseEvent(event); 33 | // highlight-end 34 | }); 35 | } 36 | } 37 | ``` 38 | 39 | [`showAtMouseEvent()`](../reference/typescript/classes/Menu.md#showatmouseevent) opens the menu where you clicked with the mouse. 40 | 41 | :::tip 42 | If you need more control of where the menu appears, you can use `menu.showAtPosition({ x: 20, y: 20 })` to open the menu at a position relative to the top-left corner of the Obsidian window. 43 | ::: 44 | 45 | For more information on what icons you can use, refer to [Icons](icons.md). 46 | 47 | You can also add an item to the file menu, or the editor menu, by subscribing to the `file-menu` and `editor-menu` workspace events: 48 | 49 | ![Context menu positions](../../static/img/context-menu-positions.png) 50 | 51 | ```ts 52 | import { Notice, Plugin } from "obsidian"; 53 | 54 | export default class ExamplePlugin extends Plugin { 55 | async onload() { 56 | this.registerEvent( 57 | this.app.workspace.on("file-menu", (menu, file) => { 58 | menu.addItem((item) => { 59 | item 60 | .setTitle("Print file path 👈") 61 | .setIcon("document") 62 | .onClick(async () => { 63 | new Notice(file.path); 64 | }); 65 | }); 66 | }) 67 | ); 68 | 69 | this.registerEvent( 70 | this.app.workspace.on("editor-menu", (menu, editor, view) => { 71 | menu.addItem((item) => { 72 | item 73 | .setTitle("Print file path 👈") 74 | .setIcon("document") 75 | .onClick(async () => { 76 | new Notice(view.file.path); 77 | }); 78 | }); 79 | }) 80 | ); 81 | } 82 | } 83 | ``` 84 | 85 | For more information on handling events, refer to [Events](../events.md). 86 | -------------------------------------------------------------------------------- /docs/user-interface/html-elements.md: -------------------------------------------------------------------------------- 1 | # HTML elements 2 | 3 | Several components in the Obsidian API, such as the [settings tab](settings.md), expose _container elements_: 4 | 5 | ```ts 6 | import { App, PluginSettingTab } from "obsidian"; 7 | 8 | class ExampleSettingTab extends PluginSettingTab { 9 | plugin: ExamplePlugin; 10 | 11 | constructor(app: App, plugin: ExamplePlugin) { 12 | super(app, plugin); 13 | this.plugin = plugin; 14 | } 15 | 16 | display(): void { 17 | // highlight-next-line 18 | let { containerEl } = this; 19 | 20 | // ... 21 | } 22 | } 23 | ``` 24 | 25 | Container elements are `HTMLElement` objects that make it possible to create custom interfaces within Obsidian. 26 | 27 | ## Create HTML elements using `createEl()` 28 | 29 | Every `HTMLElement`, including the container element, exposes a `createEl()` method that creates an `HTMLElement` under the original element. 30 | 31 | For example, here's how you can add an `

` heading element inside the container element: 32 | 33 | ```ts 34 | containerEl.createEl("h1", { text: "Heading 1" }); 35 | ``` 36 | 37 | `createEl()` returns a reference to the new element: 38 | 39 | ```ts 40 | const book = containerEl.createEl("div"); 41 | book.createEl("div", { text: "How to Take Smart Notes" }); 42 | book.createEl("small", { text: "Sönke Ahrens" }); 43 | ``` 44 | 45 | ## Style your elements 46 | 47 | You can add custom CSS styles to your plugin by adding a `styles.css` file in the plugin root directory. To add some styles for the previous book example: 48 | 49 | ```css title="styles.css" 50 | .book { 51 | border: 1px solid var(--background-modifier-border); 52 | padding: 10px; 53 | } 54 | 55 | .book__title { 56 | font-weight: 600; 57 | } 58 | 59 | .book__author { 60 | color: var(--text-muted); 61 | } 62 | ``` 63 | 64 | :::tip 65 | `--background-modifier-border` and `--text-muted` are [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) that are defined and used by Obsidian itself. If you use these variables for your styles, your plugin will look great even if the user has a different theme! 🌈 66 | ::: 67 | 68 | To make the HTML elements use the styles, set the `cls` property for the HTML element: 69 | 70 | ```ts 71 | const book = containerEl.createEl("div", { cls: "book" }); 72 | book.createEl("div", { text: "How to Take Smart Notes", cls: "book__title" }); 73 | book.createEl("small", { text: "Sönke Ahrens", cls: "book__author" }); 74 | ``` 75 | 76 | Now it looks much better! 🎉 77 | 78 | ![Styled book item](../../static/img/styles.png) 79 | 80 | ### Conditional styles 81 | 82 | Use the `toggleClass` method if you want to change the style of an element based on the user's settings or other values: 83 | 84 | ```ts 85 | element.toggleClass("danger", status === "error"); 86 | ``` 87 | -------------------------------------------------------------------------------- /docs/user-interface/icons.md: -------------------------------------------------------------------------------- 1 | # Icons 2 | 3 | Several of the UI components in the Obsidian API lets you configure an accompanying icon. You can choose from one of the built-in icons, or you can add your own. 4 | 5 | ## Browse available icons 6 | 7 | Browse to [lucide.dev](https://lucide.dev/) to see all available icons and their corresponding names. 8 | 9 | ## Draw icons 10 | 11 | If you'd like to use icons in your custom interfaces, use the [`setIcon`](../reference/typescript/functions/setIcon.md) utility function to add an icon to an [HTML element](html-elements.md). The following example adds icon to the status bar: 12 | 13 | ```ts title="main.ts" 14 | import { Plugin, setIcon } from "obsidian"; 15 | 16 | export default class ExamplePlugin extends Plugin { 17 | async onload() { 18 | const item = this.addStatusBarItem(); 19 | setIcon(item, "info"); 20 | } 21 | } 22 | ``` 23 | 24 | To change the size of the icon, set the `--icon-size` CSS variable on the element containing the icon: 25 | 26 | ```css 27 | div { 28 | --icon-size: 18px; 29 | } 30 | ``` 31 | 32 | ## Add your own icon 33 | 34 | To add a custom icon for your plugin, use the [`addIcon`](../reference/typescript/functions/addIcon.md) utility: 35 | 36 | ```ts title="main.ts" 37 | import { addIcon, Plugin } from "obsidian"; 38 | 39 | export default class ExamplePlugin extends Plugin { 40 | async onload() { 41 | addIcon("circle", ``); 42 | 43 | this.addRibbonIcon("circle", "Click me", () => { 44 | console.log("Hello, you!"); 45 | }); 46 | } 47 | } 48 | ``` 49 | 50 | `addIcon` takes two arguments: 51 | 52 | 1. A name to uniquely identify your icon. 53 | 1. The SVG content for the icon, without the surrounding `` tag. 54 | 55 | Note that your icon needs to fit within a `0 0 100 100` view box to be drawn properly. 56 | 57 | After the call to `addIcon`, you can use the icon just like any of the built-in icons. 58 | -------------------------------------------------------------------------------- /docs/user-interface/index.md: -------------------------------------------------------------------------------- 1 | # User interface 2 | 3 | This page gives you an overview of how to add or change the Obsidian user interface. 4 | 5 | You can see some of the user interface components when you first open Obsidian. 6 | 7 | - [Ribbon actions](ribbon-actions.md) 8 | - [Views](views.md) 9 | - [Status bar](status-bar.md) 10 | 11 | To modify the editor, refer to [Editor](editor/index.md) and [Editor extensions](editor/extensions/index.md). 12 | 13 | ![User interface](user-interface.png) 14 | -------------------------------------------------------------------------------- /docs/user-interface/ribbon-actions.md: -------------------------------------------------------------------------------- 1 | # Ribbon actions 2 | 3 | The sidebar on the left side of the Obsidian interface is mainly known as the _ribbon_. In addition to system operations, such as opening the preferences or another vault, the ribbon can also host actions defined by plugins. 4 | 5 | To add an action to the ribbon, use the [`addRibbonIcon()`](../reference/typescript/classes/Plugin_2.md#addribbonicon) method: 6 | 7 | ```ts title="main.ts" 8 | import { Plugin } from "obsidian"; 9 | 10 | export default class ExamplePlugin extends Plugin { 11 | async onload() { 12 | // highlight-start 13 | this.addRibbonIcon("dice", "Print to console", () => { 14 | console.log("Hello, you!"); 15 | }); 16 | // highlight-end 17 | } 18 | } 19 | ``` 20 | 21 | The first argument specifies which icon to use. For more information on the available icons, and how to add your own, refer to [Icons](icons.md). 22 | -------------------------------------------------------------------------------- /docs/user-interface/status-bar.md: -------------------------------------------------------------------------------- 1 | # Status bar 2 | 3 | To create a new block in the status bar, call the [`addStatusBarItem()`](../reference/typescript/classes/Plugin_2.md#addstatusbaritem) in the `onload()` method. The `addStatusBarItem()` method returns an [HTML element](html-elements.md) that you can add your own elements to. 4 | 5 | :::caution Obsidian mobile 6 | Custom status bar items [is **not** supported](https://discord.com/channels/686053708261228577/707816848615407697/832321402106544179) on Obsidian mobile apps. 7 | ::: 8 | 9 | ```ts title="main.ts" 10 | import { Plugin } from "obsidian"; 11 | 12 | export default class ExamplePlugin extends Plugin { 13 | async onload() { 14 | const item = this.addStatusBarItem(); 15 | item.createEl("span", { text: "Hello from the status bar 👋" }); 16 | } 17 | } 18 | ``` 19 | 20 | :::note 21 | For more information on how to use the `createEl()` method, refer to [HTML elements](html-elements.md). 22 | ::: 23 | 24 | You can add multiple status bar items by calling `addStatusBarItem()` multiple times. Since Obsidian adds a gap between them, you need to create multiple HTML element on the same status bar item if you need more control of spacing. 25 | 26 | ```ts title="main.ts" 27 | import { Plugin } from "obsidian"; 28 | 29 | export default class ExamplePlugin extends Plugin { 30 | async onload() { 31 | const fruits = this.addStatusBarItem(); 32 | fruits.createEl("span", { text: "🍎" }); 33 | fruits.createEl("span", { text: "🍌" }); 34 | 35 | const veggies = this.addStatusBarItem(); 36 | veggies.createEl("span", { text: "🥦" }); 37 | veggies.createEl("span", { text: "🥬" }); 38 | } 39 | } 40 | ``` 41 | 42 | The example above results in the following status bar: 43 | 44 | ![Status bar](../../static/img/status-bar.png) 45 | -------------------------------------------------------------------------------- /docs/user-interface/user-interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/docs/user-interface/user-interface.png -------------------------------------------------------------------------------- /docs/vault.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 40 3 | --- 4 | 5 | # Vault 6 | 7 | From the official documentation on [Working with multiple Vaults](https://help.obsidian.md/How+to/Working+with+multiple+vaults): 8 | 9 | > Each collection of notes in Obsidian is known as a Vault. A Vault consists of a folder, and any sub-folders within it. 10 | 11 | While your plugin can access the file system like any other Node.js application, the [`Vault`](./reference/typescript/classes/Vault.md) module aims to make it easier to work with files and folders within a Vault. 12 | 13 | The following example recursively prints the paths of all Markdown files in a Vault: 14 | 15 | ```ts 16 | const files = this.app.vault.getMarkdownFiles() 17 | 18 | for (let i = 0; i < files.length; i++) { 19 | console.log(files[i].path); 20 | } 21 | ``` 22 | 23 | :::tip 24 | If you want to list _all_ files, and not just Markdown documents, use [`getFiles()`](./reference/typescript/classes/Vault.md#getfiles) instead. 25 | ::: 26 | 27 | ## Read files 28 | 29 | There are two methods for reading the content of a file: [`read()`](./reference/typescript/classes/Vault.md#read) and [`cachedRead()`](./reference/typescript/classes/Vault.md#cachedread). 30 | 31 | - If you only want to display the content to the user, then use `cachedRead()` to avoid reading the file from disk multiple times. 32 | - If you want to read the content, change it, and then write it back to disk, then use `read()` to avoid potentially overwriting the file with a stale copy. 33 | 34 | :::info 35 | The only difference between `cachedRead()` and `read()` is when the file was modified outside of Obsidian just before the plugin reads it. As soon as the file system notifies Obsidian that the file has changed from the outside, `cachedRead()` behaves _exactly_ like `read()`. Similarly, if you save the file within Obsidian, the read cache is flushed as well. 36 | ::: 37 | 38 | The following example reads the content of all Markdown files in the Vault and returns the average document size: 39 | 40 | ```ts title="main.ts" 41 | import { Notice, Plugin } from "obsidian"; 42 | 43 | export default class ExamplePlugin extends Plugin { 44 | async onload() { 45 | this.addRibbonIcon("info", "Calculate average file length", async () => { 46 | const fileLength = await this.averageFileLength(); 47 | new Notice(`The average file length is ${fileLength} characters.`); 48 | }); 49 | } 50 | 51 | async averageFileLength(): Promise { 52 | const { vault } = this.app; 53 | 54 | const fileContents: string[] = await Promise.all( 55 | vault.getMarkdownFiles().map((file) => vault.cachedRead(file)) 56 | ); 57 | 58 | let totalLength = 0; 59 | fileContents.forEach((content) => { 60 | totalLength += content.length; 61 | }); 62 | 63 | return totalLength / fileContents.length; 64 | } 65 | } 66 | ``` 67 | 68 | ## Delete files 69 | 70 | There are two methods to delete a file, [`delete()`](./reference/typescript/classes/Vault.md#delete), and [`trash()`](./reference/typescript/classes/Vault.md#trash). Which one you should use depends on if you want to allow the user to change their mind. 71 | 72 | - `delete()` removes the file without a trace. 73 | - `trash()` moves the file to the trash bin. 74 | 75 | When you use `trash()`, you have the option to move the file to the system's trash bin, or to a local `.trash` folder at the root of the user's Vault. 76 | 77 | ## Is it a file or folder? 78 | 79 | Some operations return or accept a [`TAbstractFile`](./reference/typescript/classes/TAbstractFile.md) object, which can be either a file or a folder. Always check the concrete type of a `TAbstractFile` before you use it. 80 | 81 | ```ts 82 | const folderOrFile = this.app.vault.getAbstractFileByPath("folderOrFile"); 83 | 84 | if (folderOrFile instanceof TFile) { 85 | console.log("It's a file!"); 86 | } else if (folderOrFile instanceof TFolder) { 87 | console.log("It's a folder!"); 88 | } 89 | ``` 90 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "obsidian-plugin-docs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids" 15 | }, 16 | "dependencies": { 17 | "@docusaurus/core": "^2.0.0-rc.1", 18 | "@docusaurus/plugin-client-redirects": "^2.0.0-rc.1", 19 | "@docusaurus/preset-classic": "^2.0.0-rc.1", 20 | "@docusaurus/remark-plugin-npm2yarn": "^2.0.0-rc.1", 21 | "@mdx-js/react": "^1.6.21", 22 | "@svgr/webpack": "^5.5.0", 23 | "clsx": "^1.1.1", 24 | "file-loader": "^6.2.0", 25 | "mdx-mermaid": "^1.1.0", 26 | "mermaid": "^8.13.2", 27 | "prism-react-renderer": "^1.2.1", 28 | "react": "^17.0.1", 29 | "react-dom": "^17.0.1", 30 | "sass": "^1.39.2", 31 | "url-loader": "^4.1.1" 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.5%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sidebars.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | docs: [ 3 | { 4 | type: "autogenerated", 5 | dirName: ".", 6 | }, 7 | ], 8 | }; 9 | -------------------------------------------------------------------------------- /src/css/custom.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --ifm-font-family-base: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", 3 | Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", 4 | "Segoe UI Symbol", "Microsoft YaHei Light", sans-serif; 5 | 6 | --ifm-color-primary: #7f6df2; 7 | --ifm-link-hover-color: #8875ff; 8 | 9 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); 10 | } 11 | 12 | body { 13 | text-rendering: optimizeLegibility; 14 | } 15 | 16 | html[data-theme="dark"] { 17 | --ifm-background-color: #161616; 18 | --ifm-navbar-background-color: #202020; 19 | --ifm-footer-background-color: #202020; 20 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); 21 | } 22 | -------------------------------------------------------------------------------- /src/manifest.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$id": "https://marcus.se.net/obsidian-plugin-docs/manifest", 3 | "$schema": "http://json-schema.org/draft-07/schema", 4 | "type": "object", 5 | "title": "Manifest", 6 | "description": "This page describe the schema for the plugin manifest, `manifest.json`.", 7 | "required": [ 8 | "id", 9 | "name", 10 | "author", 11 | "version", 12 | "minAppVersion", 13 | "description", 14 | "isDesktopOnly" 15 | ], 16 | "additionalProperties": false, 17 | "properties": { 18 | "id": { 19 | "type": "string", 20 | "description": "The ID of your plugin.", 21 | "pattern": "^[-0-9a-z]+$" 22 | }, 23 | "name": { 24 | "type": "string", 25 | "description": "The display name of your plugin." 26 | }, 27 | "author": { 28 | "type": "string", 29 | "description": "The plugin author's name." 30 | }, 31 | "version": { 32 | "type": "string", 33 | "description": "The version of your plugin." 34 | }, 35 | "minAppVersion": { 36 | "type": "string", 37 | "description": "The minimum required Obsidian version for your plugin." 38 | }, 39 | "description": { 40 | "type": "string", 41 | "description": "The long description of your plugin." 42 | }, 43 | "authorUrl": { 44 | "type": "string", 45 | "description": "A URL to your own website." 46 | }, 47 | "fundingUrl": { 48 | "type": "string", 49 | "description": "A URL to where the users can support your project." 50 | }, 51 | "isDesktopOnly": { 52 | "type": "boolean", 53 | "description": "Whether your plugin uses NodeJS or Electron APIs." 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /static/img/command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/command.png -------------------------------------------------------------------------------- /static/img/context-menu-positions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/context-menu-positions.png -------------------------------------------------------------------------------- /static/img/default-violet.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/default-violet.webp -------------------------------------------------------------------------------- /static/img/editor-todays-date.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/editor-todays-date.gif -------------------------------------------------------------------------------- /static/img/editor-uppercase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/editor-uppercase.gif -------------------------------------------------------------------------------- /static/img/example-insert-link.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/example-insert-link.gif -------------------------------------------------------------------------------- /static/img/fuzzy-suggestion-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/fuzzy-suggestion-modal.png -------------------------------------------------------------------------------- /static/img/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /static/img/modal-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/modal-input.png -------------------------------------------------------------------------------- /static/img/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/settings.png -------------------------------------------------------------------------------- /static/img/status-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/status-bar.png -------------------------------------------------------------------------------- /static/img/styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/styles.png -------------------------------------------------------------------------------- /static/img/suggest-modal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/static/img/suggest-modal.gif -------------------------------------------------------------------------------- /tools/alfred-workflow/Alfred Obsidian Plugin Docs Search demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/tools/alfred-workflow/Alfred Obsidian Plugin Docs Search demo.gif -------------------------------------------------------------------------------- /tools/alfred-workflow/Obsidian Plugin Docs Search.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcusolsson/obsidian-plugin-docs/2b61554e995560036b1789648f46379b76664e3b/tools/alfred-workflow/Obsidian Plugin Docs Search.alfredworkflow -------------------------------------------------------------------------------- /tools/alfred-workflow/obsi-marcus-doc-search.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env osascript -l JavaScript 2 | ObjC.import("stdlib"); 3 | const app = Application.currentApplication(); 4 | app.includeStandardAdditions = true; 5 | const alfredMatcher = (str) => str.replace (/[-()_/.]/g, " ") + " " + str + " "; 6 | 7 | String.prototype.capitalizeWords = function () { 8 | return this.replace(/\w+/g, word => word.charAt(0).toUpperCase() + word.slice(1)); 9 | }; 10 | 11 | //------------------------------------------------------------------------------ 12 | 13 | const workArray = JSON.parse(app.doShellScript('curl -s "https://api.github.com/repos/marcusolsson/obsidian-plugin-docs/git/trees/main?recursive=1"')) 14 | .tree 15 | .filter(file => file.path.startsWith("docs/")) 16 | .filter(file => file.path.endsWith(".md")) 17 | .map(file => { 18 | const subsitePath = file.path.slice(5, -3); 19 | 20 | const displayTitle = subsitePath 21 | .replace(/.*\//, "") // show only file name 22 | .capitalizeWords() 23 | .replaceAll("-", " "); 24 | 25 | const category = subsitePath 26 | .replace(/(.*)\/.*/, "$1") // only parent 27 | .replaceAll ("/", " → ") // nicer tree 28 | .capitalizeWords() 29 | .replaceAll("-", " "); 30 | 31 | return { 32 | "title": displayTitle, 33 | "subtitle": category, 34 | "match": alfredMatcher (subsitePath), 35 | "arg": `https://marcus.se.net/obsidian-plugin-docs/${subsitePath}`, 36 | "uid": subsitePath, 37 | }; 38 | }); 39 | 40 | JSON.stringify({ items: workArray }); 41 | --------------------------------------------------------------------------------