swarnam-obsidian/README.md

37 lines
1.3 KiB
Markdown
Raw Normal View History

2020-10-25 21:21:52 +00:00
## Obsidian Sample Plugin
2020-10-25 20:55:59 +00:00
This is a sample plugin for Obsidian (https://obsidian.md).
This project uses Typescript to provide type checking and documentation.
2020-10-25 21:21:52 +00:00
The repo contains the latest plugin API (obsidian.d.ts) in Typescript Definition format, which contains TSDoc comments describing what it does.
2020-10-25 20:55:59 +00:00
2020-10-25 21:21:52 +00:00
**Note:** The Obsidian API is still in early alpha and is subject to change at any time!
### How to use
2020-10-25 20:55:59 +00:00
- Clone this repo.
- `npm i` or `yarn` to install dependencies
- `npm run dev` to start compilation in watch mode.
2020-10-25 21:21:52 +00:00
### How to install the plugin
2020-10-25 20:55:59 +00:00
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `vault/.obsidian/plugins/plugin-id/`.
2020-10-25 21:21:52 +00:00
### Plugin structure
2020-10-25 20:55:59 +00:00
`manifest.json`
- `id` the ID of your plugin.
- `name` the display name of your plugin.
- `description` the long description of your plugin.
- `isDesktopOnly` whether your plugin uses NodeJS or Electron APIs.
- `js` (optional) an alternative js entry point. Defaults to `main.js`
- `css` (optional) a css file that should be injected. Defaults to `styles.css`
`main.js`
- This is the main entry point of your plugin.
- Import any Obsidian API using `require('obsidian')`
- Import NodeJS or Electron API using `require('fs')` or `require('electron')`
- Must export a default class which extends `CustomPlugin`