Code Highlighting
CodeHighlighting1. Introduction
Code highlighting for a software providing/support/sales/discussion sight is mandatory. I have already started growing accustom to the BBCODE editing style for the posts and I also like the sparse nature of the Markdown formating for the Wiki. So what I need to do is very carefully integrate a plug in ability to have code highlighting on the fly as well as being able to designate and control which code highlighting syntax is used.
BBCODE already gives me the tie in by allowing the code tag to have a language specification. That should make it a lot easier. However, Markdown syntax does not have anything like that, unless I add something like a header marker for a code block. The indenting requirement of a code block in Markdown seems a little annoying. Maybe I'll come to like it.
In the mean time I have found the code highlighting engine I will graft into place:
2. Pygments Code Highlighter
Pygments a python based generic syntax highlighter. It offers the following features
- a wide range of common languages and markup formats is supported
- special attention is paid to details that increase highlighting quality
- support for new languages and formats are added easily; most languages use a simple regex-based lexing mechanism
- a number of output formats is available, among them HTML, RTF, LaTeX and ANSI sequences
- it is usable as a command-line tool and as a library
3. Implementation Notes
Of course the first thing is to do is get it installed and then read all the docs. After that I can start putting into place a design for how to make it optionally available but automatically used if present.
Tags:
Last Modified: 2008-06-02 00:09:13 by Leeland - [ Snip Changes ] [ Wiki History ]

