Gave preformatted text its own configurable face.
[elpher.git] / elpher.el
index e508c61..ca076d0 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -4,7 +4,7 @@
 
 ;; Author: Tim Vaughan <plugd@thelambdalab.xyz>
 ;; Created: 11 April 2019
-;; Version: 2.7.5
+;; Version: 2.7.6
 ;; Keywords: comm gopher
 ;; Homepage: http://thelambdalab.xyz/elpher
 ;; Package-Requires: ((emacs "26"))
@@ -70,7 +70,7 @@
 ;;; Global constants
 ;;
 
-(defconst elpher-version "2.7.5"
+(defconst elpher-version "2.7.6"
   "Current version of elpher.")
 
 (defconst elpher-margin-width 6
@@ -222,6 +222,10 @@ the time when the text is rendered."
   '((t :inherit bold :height 1.2))
   "Face used for gemini heading level 3.")
 
+(defface elpher-gemini-preformatted
+  '((t :inherit fixed-pitch))
+  "Face used for pre-formatted gemini text blocks.")
+
 ;;; Model
 ;;
 
@@ -1151,7 +1155,9 @@ by HEADER-LINE."
      (dolist (line (split-string data "\n"))
        (cond
         ((string-prefix-p "```" line) (setq preformatted (not preformatted)))
-        (preformatted (insert (elpher-process-text-for-display line) "\n"))
+        (preformatted (insert (elpher-process-text-for-display
+                               (propertize line 'face 'elpher-gemini-preformatted))
+                              "\n"))
         ((string-prefix-p "=>" line) (elpher-gemini-insert-link line))
         ((string-prefix-p "#" line) (elpher-gemini-insert-header line))
         (t (insert (elpher-process-text-for-display line)) (newline)))))