Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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%\" />'>"
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.