html-examples:   Examples in HTML

html-examples: Examples in HTML

Paulo Matos <>

One of the really interesting features of Scribble is its ability to typeset racket examples and run them inside a sandbox. Note that the big thing here is that I am only typing (+ 1 1) and Racket is doing the rest.

> (+ 1 1)


I wanted this for my blog so I found a really simple way to obtain the HTML generated by Scribble and the result is html-examples.

 (require html-examples) package: html-examples


(examples->html x [#:set-class new-class])  txexpr?

  x : (or/c compound-paragraph? nested-flow?)
  new-class : symbol? = 'racket-examples
Produces a txexpr? from examples block in x.

The resulting txexpr? will have css property class new-class, which defaults to 'racket-examples.

Note: This function will only provide you with the HTML for examples, you still need to add the CSS files to your webpage for it to look good. The required CSS files can be found in the assets folder of the html-examples repository.