LiraNuna's Development Blog
Diff parser for CodeMirror
Posted on Saturday 6 February 2010

I wrote a quick diff parser for  CodeMirror.

CodeMirror is a real-time code editor for your browser. I know that diff isn’t a format edited by humans, but I found myself needing the diff syntax highlight where other code is shown.
More on that soon.

Live Example, Download the parser.


10 Comments for 'Diff parser for CodeMirror'

  1.  
    February 8, 2010 | 17:13
     

    Hello LiraNuna`s how are you?

    I Have one question, i need a diff parser for php or javascript, but the parser need parse the result of a Subversion result like in php exec(“diff file”, $result);

    Your diffparser is based on Subversion Result?
    Can I user your diffparser to parse a $result array?

    I have a Online IDE project with Subversion integrated but my diff is ugly
    More about the project in http://gurskiide.blogspot.com

    Thanks and Best Regards

  2.  
    February 18, 2010 | 14:40
     

    Subversion’s results are a unified diff. They should work just fine!

    Your project looks promising, keep up the good work!

  3.  
    April 17, 2010 | 20:52
     

    In case we decide to use your code for a project we’re working on, what’s the license for your code? Thanks!

  4.  
    April 17, 2010 | 21:27
     

    Under the WTFPL.

  5.  
    Anmol
    November 10, 2010 | 17:42
     

    Great man!

  6.  
    June 7, 2012 | 23:23
     

    [...] diff (courtesy of Liran Nuna) [...]

  7.  
    August 7, 2012 | 3:52
     

    [...] diff (courtesy of Liran Nuna) [...]

  8.  
    Parin Porecha
    June 11, 2013 | 7:37
     

    Hi LiraNuna,

    I want to write a custom parser for a textarea in my app.
    This parser will highlight all words starting with ‘@’, and quotes etc. Basically, it’s supposed to be very simple.
    But, I don’t know how to write a custom mode. I saw the diffparser, and it’s an excellent place to learn from !
    So, for testing, I want to use it in my app and then modify it.
    Can you show me the code how to load this with codemirror ?
    Thanks!

  9.  
    Parin Porecha
    June 11, 2013 | 8:05
     

    I viewed the source code of the live example, and used the initializer function in my page, but still it isn’t working.
    btw, i am using codemirror 3.13

  10.  
    August 18, 2013 | 18:41
     

    Hi Parin, this code is very very old and was made while CodeMirror was still beta…

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI