From 20e17bc52575018c31b3c3d48e3de8cf81a8a7d7 Mon Sep 17 00:00:00 2001 From: rperesso <romain.peressoni@inria.fr> Date: Thu, 23 Feb 2023 10:10:01 +0100 Subject: [PATCH] compose-publish.el: added color link --- compose-publish.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compose-publish.el b/compose-publish.el index b8fba36..fbbe016 100644 --- a/compose-publish.el +++ b/compose-publish.el @@ -170,6 +170,23 @@ undesirable behavior." (prefix-all-lines "#+HTML_HEAD_EXTRA: " body) "\n#+HTML_HEAD_EXTRA: \\)</div>\n")) +;; To include easy color links in org-mode +;; now simply use [[color:red][text to be in red]] +;; https://orgmode.org/worg/org-faq.html#org64ae339 +(org-add-link-type + "color" + (lambda (path) + (message (concat "color " + (progn (add-text-properties + 0 (length path) + (list 'face `((t (:foreground ,path)))) + path) path)))) + (lambda (path desc format) + (cond + ((eq format 'html) + (format "<span style=\"color:%s;\">%s</span>" path desc)) + ((eq format 'latex) + (format "{\\color{%s}%s}" path desc))))) ;; fullpath from relative path ;; http://xahlee.info/emacs/emacs/elisp_relative_path.html -- GitLab