Last active
July 30, 2020 09:48
-
-
Save tfidfwastaken/29ade7eef652665ce20ccd5019a05714 to your computer and use it in GitHub Desktop.
Previews the markdown text in DrRacket definitions editor in a web browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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