Skip to content

Instantly share code, notes, and snippets.

@nothingrealhappen
Created June 12, 2019 15:22
Show Gist options
  • Save nothingrealhappen/22f84c15b61f5e1cac1b22879a48825b to your computer and use it in GitHub Desktop.
Save nothingrealhappen/22f84c15b61f5e1cac1b22879a48825b to your computer and use it in GitHub Desktop.
Create amp-image shortcode by emacs shortcut
(defun insertAmpImage ()
(interactive)
(
let ((url (read-string "Enter url:")))
(message "detecting")
(insert
(apply 'format
(append
'("
#+begin_export html
{{%%amp-image layout=\"responsive\" src=%S alt=\"\" width=%S height=%S %%}}
#+end_export")
(append
(list url)
(split-string (shell-command-to-string (concat "identify -ping -format '%w %h' " url)))
)
)
)
)
(message "Done")
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment