# Any way to convert .rkt file to HTML?

**URL:** <https://racket.discourse.group/t/any-way-to-convert-rkt-file-to-html/3460>\
**Category:** Questions & Answers\
**Created:** [January 3, 2025, 8:56pm UTC](https://racket.discourse.group/t/any-way-to-convert-rkt-file-to-html/3460 "2025-01-03T20:56:39Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![blerner](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@blerner](https://racket.discourse.group/u/blerner)\
**Post date:** [January 3, 2025, 11:12pm UTC](https://racket.discourse.group/t/any-way-to-convert-rkt-file-to-html/3460/8 "2025-01-03T23:12:16Z")

</div>

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](https://github.com/CodeGrade/bottlenose/blob/master/lib/assets/render-racket.rkt) 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](https://github.com/CodeGrade/bottlenose/blob/master/app/views/submissions/_render_embedded_images.js.erb) (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 `#t`rue and `#f`alse, and `#;(...)` doesn't give a faded-but-highlighted expression as it would in DrRacket.

---

_[View the full topic](https://racket.discourse.group/t/any-way-to-convert-rkt-file-to-html/3460)._
