Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I hoped they would fix line wrapping - which should be a relatively simply task - by now.

This is a very needed feature for projects that work a lot with text files (such as markdown) that do not automatically break on set widths (e.g. [1])

I've already contacted Github support with this request months ago, but no one's stepped up with a fix. Maybe this can get escalated somehow? Heck, I'd even submit a pull request if it was possible for github/github.

[1] - https://github.com/cryptoparty/handbook/pull/72/files



I'm not sure I understand what you are referring to. Are you saying you want the long lines to be wrapped in the diff display? If so, I really can't see how this is an issue with GitHub since this is how the unified diff output is suppose to look like. Displaying it any differently would be misleading since it is a long line.


I think he wanted to see something like this instead:

http://f.cl.ly/items/0B2T3i1o1A3y062q0K1Z/Image%202013.12.02...

I don't find it too misleading. But long line could be made to look even more different (from multiple short lines) by having distinct color, typography marks etc.


https://github.com/blog/1707-soft-wrapping-on-prose-diffs

In your honor, I used an example from the cryptoparty handbook. Cheers!


Made my day, Thanks! :)


Why not add line breaks using your text editor? That will also help your collaborators who prefer not to wrap long lines.

I have a hook in my .emacs that turns on auto-fill-mode whenever I open a .md or .rst file. I'd assume there's something analogous for vim or whichever editor you normally work with.


I see this becoming a trend now, where long lines are used to make it easier to do diffs. I'm on the fence about this since there are pros and cons.


In text, hard line breaks can be content rather than presentation, so adding them to the raw file is not always desirable. It would be fantastic if the github web viewers offered this feature.

Also, won't it mess up diffs for wrapped text? If you add a few words in the middle of a paragraph and then re-wrap the text, won't the contents of every single following line be altered and show up as a diff?


Unified and side by side diffs were never really meant for diffing documents. If you do go the route of introducing line breaks to improve readability and/or editing, you really need to use a different diffing algorithm. What I've found useful is the Google diff match and patch library.

http://code.google.com/p/google-diff-match-patch/

Its extremely easy to integrate as well. You can see how it handles a markdown diff at:

http://ny.testdrive.gitsense.com/index?#pid=23&cid=27&trail=


git diff --word-diff


If you use a browser extension that allows for site-specific user CSS, the following does the trick beautifully:

.diff-line-pre { white-space: pre-wrap; }


Which browser extension do you use for that?





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: