[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ellama b1467d15e0 1/7: Add function to convert org synt
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ellama b1467d15e0 1/7: Add function to convert org syntax to markdown |
Date: |
Fri, 29 Nov 2024 18:58:09 -0500 (EST) |
branch: externals/ellama
commit b1467d15e0e7b8d7c70e0c7baf476191ff0ff214
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>
Add function to convert org syntax to markdown
Added a new function `ellama-convert-org-to-md` that translates text
from org syntax to markdown syntax using Emacs Org Export
functionality. This function creates a temporary buffer, inserts the
provided org text, exports it to markdown, and returns the resulting
markdown string.
---
ellama.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ellama.el b/ellama.el
index 5bd5d8ecd2..a42faa5df8 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1545,6 +1545,22 @@ Extract profession from this message. Be short and
concise."
:transform (lambda (_ _)
"Provide short final answer based on final
solution.")))))
+(declare-function org-export-to-buffer "ox")
+
+(defun ellama-convert-org-to-md (text)
+ "Translate TEXT from org syntax to markdown syntax."
+ (require 'ox)
+ (require 'ox-md)
+ (let ((buf (make-temp-name "ellama-")))
+ (with-temp-buffer
+ (insert "#+OPTIONS: toc:nil\n" text)
+ (org-export-to-buffer 'md buf
+ nil nil t t nil (lambda () (text-mode))))
+ (with-current-buffer buf
+ (prog1
+ (string-trim (buffer-substring-no-properties (point-min) (point-max)))
+ (kill-buffer)))))
+
(defun ellama-chat-done (text &optional on-done)
"Chat done.
Will call `ellama-chat-done-callback' and ON-DONE on TEXT."
- [elpa] externals/ellama updated (7a714c9114 -> d4927093e2), ELPA Syncer, 2024/11/29
- [elpa] externals/ellama 6ecde6aa8b 5/7: Add display action functions for chat and instant modes, ELPA Syncer, 2024/11/29
- [elpa] externals/ellama 6abe8d46aa 3/7: Add functionality to send last user message, ELPA Syncer, 2024/11/29
- [elpa] externals/ellama a9c48d4416 2/7: Ensure user nick is present at the end of session buffer, ELPA Syncer, 2024/11/29
- [elpa] externals/ellama 1a3dd96d62 4/7: Add ellama-chat-send-last-message to documentation., ELPA Syncer, 2024/11/29
- [elpa] externals/ellama d4927093e2 7/7: Bump version, ELPA Syncer, 2024/11/29
- [elpa] externals/ellama d8e5659680 6/7: Merge pull request #184 from s-kostyaev/send-message-from-session-buffer, ELPA Syncer, 2024/11/29
- [elpa] externals/ellama b1467d15e0 1/7: Add function to convert org syntax to markdown,
ELPA Syncer <=