1 An Insecure Stopgap
highlight-code/  insecure


Sage Gerard

This collection is for general-purpose syntax highlighting in Racket. This project is incomplete. If you wish to fast track development, please consider supporting it.

1 An Insecure Stopgap

 (require syntax-highlighting/lusever)
  package: syntax-highlighting

Syntax highlighting is a hard problem. Right now, there’s no pure-Racket solution for it. You can either install a seperate app, or use this quick and very... very dirty module. I do not endorse this module for widespread use. I only provide it for those who understand and accept the risks discussed below.


(highlight-code/insecure language    
  code)  xexpr?
  language : symbol?
  theme : symbol?
  code : string?
This module highlights your code using, by lusever. Go to the former link to see accepted values for language and theme. The procedure will return an X-expression representing an HTML pre element, with inline styles applied to code according to the theme you select.

If you see a value with spaces and special characters like R Console (, pass it to this procedure as '|R Console (|.

BEWARE: Do NOT pass anything you do not want shared to this procedure! The service only uses HTTP, so whatever you send is clear text.

Obviously, this procedure only works online. If it fails to highlight your code, it will return said code in a pre element, but without any styles.