syntax-highlighting
1 An Insecure Stopgap
highlight-code/  insecure
7.7

syntax-highlighting

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.

procedure

(highlight-code/insecure language    
  theme    
  code)  xexpr?
  language : symbol?
  theme : symbol?
  code : string?
This module highlights your code using http://markup.su/highlighter/api, 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 (R.app), pass it to this procedure as '|R Console (R.app)|.

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.