blob: 83021a29c9d2c344efc6e8a6448983c9df2d6e79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
-*- mode: org -*-
Guile-syntax-highlight is a general-purpose syntax highlighting
library for GNU Guile. It can parse code written in various
programming languages into a simple s-expression that can be easily
converted to HTML (via SXML) or any other format for rendering.
* Supported Languages
- Scheme
* Example
#+BEGIN_SRC scheme
(use-modules (syntax-highlight)
(syntax-highlight scheme)
(sxml simple))
(define code
"(define (square x) \"Return the square of X.\" (* x x))")
;; Get raw highlights list.
(define highlighted-code
(highlight scheme-highlighter code))
;; Convert to SXML.
(define highlighted-sxml
(highlights->sxml highlighted-code))
;; Write HTML to stdout.
(display (sxml->xml highlighted-sxml))
(newline)
#+END_SRC
* Requirements
- GNU Guile >= 2.0.9
* Building
Guile-syntax-highlight uses the familiar GNU build system and
requires GNU Make to build.
** From tarball
After extracting the tarball, run:
#+BEGIN_SRC sh
./configure
make
make install
#+END_SRC
** From Git
In addition to GNU Make, building from Git requires GNU Automake
and Autoconf.
#+BEGIN_SRC sh
git clone git@dthompson.us:guile-syntax-highlight.git
cd guile-syntax-highlight
./bootstrap
./configure
make
make install
#+END_SRC
* License
LGPLv3 or later. See =COPYING= for the full license text.
|