Skip to content

Instantly share code, notes, and snippets.

@MatthewRalston
Created December 2, 2018 03:40
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 MatthewRalston/af689a65c0c9175b9cb7638e64ad6e7e to your computer and use it in GitHub Desktop.
Save MatthewRalston/af689a65c0c9175b9cb7638e64ad6e7e to your computer and use it in GitHub Desktop.
Add popover to HTML
;; Add this to your favorite html/jekyll configuration elisp file
;; Replace $IMG with the relative path to your websites image folder (e.g. img/)
(defun add-popover (link imagepath caption linktext)
"Generate an html popover.
-- Downloads an image file to your website/blog (etc.) image folder.
-- Generate a Bootstrap HTML popover link at the cursor position with caption.
"
(interactive "MImage link:\nFImagepath:\nMCaption:\nMLink text:\n")
(url-copy-file link imagepath)
(insert (concat (format "<a href=\"#\" title=\"%s\" data-toggle=\"popover\" data-placement=\"auto\" data-trigger=\"hover\" data-html=true data-content='<img src=\"$IMG/%s\""
caption (file-name-nondirectory imagepath))
" height=\"100%\" width=\"100%\" />'>"
linktext
"</a>")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment