https://github.com/sapegin/grim-wrapper
Rewrap comment blocks to make them readable
https://github.com/sapegin/grim-wrapper
Last synced: 3 months ago
JSON representation
Rewrap comment blocks to make them readable
- Host: GitHub
- URL: https://github.com/sapegin/grim-wrapper
- Owner: sapegin
- License: mit
- Created: 2025-08-17T10:43:54.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-09-17T07:06:02.000Z (4 months ago)
- Last Synced: 2025-09-29T01:59:40.865Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 106 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Contributing: Contributing.md
- License: License.md
Awesome Lists containing this project
README
# Grim Wrapper
[](https://www.npmjs.com/package/grim-wrapper) [](https://github.com/sapegin/grim-wrapper/actions)
Rewrap comment blocks to make them readable.
[](https://sapegin.me/book/)
## Features
- Very small, no dependencies.
- Works in most popular programming languages, Markdown, and plain text.
- Supports Markdown lists and JavaDoc/JSDoc/XMLDoc tags.
- Limited scope to a single paragraph (part of a comment separated by empty lines).
- Almost zero config: the only option is maximum line length.
## Getting started
1. Install Grim Wrapper from npm:
```bash
npm install grim-wrapper
```
2. Call the `wrapComment` function with the comment text and the desired maximum line length. Note that it works with comment paragraphs (lines between “empty” lines).
```js
import { wrapComment } from 'grim-wrapper';
wrapComment(
'// Bicycle rights disrupt craft beer butcher bagel biodiesel vintage asymmetrical wet cappuccino underconsuption High Life Prenzlauer Berg chia kitsch.',
80
);
// →
// Bicycle rights disrupt craft beer butcher bagel biodiesel vintage
// asymmetrical wet cappuccino underconsuption High Life Prenzlauer Berg chia
// kitsch.
```
## Motivation
I’ve been using [Rewrap](https://stkb.github.io/Rewrap/) for a long time, but it doesn’t always do what I want:
- No support for JSX comments.
- Often weird formatting of multiline comments (`/* ... */`, etc.).
- I don’t like the way it format Markdown todos and JSDoc tags.
Check out [samples](https://github.com/sapegin/vscode-grim-wrapper/tree/main/samples) to get an idea how it formats comments.
## Sponsoring
This software has been developed with lots of coffee, buy me one more cup to keep it going.
## Contributing
Bug fixes are welcome, but not new features. Please take a moment to review the [contributing guidelines](Contributing.md).
## Authors and license
[Artem Sapegin](https://sapegin.me) and [contributors](https://github.com/sapegin/grim-wrapper/graphs/contributors).
MIT License, see the included [License.md](License.md) file.
