Add simple function to directly render html from a file

This is simpler than opening the file in a buffer and calling shr-render-buffer,
with some buffer maneuvring afterwards.
This commit is contained in:
Daniel - 2021-12-13 21:17:45 +01:00
parent cedaae00e8
commit eafebe1cb9
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,7 @@
(require 'calc-forms) (require 'calc-forms)
(require 'ert) (require 'ert)
(require 's) (require 's)
(require 'shr)
(autoload 'async-start "async") (autoload 'async-start "async")
(autoload 'lispy-mode "lispy") (autoload 'lispy-mode "lispy")
@ -454,6 +455,13 @@ Does not replace CRLF with CRCRLF, and so on."
(file-exists-p (concat project "/.git")))) (file-exists-p (concat project "/.git"))))
projectile-known-projects)))) projectile-known-projects))))
(defun db/shr-render-file (file)
"Display the HTML rending of the contents of FILE."
(interactive "f")
(unless (file-readable-p file)
(user-error "Cannot read file: %s" file))
(shr-render-buffer (find-file-noselect file)))
;; Base45 Decoding ;; Base45 Decoding