emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/denote-refs 36fbf22f85 3/9: Support Markdown notes


From: ELPA Syncer
Subject: [nongnu] elpa/denote-refs 36fbf22f85 3/9: Support Markdown notes
Date: Mon, 19 Dec 2022 14:59:00 -0500 (EST)

branch: elpa/denote-refs
commit 36fbf22f85a5d130ba147e950711348b1bf4e280
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Support Markdown notes
    
    * denote-refs.el (denote-refs--render): Support
    'markdown-mode'.
---
 denote-refs.el | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/denote-refs.el b/denote-refs.el
index dc58ac0cd6..a71fe2eda4 100644
--- a/denote-refs.el
+++ b/denote-refs.el
@@ -112,7 +112,36 @@ the key is the absolute path.")
                           'action (lambda (_)
                                     (funcall denote-link-button-action
                                              (cdr ref))))
-           (insert ?\n)))))))
+           (insert ?\n))))
+      ('markdown-mode
+       ;; Insert references count.
+       (insert (if (eq refs 'not-ready)
+                   (format "<!-- ... %s -->\n" (if (eq section 'links)
+                                                   "links"
+                                                 "backlinks"))
+                 (format "<!-- %i %s%s\n" (length refs)
+                         (if (eq section 'links)
+                             "link"
+                           "backlink")
+                         (pcase (length refs)
+                           (0 " -->")
+                           (1 ":")
+                           (_ "s:")))))
+       ;; Insert reference list.
+       (when (listp refs)
+         (while refs
+           (let ((ref (pop refs)))
+             (insert "  ")
+             (insert-button
+              (car ref)
+              'help-echo (cdr ref)
+              'face 'denote-faces-link
+              'action (lambda (_)
+                        (funcall denote-link-button-action
+                                 (cdr ref))))
+             (unless refs
+               (insert " -->"))
+             (insert ?\n))))))))
 
 (defun denote-refs--goto-end-of-front-matter ()
   "Go to the end of front matter of the note."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]