html-examples:   Examples in HTML
examples->html
7.7

html-examples: Examples in HTML

Paulo Matos <pmatos@linki.tools>

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.

Example:
> (+ 1 1)

2

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

procedure

(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.