Skip to content

Instantly share code, notes, and snippets.

@tfidfwastaken
Last active July 30, 2020 09:48
Show Gist options
  • Save tfidfwastaken/29ade7eef652665ce20ccd5019a05714 to your computer and use it in GitHub Desktop.
Save tfidfwastaken/29ade7eef652665ce20ccd5019a05714 to your computer and use it in GitHub Desktop.
Previews the markdown text in DrRacket definitions editor in a web browser
#lang racket/base
(require racket/gui/base
racket/class
racket/path
net/sendurl
markdown
quickscript)
(define-script render-markdown
#:label "Preview Markdown"
#:help-string "Preview current markdown file in a web browser"
#:output-to message-box
(λ (selection #:definitions defs)
(define md-xexprs
(parse-markdown (send defs get-text)))
(send-url/contents (xexpr->string `(html
(head [title "Markdown Preview"])
(body ,@md-xexprs))))
#f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment