
Newliner is a VS Code extension that keeps prose in a sentence-per-line style.
While you write, it formats only the active paragraph so that it can stay enabled without scanning the whole file on every keystroke.
This extension also has customizable behavior!
By default, it only runs on .md files, but you can add any other file extensions for this to run on (e.g., .tex, .txt, etc.).
You can even have it just run on all files, and you can toggle the extension on and off whenever you need.
Most importantly, you can have it run in different modes:
- After a short debounce during typing
- Only when saving
- Triggered manually when needed
Table of Contents
Features
This extension has the following feature set:
- Splits prose so each detected sentence starts on its own line.
- Combines accidental mid-sentence line breaks before splitting sentences again.
- Skips fenced code blocks, headings, tables, HTML blocks, link reference definitions, and other structural Markdown.
- Formats prose inside list items and blockquotes while preserving their Markdown prefixes.
- Provides commands and settings toggles for live formatting and save-time formatting.
Commands
Here are the main commands for controlling Newliner's behavior:
Newliner: Toggle Enabled turns the extension on or off.
Newliner: Format Sentences formats the active document when its file type is eligible (one-shot).
Newliner: Toggle File Extension List controls whether Newliner only runs on configured file extensions (default on).
Newliner: Toggle Format While Typing controls live paragraph formatting.
Newliner: Toggle Format On Save controls save-time document formatting.
The status bar item appears in eligible files and toggles the extension when clicked.
Settings
You can configure all of the behavior of this extension with the following settings.json entries:
newliner.enabled: enable or disable the extension.
newliner.useFileExtensionList: only run on file extensions in newliner.fileExtensions.
newliner.fileExtensions: file extensions Newliner can run on when newliner.useFileExtensionList is enabled. The default is [".md"].
newliner.formatOnType: format the current paragraph while typing in eligible files.
newliner.formatOnSave: format eligible files when saved.
newliner.debounceMs: live-format debounce delay in milliseconds.
newliner.respectCodeFences: leave fenced code blocks untouched.
newliner.formatLists: format prose inside Markdown list items.
newliner.formatBlockquotes: format prose inside blockquotes.
Development
Install dependencies, compile the TypeScript sources, and run the tests via:
npm install
npm run compile
npm test
Open this folder in VS Code and press F5 to compile and launch an Extension Development Host.
Credits
Assets
This project uses the following external assets:
Author
Notes-To-Self
Because I keep forgetting how to release a patch of a VSCode extension:
vsce publish patch
To run detailed tests on the package:
npm test
npm run compile
npm pack --dry-run