Skip to content
Common Lisp text prepocessor
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

A Common Lisp Preprocessor for Text/Code


This application is born out of a necessity: I needed something light-weight and portable that would process a text file and evaluate the embedded Common Lisp code without touching the rest of the text. My constraints were:

  • Light-weight: no servers, no swank, no emacs, no nothing...
  • Portable: should work with all Common Lisp implementations. At the moment, it works only with sbcl because of my use of *posix-argv* but with judicious use of #+ one can extend it for other lisps.
  • Should be streaming: should not slurp the whole text before it starts processing. It should process it line by line.

There is only one file. Compile it. You might need a helper shell file to make things work smoothly, but there is no need. You can run it via

sbcl --noinform --non-interactive --load text-lisp.lisp INPUT-FILE OUTPUT-FILE

That's it.

You can process a markdown file, a html file, a LaTeX file, or whatever. text-lisp does not touch anything except the embedded lisp code.

Short Tutorial

Code blocks are marked with ``` and everything in between is treated as a Common Lisp code block, and will be executed as such. One can supply a hide keyword to the header. In that case, the source is not going to be displayed but the results are going to be displayed. If you pass a hide all then both the source and the results are not going to be displayed. If you need a piece of code executed within text (as in $$ vs. $ in LaTeX) then use `` in the text. See the example example.txt file.

You can’t perform that action at this time.