Code Difference

  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

I was looking for a way to highlight changes I've made to code on the boards and couldn't really find anything besides making a quote and then applying the color bbcode. It would be neat if there was a way to display the difference in two sets of code.

* had to use a different bracket because disabling BBcode didnt work.
Code: [ Select ]
{diff}

{code}
{/code}

{code}
{/code}

{/diff}
  1. {diff}
  2. {code}
  3. {/code}
  4. {code}
  5. {/code}
  6. {/diff}




It would compare the two sets of code tags and show the differences between them. It could either highlight additions in a green and highlight removed code in red (might screw with code syntax highlighing), or use the patch style with -- and ++ for lines that have changed.

Might be more trouble than its worth, just a suggestion though, and it would be really cool ;)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Would something like this built in feature work where you can highlight different lines?

Code: [ Select ]
Here is line 1 not highlighted
Here is line 2 not highlighted
Here is line 3 HIGHLIGHTED!
Here is line 4 HIGHLIGHTED!
Here is line 5 not highlighted
  1. Here is line 1 not highlighted
  2. Here is line 2 not highlighted
  3. Here is line 3 HIGHLIGHTED!
  4. Here is line 4 HIGHLIGHTED!
  5. Here is line 5 not highlighted


To do that you just type add the word highlight=1-5,8,15,39-42 to the actual code tag or php tag (or whatever). The numbers represent the lines or range of lines you want to highlight. So for example the code above that I used was:

Code: [ Select ]
[code highlight=3-4]Here is line 1 not highlighted
Here is line 2 not highlighted
Here is line 3 HIGHLIGHTED!
Here is line 4 HIGHLIGHTED!
Here is line 5 not highlighted[ /code]
  1. [code highlight=3-4]Here is line 1 not highlighted
  2. Here is line 2 not highlighted
  3. Here is line 3 HIGHLIGHTED!
  4. Here is line 4 HIGHLIGHTED!
  5. Here is line 5 not highlighted[ /code]
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Awesome! That will work nicely.
  • SB
  • Moderator
  • Genius
  • User avatar
  • Posts: 8742
  • Loc: Aberdeen, Scotland

Post 3+ Months Ago

I use the dark theme, as i am sure you know. Whilst White is ideal for the dark background it isn't so good with the colour of the text.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Unfortunately it appears that won't be an easy fix at the moment SB. The problem is due to the way it is using inline styles for the color of the highlighted text. I will need to modify the system to use classes instead so that I can put a different color for highlights.

So it is on the list to fix for the dark theme.
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

wow wish I'd known about that trick years ago. Off to put it to a great use :-)

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.