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.

11 Comments for 'Diff parser for CodeMirror'

    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

    Thanks and Best Regards

    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!

    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!

    April 17, 2010 | 21:27

    Under the WTFPL.

    November 10, 2010 | 17:42

    Great man!

    June 7, 2012 | 23:23

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

    August 7, 2012 | 03:52

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

    Parin Porecha
    June 11, 2013 | 07: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 ?

    Parin Porecha
    June 11, 2013 | 08: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

    August 18, 2013 | 18:41

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

    July 5, 2015 | 06:14

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

Leave a comment



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