shurcooL/markdownfmt

Line wrap at N(=80) characters

ahmetb opened this issue · 2 comments

It would be really cool if this was able to line-wrap at 80 characters. A lot of repos require max 80 characters in markdown documentation for ease of maintenance. Many times, line-wrapping tools do not understand markdown and chop the link text or link URI in a damaging way.

It would be nice if we could pass --cols=80 to this command.

Hi, thanks for the suggestion.

This is somewhat similar/related to #17, you should check out that issue and the discussion there.

I'll add a thinking label because I want to spend more time thinking this over. But my first impression is that I'm not sure if I want this in scope for this project. I would like markdownfmt to be configuration-free, just like gofmt.

Many times, line-wrapping tools do not understand markdown and chop the link text or link URI in a damaging way.

I was actually thinking that this could be factored out to another tool, but you're right, doing line-wrapping on Markdown can benefit from parsing Markdown. It can still be done by another tool, of course, but it's a signal that it might be a better fit here.

My main argument for why I don't think this should be done is basically this:

I like the current model that doesn't insert newlines at all, and expects your text editor/viewer to render the text with word wrap on. That way, as you resize your text editor/viewer, all text reflows and there's no need to manually edit newline positions.

However, I agree with your point, some repos or other situations require one to manually wrap to some number of columns. I'm just not sure if I want to encourage that.

FWIW I would very much want this feature as well. I actually see this as the main thing I would like to get from a markdown formatter.