eyeinsky / org-anki

Sync org notes to Anki via AnkiConnect
BSD 3-Clause "New" or "Revised" License
180 stars 28 forks source link

add custom variable for org-export-string-as #72

Open basaran opened 1 year ago

basaran commented 1 year ago

Hello,

I made some other adjustments to your package, to allow displaying org-babel blocks wrapped around some additional html markup. Would you consider a pull request?

We can add a defcustom and patch in your --org-to-html.

(defcustom org-anki-html-export-backend 'html
  "Backend used for transcoding HTML. See org-export-string-as for
more information"
  :type '(function)
  :group 'org-anki)

(defun org-anki--org-to-html (string)
  "Convert STRING (org element heading or content) to html."
  (save-excursion
    (org-anki--string-to-anki-mathjax
     (org-export-string-as string org-anki-html-export-backend t '(:with-toc nil)))))

This is the end result: image

This is the source from emacs: image

eyeinsky commented 1 year ago

Hmm, perhaps the entire org-anki--org-to-html could be customized (replaced by the user)? So if somebody wants a different org-babel backend then that would continue to work, but if somebody wants a totally custom function, then that would work too.

eyeinsky commented 1 year ago

Yes, PR welcome! :)