mist – collaborative Markdown editor
Mist is an online collaborative Markdown editor, with comment support. Downside: documents live for 99 hours.
- author
- Matt Webb (https://interconnected.org)
- website
- mist
- github
- inanimate-tech/mist
- posts
curl https://mist.inanimate.tech/new -T file.md
md-publish-file function
Wrap that into md-publish-file Elisp function, interactively picking the file.
Here's an md-publish-file function that uploads a Markdown file to
mist:
(defun md-publish-file (file)
"Upload FILE to mist.inanimate.tech and return the URL.
Interactively, prompt for a Markdown file."
(interactive
(list (read-file-name "Markdown file to publish: "
nil nil t nil
(lambda (name)
(string-match-p "\\.md\\'" name)))))
(unless (file-exists-p file)
(user-error "File does not exist: %s" file))
(let* ((output (shell-command-to-string
(format "curl -s https://mist.inanimate.tech/new -T %s"
(shell-quote-argument (expand-file-name file)))))
(url (string-trim output)))
(if (string-match-p "^https://mist\\.inanimate\\.tech/" url)
(progn
(kill-new url)
(message "Published to: %s (copied to kill ring)" url)
url)
(error "Upload failed: %s" output))))
This function:
- Prompts for a
.mdfile interactively - Uploads it using
curl - Copies the URL to the kill ring
- Returns and displays the URL