pbu88 / diffy

Share diff output in the browser with https://diffy.org
208 stars 51 forks source link

Copy pasteable output #9

Closed noway closed 7 years ago

noway commented 7 years ago

Would be great to have copy pasteable output to paste into an email.

pbu88 commented 7 years ago

Hi @noway421, couldn't you just share the link? That's what diffy is intended for. What do you mean by copy pasteable content? To copy only the code and not the + or - nor the line numbers?

noway commented 7 years ago

Link is only 24 hours and it means exposing code bits on the internet.

By copy pastable I mean html colourized output which can be pasted as rich content with html markup in it.

pbu88 commented 7 years ago

Hmmm that's gonna be a tough one. First of all we would have to define the behaviour. Right now you can copy paste but you will copy paste the line numbers and also the + or - signs from the diff? I guess the signs are wanted since we would be copying a diff output. The rich html would make it more challenging even, do you have an example of a site that does this (maybe Github?)

Another thing you can do in the meantime is download the diff piece (by clicking the button in the top right corner) and then copy the snippet directly from the raw diff input.

This issue is a tough one I'm not sure if I'm gonna have time to work on that. Also, I think it belongs to diff2html, the library I use to generate the diff html.

noway commented 7 years ago

Yeah, line numbers are not needed. Essentially i'm looking at something like this:

http://pygments.org/demo/6314564/

as a service. Actually, this completely solves my use case.

2016-10-28-021838_603x668_scrot

pbu88 commented 7 years ago

I see, that library is very cool. I see your example in the webpage, but could you copy the html markup with a simple select and copy? I tried and I couldn't. I think I have to actually use the program and generate an html markup and the copy it and paste it somewhere else.

I don't think there's an easy way to make select, copy and paste work like that in diffy, what could be done though is have a "raw view tab" of the diff and the output for that tab is the diff colorised this way. The project is in node js though and the library is in python so I don't know how hard it could be to actually get it working.

BTW thanks for using diffy :-)

noway commented 7 years ago

works in chrome with contenteditable text areas.

pygments just colorizes the diff syntax, and that's what i look for. and it would be awesome if it would colorize the underlying color syntax too (for example html if it is html). dunno if that's possible

pbu88 commented 7 years ago

Not sure what to do as part of this issue, besides all the html Diffy uses for its diff output is generated by diff2html library. I don't think I can address this issue now, sorry. Closing for the moment.