generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
148 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,29 @@ | ||
## Obsidian Sample Plugin | ||
# Obsidian Link Archive | ||
|
||
This is a sample plugin for Obsidian (https://obsidian.md). | ||
This plugin archives links in your note so they're available to you even if the original site goes down or gets removed. | ||
|
||
This project uses Typescript to provide type checking and documentation. | ||
The repo depends on the latest plugin API (obsidian.d.ts) in Typescript Definition format, which contains TSDoc comments describing what it does. | ||
## How it works | ||
|
||
**Note:** The Obsidian API is still in early alpha and is subject to change at any time! | ||
Upon pressing the "Archive Links" button in the ribbon/left sidebar, the plugin: | ||
|
||
This sample plugin demonstrates some of the basic functionality the plugin API can do. | ||
- Changes the default font color to red using `styles.css`. | ||
- Adds a ribbon icon, which shows a Notice when clicked. | ||
- Adds a command "Open Sample Modal" which opens a Modal. | ||
- Adds a plugin setting tab to the settings page. | ||
- Registers a global click event and output 'click' to the console. | ||
- Registers a global interval which logs 'setInterval' to the console. | ||
1. looks up every external link in the current note, | ||
2. sumbits each of them to https://archive.org, | ||
3. as soon as they are saved, it embeds an `(Archived)` link after the regular link in your note. | ||
|
||
### First time developing plugins? | ||
The plugin will attempt not to recreate archive links for already-archived links (and the archive links themselves) - but this relies on not modifying the formatting of the archive links. | ||
|
||
Quick starting guide for new plugin devs: | ||
## Installation | ||
|
||
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it). | ||
- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder. | ||
- Install NodeJS, then run `npm i` in the command line under your repo folder. | ||
- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`. | ||
- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`. | ||
- Reload Obsidian to load the new version of your plugin. | ||
- Enable plugin in settings window. | ||
- For updates to the Obsidian API run `npm update` in the command line under your repo folder. | ||
In Obsidian, navigate to **Settings > Community Plugins**, turn off **Safe mode** if you haven't yet, then press the **Browse** button - you should be able to find it in the list there. | ||
|
||
### Releasing new releases | ||
Alternatively, clone/download this repository, and copy its contents to you vault's `.obsidian/plugins/obsidian-link-archive` folder and then enable it under **Settings > Community Plugins** (the note about disabling above applies here as well). | ||
## Changelog | ||
|
||
- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release. | ||
- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible. | ||
- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases | ||
- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. | ||
- Publish the release. | ||
**v0.1.0** | ||
|
||
### Adding your plugin to the community plugin list | ||
Initial release. | ||
|
||
- Publish an initial version. | ||
- Make sure you have a `README.md` file in the root of your repo. | ||
- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin. | ||
## Future plans | ||
|
||
### How to use | ||
|
||
- Clone this repo. | ||
- `npm i` or `yarn` to install dependencies | ||
- `npm run dev` to start compilation in watch mode. | ||
|
||
### Manually installing the plugin | ||
|
||
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. | ||
|
||
### API Documentation | ||
|
||
See https://github.com/obsidianmd/obsidian-api | ||
- Support for other archive providers | ||
- Custom formatting for archive links |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"id": "obsidian-sample-plugin", | ||
"name": "Sample Plugin", | ||
"version": "1.0.1", | ||
"id": "obsidian-link-archive", | ||
"name": "Link Archive", | ||
"version": "0.1.0", | ||
"minAppVersion": "0.9.12", | ||
"description": "This is a sample plugin for Obsidian. This plugin demonstrates some of the capabilities of the Obsidian API.", | ||
"author": "Obsidian", | ||
"authorUrl": "https://obsidian.md/about", | ||
"description": "This plugin archives links in your note so they're available to you even if the original site goes down or gets removed.", | ||
"author": "Tamás Deme - @tomzorz_", | ||
"authorUrl": "https://tomzorz.me", | ||
"isDesktopOnly": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
/* Sets all the text color to red! */ | ||
body { | ||
color: red; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"1.0.1": "0.9.12", | ||
"1.0.0": "0.9.7" | ||
"0.1.0": "0.9.12" | ||
} |