Changes between Version 1 and Version 2 of PygmentsHighlighter

12/08/09 05:21:21 (9 years ago)

Updated for the new


  • PygmentsHighlighter

    v1 v2  
    1 "TheManiac", as he's known on the forums, has created a [ Pygments]-based highlighter which is important because Pygments drives [ other projects] such as [ Trac]. 
     1We have morphed the original Cobra highlighter for [ Pygments] provided by "TheManiac" to include the very latest the the Cobra Programming language supports. TheManiac started this work, which is very important because Pygments drives [ other projects] such as [ Trac]. Please find the forum discussion surrounding the earlier development at [ specific forum post]. 
    3 There is a [ specific forum post] on using it. 
     3= Getting started with Pygments = 
     4The most common scenario for using Pygments is converting source code to HTML. Cobra provides this support using the CobraLexer found in the file. is attached to this page.  
    5 You might be interested in the [ entire forum topic] on it. 
     6If you already have Pygments installed skip to the next paragraph, else install Pygments using one of the ways mentioned on the [ Pygments download page]. 
     8The following assumes that your main Pygments directory is named "pygments". 
     91. Change your directory to pygments/pygments/lexers 
     102. Overwrite the existing file with the file attached below 
     113. Execute the command "python" 
     12And you are all set. 
     14= Usage = 
     15Change your directory back to the Pygments root directory (in there you will see '''pygmentize'''). 
     17To convert a Cobra source file to HTML use the following command: 
     19./pygmentize -l cobra -f html -O full,style=colorful -o <output filename>.html <input file>.cobra 
     22Above the '''-l''' option specifies the input language--Cobra in this case--and, the '''-f''' option specifies the output format. Pygments is able to infer the language and output formats when an applicable extension is used for the output file and input filenames, respectively. The above could be shortened to: 
     24./pygmentize -O full,style=colorful -o <output filename>.html <input file>.cobra 
     27By default the Cobra lexer will set the tabsize to 4 per Cobra public guidelines. 
     29How do I list all the available styles and output formats? How do I change the input/output encoding? For these and other questions consult the [ Pygments command line help] web page.