https://github.com/willlewis/newline-adjuster
Jupyter > Visual Studio > Obsidian When copying code from .md files in Visual Studio into Obsidian, extra newlines are added, making notes super long. This simple plugin replaces >=N number of multiple empty lines with 1 or 2 empty lines, with preview and undo functions.
https://github.com/willlewis/newline-adjuster
jupyter jupyter-notebook obsidian obsidian-plugin visual-studio
Last synced: 4 months ago
JSON representation
Jupyter > Visual Studio > Obsidian When copying code from .md files in Visual Studio into Obsidian, extra newlines are added, making notes super long. This simple plugin replaces >=N number of multiple empty lines with 1 or 2 empty lines, with preview and undo functions.
- Host: GitHub
- URL: https://github.com/willlewis/newline-adjuster
- Owner: WillLewis
- License: mit
- Created: 2024-07-31T13:52:53.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-18T22:02:25.000Z (almost 2 years ago)
- Last Synced: 2025-03-01T14:41:42.908Z (over 1 year ago)
- Topics: jupyter, jupyter-notebook, obsidian, obsidian-plugin, visual-studio
- Language: TypeScript
- Homepage: https://www.loom.com/share/5f29a5b93168400ba1476f0b8b88b07a?sid=bb19a67f-21a7-4c8a-a2ac-c7fbca6aca39
- Size: 368 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Newline Adjuster for Obsidian
An Obsidian plugin to replace multiple empty lines with configurable newlines, with preview and undo functionality.
## Features
- **Adjust Multiple Empty Lines**: Automatically replace multiple consecutive empty lines in a document with one or two newlines based on user settings.
- **Preview Changes**: Preview the changes before applying them with a side-by-side comparison of the original and adjusted text.
- **Undo Last Change**: Undo the last change made by the plugin.
- **Configurable Threshold**: Set the number of consecutive empty lines to search for and replace.
- **Configurable Replacement**: Choose whether to replace multiple empty lines with one newline or two newlines.
## Video Demonstration
Watch this video to see the Newline Adjuster plugin in action:
https://www.loom.com/share/5f29a5b93168400ba1476f0b8b88b07a?sid=bb19a67f-21a7-4c8a-a2ac-c7fbca6aca39
## Installation
1. **Download and Build the Plugin**:
```bash
git clone https://github.com/WillLewis/newline-adjuster.git
cd newline-adjuster
npm install
npm run build
```
2. **Copy to Your Obsidian Vault**:
```bash
cp -r newline-adjuster /path/to/your/vault/.obsidian/plugins/
```
3. **Enable the Plugin**:
- Open Obsidian.
- Go to `Settings` > `Community plugins`.
- Disable `Safe mode` if it is enabled.
- Find `Newline Adjuster` and enable it.
## Usage
### Ribbon Icons
- Click the **dice** icon in the left sidebar to adjust multiple empty lines in the active document.
- Click the **eye** icon to preview changes before applying them.
- Click the **undo** icon to undo the last change made by the plugin.
### Command Palette
- Open the command palette (Ctrl+P or Cmd+P) and run the following commands:
- **Adjust Newlines**: Replace multiple empty lines in the active document.
- **Preview Changes**: Preview the changes before applying them.
- **Undo Last Change**: Undo the last change made by the plugin.
### Settings
You can adjust the plugin settings to specify the number of consecutive empty lines to search for and replace, and whether to replace with one or two newlines.
1. **Open Settings**:
- Click on the gear icon (⚙️) in the bottom left corner to open the settings menu.
- Navigate to `Community plugins` and find `Newline Adjuster`.
2. **Adjust Consecutive Line Threshold**:
- In the settings tab, find the option `Consecutive Line Threshold`.
- Enter the number of consecutive empty lines you want the plugin to search for and replace. For example, enter `4` to replace any instance of 4 or more consecutive empty lines with a single empty line.
3. **Set Replacement Newlines**:
- In the settings tab, find the option `Replace with Two Newlines`.
- Toggle the switch to choose whether to replace multiple empty lines with two newlines instead of one.

## Development
### Building the Plugin
To build the plugin from source, follow these steps:
1. **Install Dependencies**:
```bash
npm install
```
2. **Build the Plugin**:
```bash
npm run build
```
### Contributing
Contributions are welcome! Please open an issue or submit a pull request with your improvements or bug fixes.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Author
Will Lewis - willxemail@gmail.com [Webmocha](https://webmocha.com)