GithubHelp home page GithubHelp logo

Comments (3)

stkb avatar stkb commented on July 22, 2024 1

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.

stkb avatar stkb commented on July 22, 2024

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.

cortesi avatar cortesi commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.