CGIT is a free and simple webby front-end to let people browse your git repository without having to check out a copy of your code to their machine. I chose to use it because it's dead simple - build a single CGI, put it somewhere that your web sewer can read it, and write a simple config file. Job done, no complicated libraries to build, it Just Works. And because it's written in C, it's fast and consumes few resources.

It doesn't do syntax highlighting when displaying code. But it does have a facility to run any blobs of code through a filter before displaying them, so you can easily put your own filter in place to do the highlighting for you. To configure it, simply put something like this:

source-filter=/web/www.cantrell.org.uk/cgit/highlighter

in your /etc/cgitrc. And the script reads:

#!/usr/local/bin/perl use warnings; use strict; my $file = shift; if($file =~ /\.(p[ml]|t)$/i) { system "/usr/local/bin/perltidy -html -st -ntoc -npod -pre -nss -n +nn" } else { system "cat -n"; }

In reply to Syntax highlighting in CGIT by DrHyde

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.