guile-syntax-highlight

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.

The following languages/formats are currently supported:

Usage

(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 lex-scheme code))

;; Convert to SXML.
(define highlighted-sxml
  (highlights->sxml highlighted-code))

;; Write HTML to stdout.
(sxml->xml highlighted-sxml)
(newline)

Releases

Requirements

Installation

To build and install guile-syntax-highlight from source, run:

wget https://files.dthompson.us/releases/guile-syntax-highlight/guile-syntax-highlight-0.2.0.tar.gz
tar xf guile-syntax-highlight-0.2.0.tar.gz
cd guile-syntax-highlight-0.2.0
./configure
make
make install

License

GNU LGPLv3+

Git Repository

guile-syntax-highlight is developed using the Git version control system. The official repository is hosted at https://git.dthompson.us/guile-syntax-highlight.git.

To clone the repository, run:

git clone https://git.dthompson.us/guile-syntax-highlight.git

Community

Real-time discussion for guile-syntax-highlight can be found on the #guile channel on the Libera.chat IRC network

Contributing

Send patches and bug reports to davet@gnu.org.