Skip to content

jonasbuckner/Apache-Highlight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Apache-Highlight
Syntax Highlight Python and Send it as HTML

Copyright 2010 Jonas Buckner
Distributed under the GNU General Public License
http://www.gnu.org/licenses/gpl.html

Requires Apache with mod_cgi and mod_actions
  and Python with the Pygments module installed

Installation:

To install, place it in your /cgi-bin directory and make sure it's
readable and executable.

Add the following lines into the main Apache config, a directive block in
your Apache config, or into an .htaccess file in individual directories.

Add to or remove from this list to your liking. Only the first line and
one AddHandler line are necessary.

    Action highlight /cgi-bin/highlight.cgi
    AddHandler highlight .py
    AddHandler highlight .pl
    AddHandler highlight .pm
    AddHandler highlight .perl
    AddHandler highlight .s
    AddHandler highlight .c
    AddHandler highlight .sh
    AddHandler highlight .html
    AddHandler highlight .cpp
    AddHandler highlight .xml
    AddHandler highlight .js
    AddHandler highlight .css

The full list of highlightable syntaxes is available at
http://pygments.org/languages/

WARNING: Be very sure that the directory to which you apply this contains
the correct files you want to highlight. This can be a major security flaw
if you share scripts and other files you don't intend to.

ChangeLog:
    2009-05-13: Initial Release
    2010-05-12: Added Documentation
                Changed one of the styles to make the numbers a fixed-width font
    2010-11-26: Added link to download a direct plaintext copy of the file

Known Issues:
    The line numbers are sometimes useless, as they don't align with the code always. If
        this happens, try switching to another color in the list.

TODO:
    Change the way the code is drawn to better align the line numbers.
    Reload Colorschemes with Ajax
    Serve syntax-highlighted files with Ajax by accessing them directly through a page
    Eventually, I'd like to be able to accept settings through Apache to change stylesheets,
        default colorschemes, and more.
    Link to local include files so that projects can be browsed
    Colorschemes should affect the whole colorscheme, including the header and line numbers.
        Possibly this should use a little vector math to make the colors match the chosen theme.

About

CGI Script for Apache to Highlight Raw Files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published