Skip to content

Instantly share code, notes, and snippets.

@Metaxal
Created November 23, 2021 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Metaxal/4755dff3f47d76f616736d5abf83e810 to your computer and use it in GitHub Desktop.
Save Metaxal/4755dff3f47d76f616736d5abf83e810 to your computer and use it in GitHub Desktop.
Renders the current markdown file as HTML in the browser (quickscript)
#lang racket/base
;;; Author: Laurent Orseau https://github.com/Metaxal
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
;;; Requires `commonmark`
(require quickscript
commonmark
net/sendurl
racket/file)
(script-help-string "Renders the current markdown file as HTML in the browser")
(define-script commonmark-render
#:label "CommonMark render (opens browser)"
(λ (selection #:file f)
(send-url/contents (document->html (string->document (file->string f))))
#f))
(module url2script-info racket/base
(provide filename url)
(define filename "commonmark-render.rkt")
(define url "https://gist.github.com/Metaxal/4755dff3f47d76f616736d5abf83e810"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment