diff options
author | Thanos Apollo <[email protected]> | 2024-06-27 14:19:05 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-06-27 14:19:05 +0300 |
commit | 4dd826c6d874f935a6df2062a24f52141ace9997 (patch) | |
tree | 03ccf5edf3171a5417a983ea80c38132a50e3b97 /gnosis.el | |
parent | 2cc330895f1a85844f36b73a54f98717cd8b4d79 (diff) |
Add gnosis-apply-overlays
Overlays to apply org-mode like highlighting
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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. |