Skip to content

Instantly share code, notes, and snippets.

@dg01d

dg01d/README.md

Created Feb 24, 2018
Embed
What would you like to do?
Micropub using emacs

Credits

This is just an amendment for hjertnes' script

Notes

  • The setting mb-domain should be set to the full path of the micropub endpoint.
  • I could not get this to work using form-encoded post format. If your endpoint does not support json-encoded posts, this will likely not work.
(require 'request)
(defun post2mb ()
(interactive)
(if (yes-or-no-p "Are you sure you want to post this?" )
(request
mb-domain
:type "POST"
:data (json-encode `((type . ["h-entry"]) (properties (content . [,(buffer-substring-no-properties (point-min) (point-max))]))))
:headers `(("Content-Type" . "application/json") ("Authorization".,(format "Bearer %s" mb-auth)))
:success (cl-function
(lambda (&key data &allow-other-keys)
(message "Success")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.