fix manifest and make good readme
This commit is contained in:
223
README.md
223
README.md
@@ -1,90 +1,181 @@
|
||||
# Obsidian Sample Plugin
|
||||
# BindThem
|
||||
|
||||
This is a sample plugin for Obsidian (https://obsidian.md).
|
||||
A comprehensive Obsidian plugin that merges the best features from obsidian-tweaks, obsidian-editor-shortcuts, and heading-toggler into a single, unified solution. Enhanced editor shortcuts and formatting tools for power users.
|
||||
|
||||
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.
|
||||
## Features
|
||||
|
||||
This sample plugin demonstrates some of the basic functionality the plugin API can do.
|
||||
- Adds a ribbon icon, which shows a Notice when clicked.
|
||||
- Adds a command "Open modal (simple)" 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.
|
||||
### Better Formatting
|
||||
|
||||
## First time developing plugins?
|
||||
Smart text wrapping that intelligently detects word boundaries and existing formatting. Toggle formatting on and off with a single command.
|
||||
|
||||
Quick starting guide for new plugin devs:
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Toggle Bold (underscores) | Wrap or unwrap selection with `__` |
|
||||
| Toggle Bold (asterisks) | Wrap or unwrap selection with `**` |
|
||||
| Toggle Italics (underscore) | Wrap or unwrap selection with `_` |
|
||||
| Toggle Italics (asterisk) | Wrap or unwrap selection with `*` |
|
||||
| Toggle Code | Wrap or unwrap selection with backticks |
|
||||
| Toggle Comment | Wrap or unwrap selection with `%%` |
|
||||
| Toggle Highlight | Wrap or unwrap selection with `==` |
|
||||
| Toggle Strikethrough | Wrap or unwrap selection with `~~` |
|
||||
| Toggle Math (Inline) | Wrap or unwrap selection with `$` |
|
||||
| Toggle Math (Block) | Wrap or unwrap selection with `$$` |
|
||||
|
||||
- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with.
|
||||
- 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.
|
||||
### Directional Copy & Move
|
||||
|
||||
## Releasing new releases
|
||||
Copy or move text in any direction without using the clipboard.
|
||||
|
||||
- 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. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release.
|
||||
- Publish the release.
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Copy Up | Duplicate the current line(s) above |
|
||||
| Copy Down | Duplicate the current line(s) below |
|
||||
| Copy Left | Duplicate the current selection(s) to the left |
|
||||
| Copy Right | Duplicate the current selection(s) to the right |
|
||||
| Move Left | Shift the current selection one character left |
|
||||
| Move Right | Shift the current selection one character right |
|
||||
|
||||
> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`.
|
||||
> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json`
|
||||
### Heading Management
|
||||
|
||||
## Adding your plugin to the community plugin list
|
||||
Toggle heading levels H1 through H6 with intelligent detection. If the line already has the target heading level, the heading is removed.
|
||||
|
||||
- Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines).
|
||||
- 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.
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Toggle Heading 1-6 | Apply or remove heading level |
|
||||
| Toggle Heading 1-6 (Strip Formatting) | Apply heading and remove bold/italic formatting from content |
|
||||
|
||||
## How to use
|
||||
### Line Operations
|
||||
|
||||
- Clone this repo.
|
||||
- Make sure your NodeJS is at least v16 (`node --version`).
|
||||
- `npm i` or `yarn` to install dependencies.
|
||||
- `npm run dev` to start compilation in watch mode.
|
||||
Essential line manipulation commands for efficient editing.
|
||||
|
||||
## Manually installing the plugin
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Insert Line Above | Create a new line above the current line, preserving indentation |
|
||||
| Insert Line Below | Create a new line below the current line, preserving indentation |
|
||||
| Delete Line | Remove the current line entirely |
|
||||
| Delete to Start of Line | Remove all text from cursor to the beginning of the line |
|
||||
| Delete to End of Line | Remove all text from cursor to the end of the line |
|
||||
| Join Lines | Merge the current line with the next line |
|
||||
| Duplicate Line | Copy the current line and insert it below |
|
||||
| Copy Line Up | Duplicate the current line above (VSCode style) |
|
||||
| Copy Line Down | Duplicate the current line below (VSCode style) |
|
||||
|
||||
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
|
||||
### Selection Commands
|
||||
|
||||
## Improve code quality with eslint
|
||||
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
|
||||
- This project already has eslint preconfigured, you can invoke a check by running`npm run lint`
|
||||
- Together with a custom eslint [plugin](https://github.com/obsidianmd/eslint-plugin) for Obsidan specific code guidelines.
|
||||
- A GitHub action is preconfigured to automatically lint every commit on all branches.
|
||||
Quick selection tools for text manipulation.
|
||||
|
||||
## Funding URL
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Select Word | Select the word under the cursor |
|
||||
| Select Line | Select the entire current line |
|
||||
|
||||
You can include funding URLs where people who use your plugin can financially support it.
|
||||
### Case Transformation
|
||||
|
||||
The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file:
|
||||
Transform text case with various options.
|
||||
|
||||
```json
|
||||
{
|
||||
"fundingUrl": "https://buymeacoffee.com"
|
||||
}
|
||||
```
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Transform to Uppercase | Convert selection to UPPERCASE |
|
||||
| Transform to Lowercase | Convert selection to lowercase |
|
||||
| Transform to Title Case | Convert selection to Title Case |
|
||||
| Toggle Case | Cycle through: UPPERCASE -> lowercase -> Title Case |
|
||||
|
||||
If you have multiple URLs, you can also do:
|
||||
### Navigation
|
||||
|
||||
```json
|
||||
{
|
||||
"fundingUrl": {
|
||||
"Buy Me a Coffee": "https://buymeacoffee.com",
|
||||
"GitHub Sponsor": "https://github.com/sponsors",
|
||||
"Patreon": "https://www.patreon.com/"
|
||||
}
|
||||
}
|
||||
```
|
||||
Jump around your document quickly.
|
||||
|
||||
## API Documentation
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Go to Line Start | Move cursor to the beginning of the current line |
|
||||
| Go to Line End | Move cursor to the end of the current line |
|
||||
| Go to First Line | Jump to the first line of the document |
|
||||
| Go to Last Line | Jump to the last line of the document |
|
||||
| Go to Line Number | Open a modal to enter a specific line number |
|
||||
| Go to Next Heading | Jump to the next heading in the document |
|
||||
| Go to Previous Heading | Jump to the previous heading in the document |
|
||||
|
||||
See https://docs.obsidian.md
|
||||
### Cursor Movement
|
||||
|
||||
Basic cursor movement commands.
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Move Cursor Up | Move cursor up one line |
|
||||
| Move Cursor Down | Move cursor down one line |
|
||||
| Move Cursor Left | Move cursor left one character |
|
||||
| Move Cursor Right | Move cursor right one character |
|
||||
| Go to Previous Word | Move cursor to the start of the previous word |
|
||||
| Go to Next Word | Move cursor to the start of the next word |
|
||||
|
||||
### Multi-Cursor Support
|
||||
|
||||
Work with multiple cursors simultaneously.
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Insert Cursor Above | Add a cursor on the line above |
|
||||
| Insert Cursor Below | Add a cursor on the line below |
|
||||
|
||||
### File Operations
|
||||
|
||||
Quick file management commands.
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Duplicate File | Create a copy of the current file in the same folder |
|
||||
| New Adjacent File | Create a new file in the same folder as the current file |
|
||||
|
||||
### Utility Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| Toggle Line Numbers | Show or hide line numbers in the editor |
|
||||
| Undo | Undo the last action |
|
||||
| Redo | Redo the last undone action |
|
||||
|
||||
## Installation
|
||||
|
||||
### From Obsidian
|
||||
|
||||
1. Open Settings > Community plugins
|
||||
2. Disable Safe mode if enabled
|
||||
3. Click on "Browse" community plugins
|
||||
4. Search for "BindThem"
|
||||
5. Click Install, then Enable
|
||||
|
||||
### Manual Installation
|
||||
|
||||
1. Download the latest release from the releases page
|
||||
2. Extract the files to your vault's `.obsidian/plugins/bindThem/` folder
|
||||
3. Reload Obsidian
|
||||
4. Enable the plugin in Settings > Community plugins
|
||||
|
||||
## Configuration
|
||||
|
||||
After enabling the plugin, go to Settings > BindThem to access:
|
||||
|
||||
- **Debug mode**: Enable detailed logging for troubleshooting
|
||||
|
||||
## Customizing Keyboard Shortcuts
|
||||
|
||||
All commands can be assigned custom keyboard shortcuts:
|
||||
|
||||
1. Go to Settings > Hotkeys
|
||||
2. Search for "BindThem"
|
||||
3. Click the `+` icon next to any command
|
||||
4. Press your desired key combination
|
||||
|
||||
## Credits
|
||||
|
||||
This plugin merges and refactors functionality from:
|
||||
|
||||
- **obsidian-tweaks** - Better formatting, directional copy/move, file operations
|
||||
- **obsidian-editor-shortcuts** - Line operations, case transformation, navigation, multi-cursor support
|
||||
- **heading-toggler** - Heading toggle with formatting strip
|
||||
|
||||
## License
|
||||
|
||||
MIT License - See LICENSE file for details.
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter any issues or have feature requests, please open an issue on the GitHub repository.
|
||||
Reference in New Issue
Block a user