Any way to convert .rkt file to HTML?

This is not 100% standalone code yet (and not ready for publishing as a racket package), but the code I wrote at bottlenose/lib/assets/render-racket.rkt at master · CodeGrade/bottlenose · GitHub will walk a wxme file and output an ASCII file that can then be rendered in a CodeMirror instance on a webpage. Snips are converted to plaintext, and have to be re-inserted via JS once the page is loaded -- this is done in bottlenose/app/views/submissions/_render_embedded_images.js.erb at master · CodeGrade/bottlenose · GitHub (which is injected into the page as part of a larger ruby project).

The code handles seven types of snips: comment boxes, xml boxes, text boxes, numbers, racket boxes, splice boxes, and images. This has sufficed to handle basically anything in the *SL languages, though I'd imagine you can extend the code to handle other snips if you need it...

Also, note that CodeMirror doesn't have a Racket mode, just a Scheme mode, so e.g. #true and #false get rendered as #true and #false, and #;(...) doesn't give a faded-but-highlighted expression as it would in DrRacket.

4 Likes