Comments (3)
Ok it's been a few months, but this is finally in version 1.4. I did go for Markdown parsing in the end (CommonMark spec); it's even used as standard in some newer languages like Dart and Elm.
A couple of details: a blank line between the preceding paragraph and the first bullet point is optional. Also as mentioned above, the bullet markers must be indented less than 4 spaces.
from rewrap.
It's nice to hear the addon gets a lot of use :)
Yeah lists are something I definitely want to support, and have been thinking about doing for a long time; it's just a question of how, and working out the details.
Things to consider for example are: which characters to allow as bullets (- * + #?, do you also allow numbers?). Also how do you distinguish a bullet paragraph from one of those characters that just happens to be at the start of a line in the middle of a sentence? Do you require a blank line separating them (as in your examples) or do you try something more clever?
Something I've wondered about, though just not yet explored in full, is processing all comment text as Markdown, using the existing parser. It seems maybe a little overkill, but you get a lot for free, including all those rules. And it's probably more sensible to use an existing spec than making up your own. It would require a little extra code to deal with things like @tags in js/javadoc and xml tags in C#, but it would also replace some existing code and give some new features like code blocks between ```
lines (used in PureScript doc comments.)
Thinking about it now I think I'll try this route and see how it turns out.
(Just a note: in your examples the list items are indented 4 spaces before the -
character. Currently Rewrap treats all lines indented 2 spaces or more (or 1 tab) as a code sample. If markdown was used would become 4 spaces (or it could be bumped up to 4 anyway), but the point is it'll only be possible to have list items indented 1, 2 or 3 spaces.)
from rewrap.
I'd be cautious about full Markdown parsing. I like Markdown and use it in many places day-to-day, but it's actually surprisingly complicated and ambiguous, and feels like overkill for code comments. My preference is that an addon like this should be as un-opinionated as possible. I work on other people's code quite a lot, and have to cope sympathetically with all sorts of outlandish coding conventions as I find them. I'm not always in a position to impose anything more than minimal sanity, and I think you're very close to the minimal surface area here: wrapping, code samples and bullet lists just about covers it.
from rewrap.
Related Issues (20)
- Wrapping in Nix is broken in a remote SSH host HOT 3
- Zig doc comments `///` are mangled
- Markdown tables are reformatted wrongly with `rewrap.onSave: true`
- Release 17.7 Pre-Release as main published version? HOT 3
- Unmaintained?
- Problem with empheq in in latex (using latex-workshop extension)
- Add Luau compatibility
- Git Commit Message Wraps lines at 50 characters instead of 72 HOT 5
- Unavailable on arm64
- `Typst` support
- GitHub action for building and testing no longer works
- Valid C++ comment delimiter not recognized prevents rewrap
- Won't wrap email text pasted in a Quarto listing (code fence) HOT 1
- Won't wrap Rust comments
- Standalone tool/binary? HOT 1
- Rewrap replaces spaces with null characters inside Javadoc tags in the presence of HTML tags in some situations
- Add support for Doxygen `///` comments in ST files
- Handle Markdown in comments
- not support Chinese
- `command 'rewrap.rewrapComment' not found` when working with Solidity
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rewrap.