generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Floran Hachez
committed
Nov 7, 2020
1 parent
da3acc4
commit 59fc39b
Showing
9 changed files
with
169 additions
and
515 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,35 +1,19 @@ | ||
## Obsidian Sample Plugin | ||
# Obsidian Plugin: Convert an url (ex, youtube) into an iframe (preview) | ||
**Transform an youtube url into a youtube preview.** | ||
|
||
This is a sample plugin for Obsidian (https://obsidian.md). | ||
Transform a selected url to an embed view if the website allows it. It offers the possibilitiy to resize the preview. | ||
|
||
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. | ||
|
||
**Note:** The Obsidian API is still in early alpha and is subject to change at any time! | ||
|
||
### Releasing new releases | ||
|
||
- Update your `manifest.json` with your new version number, such as `1.0.1`. | ||
- 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. | ||
|
||
### Adding your plugin to the community plugin list | ||
|
||
- 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. | ||
|
||
### How to use | ||
|
||
- Clone this repo. | ||
- `npm i` or `yarn` to install dependencies | ||
- `npm run dev` to start compilation in watch mode. | ||
The default hotkey is `cmd + shift + i`. | ||
|
||
### Manually installing the plugin | ||
|
||
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. | ||
|
||
# Installation | ||
Support for 3rd party plugins is enabled in settings (Obsidian > Settings > Third Party plugin > Safe mode - OFF) | ||
To install this plugin, download zip archive from GitHub releases page. Extract the archive into <vault>/.obsidian/plugins. | ||
|
||
|
||
### API Documentation | ||
|
||
See https://github.com/obsidianmd/obsidian-api |
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,15 +1,28 @@ | ||
import { testSameOrigin, updateUrlIfYoutube } from '../iframe_converter'; | ||
import { isUrl, updateUrlIfYoutube } from '../iframe_converter'; | ||
|
||
describe('updateUrlIfYoutube', () => { | ||
const inputToExpectedOutput = [ | ||
["https://github.com/", "https://github.com/"], | ||
["https://www.youtube.com/watch?v=FY7DtKMBxBw", "https://www.youtube.com/embed/FY7DtKMBxBw"], | ||
["https://www.youtube.com/watch?v=FY7D_KM-xBw", "https://www.youtube.com/embed/FY7D_KM-xBw"], | ||
["https://www.youtube.com/embed/FY7DtKMBxBw", "https://www.youtube.com/embed/FY7DtKMBxBw"], | ||
] | ||
it.each(inputToExpectedOutput)('should correctly parse "%s"', (input: string, expected) => { | ||
|
||
const output = updateUrlIfYoutube(input); | ||
|
||
expect(output).toStrictEqual(expected) | ||
}) | ||
}) | ||
|
||
describe('isUrl', () => { | ||
const inputToExpectedOutput = [ | ||
["Quotes at vault/test.md", false], | ||
["https://github.com/", true], | ||
["https://www.youtube.com/watch?v=FY7DtKMBxBw", true], | ||
] | ||
it.each(inputToExpectedOutput)('should correctly parse "%s"', (input: string, expected) => { | ||
const output = isUrl(input); | ||
|
||
expect(output).toStrictEqual(expected) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.