From 4dd826c6d874f935a6df2062a24f52141ace9997 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 27 Jun 2024 14:19:05 +0300 Subject: Add gnosis-apply-overlays Overlays to apply org-mode like highlighting --- gnosis.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gnosis.el b/gnosis.el index bd80a83..137d00e 100644 --- a/gnosis.el +++ b/gnosis.el @@ -319,6 +319,22 @@ History is disabled." (overlay-put overlay 'face 'gnosis-face-separator) (overlay-put overlay 'display (make-string width ?\s)))))) +(defun gnosis-apply-overlays () + "Apply custom font overlays for syntax highlighting." + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\*\\([^*]+\\)\\*" nil t) + (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'bold)) + (goto-char (point-min)) + (while (re-search-forward "/\\([^/]+\\)/" nil t) + (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'italic)) + (goto-char (point-min)) + (while (re-search-forward "=\\([^=]+\\)=" nil t) + (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'font-lock-constant-face)) + (goto-char (point-min)) + (while (re-search-forward "~\\([^~]+\\)~" nil t) + (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'face 'font-lock-keyword-face)))) + (defun gnosis-display-question (id &optional fill-paragraph-p) "Display main row for note ID. -- cgit v1.2.3