From 931f38989eff3d8ecc09aa030d2d6ee1aade883d Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 28 Mar 2020 11:50:44 -0700 Subject: Improve shr rendering of and
 tags a little

---
 oni-shr.el | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'oni-shr.el')

diff --git a/oni-shr.el b/oni-shr.el
index 3537fb1..9bc2dfd 100644
--- a/oni-shr.el
+++ b/oni-shr.el
@@ -4,7 +4,7 @@
 
 ;; Author: Tom Willemse 
 ;; Keywords: local
-;; Version: 2019.0904.210815
+;; Version: 2020.0328.023508
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -33,8 +33,29 @@
       (butlast args)
     args))
 
+(defun shr-tag-code (dom)
+  "Render a  tag from DOM."
+  (let ((shr-current-font 'default)
+        (start (point)))
+    (shr-generic dom)
+    (add-face-text-property start (point) '(:background "#222222" :box (:line-width 3 :color "#222222")))))
+
+(defun oni-shr--recolorize (orig-fun &rest args)
+  "Do some custom colorization.
+
+This should be used with ‘add-function’ with the ‘:around’
+combinator. ORIG-FUN is the original function being wrapped, ARGS
+are the arguments passed in to it."
+  (let ((start (point)))
+    (apply orig-fun args)
+    (save-excursion
+      (forward-line -1)
+      (string-rectangle start (point) "  "))
+    (add-face-text-property start (point) '(:background "#222222"))))
+
 (advice-add #'shr-colorize-region
-	    :filter-args #'oni-shr--colorize-remove-last-arg)
+	        :filter-args #'oni-shr--colorize-remove-last-arg)
+(add-function :around (symbol-function 'shr-tag-pre) #'oni-shr--recolorize)
 
 ;;;###autoload(with-eval-after-load 'shr (require 'oni-shr))
 
-- 
cgit v1.2.3-54-g00ecf