Hacker News new | ask | show | jobs
by KirillPanov 1936 days ago
> it drives me up a wall when people use it in things like email or Markdown documents

Are there many editors that can rewrap long lines in a Markdown-aware way when displaying long lines?

I mean if you create an outline with significant nesting depth (like 3+ levels) and all the items are more than one screenwidth worth of text, the editor linewrapping is going to make it impossible to see the structure.

Otherwise you get this unreadable mess:

  .   + Foo bar baz foo bar baz foo bar baz foo bar baz foo bar
  .   baz foo bar baz foo bar baz
  .     + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .   bar baz foo bar baz foo bar baz
  .       + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .   bar baz foo bar baz foo bar baz
  .     + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .   bar baz foo bar baz foo bar baz
Instead of this visually-apparent structure at the left edge (produced using emacs's hard-rewrap command "fill-region"):

  .   + Foo bar baz foo bar baz foo bar baz foo bar baz foo bar
  .     baz foo bar baz foo bar baz
  .     + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .       bar baz foo bar baz foo bar baz
  .       + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .         bar baz foo bar baz foo bar baz
  .     + Foo bar baz foo bar baz foo bar baz foo bar baz foo
  .       bar baz foo bar baz foo bar baz
(I had to add the periods at the left edge to prevent HackerNews's awful markup processor from "helpfully" mangling things... apparently "verbatim" only means "verbatim" if the whole block has the same level of indentation or something)

Hard-wrapping is basically an acknowledgement that text editors are never going to understand the semantics of all the markups and programming languages we use. And web browser text-edit widgets will be even worse. Then there's the situation where you have markup-within-code-comments. I don't think it's reasonable to expect editors to recognize how to rewrap all these different cases intelligently.

1 comments

With your example of a nested list, VSCode will correctly display line-wrapped inner items at the same indentation level.
Do you use VSCode to read your emails and edit Wikipedia?

Will it do this for Markdown inside of comments in C/C++/Rust code?

How does it even know you're using Markdown in comments as opposed to something else?

(I'll have to trust your answers since I don't have a Windows machine, let alone a Visual Studio license)

I mean, there are definitely places where hard wrapping makes sense or is the only option. I’m not saying it’s never the right thing to do, just that with emails or full-Markdown docs specifically it tends to restrict the ability to render in an optimal manner more than it helps.
> (I'll have to trust your answers since I don't have a Windows machine, let alone a Visual Studio license)

You don't need a Windows machine or Visual Studio license to use VS Code, which is both cross-platform and free.