Open jflam opened 8 years ago
What is the "community standard", if any?
I've seen people using Markdown simply not insert any line breaks at all (i.e. every paragraph is one long line), and using editors with word wrap to edit it comfortably. VS has a word wrap mode (Edit | Advanced | Word Wrap), and we could enable it by default for .Rmd.
I think this is basically a forced like breaking. HTML formatter has this option to add breaks at specified length. Or at least old one (Web Forms) used to.
It's reflow, so the ideal state of affairs is that it automatically inserts and removes line breaks as you're editing the paragraph (so that it's always "sized to fit" the current line limit, even as you delete text). The real tricky part is the latter.
John, does vim-markdown do dynamic reflow, or do they require you to invoke a command? And which one do you prefer?
Although fixed breaks may or may not be desired. Hard breaks make document hard to read on smaller devices.
Yup. Hence my earlier question on whether it really needs to be hard line breaks, or we can just turn word wrap for Markdown by default, and call it good.
Personally, I actually prefer word wrap for when I have to edit Markdown. But if the R community has some sort of standard on wrapping (e.g. 79 char lines), then we should match this with our defaults, and tell people how to do word wrap if they prefer.
The 79 char line was my oblique reference to PEP8 :)
I think it should be hard line breaks so that folks can treat .rmd documents as code. This way diffs work well, can edit quickly with something other than VS etc. Also, I would love to have this feature ported to other languages like C# for comment reformatting so I can keep my OCD happy.
vim-markdown uses a command, gqip, to reformat the current paragraph that the cursor is positioned in.
When writing RMarkdown documents, it is nice to have automatic reflowing of paragraphs while you are writing text. The lines should be reformatted using carriage returns, with a user-adjustable right-column setting, which should probably default to 79 for folks who are nostalgic for the good old days.
If you are typing at the end of a paragraph, RTVS should just wrap lines for you as you type. If you are inserting text in the middle of a paragraph, we should just use the standard Visual Studio reformat command to reformat the current paragraph / selection.
The vim-markdown plugin for vim does a great job at this btw, for anyone who wants to use this now. gqip is the command for reformatting the current paragraph.