You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
highlight
|
|
============================
|
|
|
|
Highlight is a generic syntax highlighter. highlight currently
|
|
supports outputting to HTML. highlight is written in CHICKEN Scheme
|
|
and supports all the languages the 'colorize' egg supports.
|
|
|
|
Installation
|
|
============================
|
|
|
|
> wget http://code.thintz.com/highlight/snapshot/highlight-master.tar.gz
|
|
> tar xf highlight-master.tar.gz
|
|
> cd highlight-master
|
|
> sudo chicken-install
|
|
|
|
Example
|
|
============================
|
|
|
|
> cat pigs-fly.scm
|
|
(display "Do pigs fly? ")
|
|
|
|
(if (equal? (read-line) "yes")
|
|
(display "Pigs fly!")
|
|
(display "Sorry, pigs aren't flying today."))
|
|
|
|
> highlight pigs-fly.scm < pigs-fly.scm
|
|
<style>
|
|
...
|
|
</style>
|
|
<span class="code-highlight">
|
|
<span class="paren1">
|
|
(
|
|
<span class="default">display
|
|
<span class="string">"Do pigs fly? "</span>
|
|
</span>
|
|
)
|
|
</span>
|
|
...
|
|
</span>
|
|
|
|
Usage
|
|
============================
|
|
|
|
highlight takes one argument, the filename. highlight then reads from
|
|
standard input until end-of-file and writes to standard output.
|
|
highlight attempts to guess at the language to use for the
|
|
highlighting but if it fails writes plain HTML without any
|
|
highlighting.
|
|
|
|
Guessing the Language
|
|
============================
|
|
|
|
highlight attempts to guess what language to use for the syntax
|
|
highlighting based on a number of criteria. highlight first checks for
|
|
an emacs file local variable that specifies the major mode to use and
|
|
if it finds one maps that to the language to use for highlighting.
|
|
Note that it currently only checks the first line of the input. It
|
|
supports both the single variable form and extended form. So both '-*-
|
|
scheme -*-' and '-*- mode: scheme -*-' work. If it can't find an emacs
|
|
file local variable for the major mode it instead guesses based on the
|
|
file extension of the filename provided as its first argument. If it
|
|
still can't figure out what language it uses it will not syntax
|
|
highlight and instead output plain HTML.
|
|
|