From 11535ac497344ae79476e8a7e8096d4cbb71319c Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 31 Mar 2023 12:01:36 -0700 Subject: [PATCH] New markdown prettifier * eldoc-box.el (eldoc-box-buffer-hook): Add new prettifier. (eldoc-box--remove-noise-chars): Remove carriage returns. --- eldoc-box.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eldoc-box.el b/eldoc-box.el index d87f2fc..0ccb422 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -177,6 +177,7 @@ It will be passes with two arguments: WIDTH and HEIGHT of the childframe.") (defvar eldoc-box-buffer-hook '(eldoc-box--prettify-markdown-separator eldoc-box--replace-en-space eldoc-box--remove-linked-images + eldoc-box--remove-noise-chars eldoc-box--fontify-html eldoc-box--condense-large-newline-gaps) "Hook run after buffer for doc is setup. @@ -705,6 +706,13 @@ height." nil t) (replace-match "")))) +(defun eldoc-box--remove-noise-chars () + "Remove some noise characters like carriage return." + (save-excursion + (goto-char (point-min)) + (while (search-forward "\r" nil t) + (replace-match "")))) + (defun eldoc-box--fontify-html () "Fontify HTML tags and special entities." (save-excursion