On Sat, Feb 22, 2025 at 11:51 PM Nikolaos Chatzikonstantinou <nchatz...@gmail.com> wrote: > > On Mon, Dec 30, 2024 at 1:12 PM Ihor Radchenko <yanta...@posteo.net> wrote: > > > > Nikolaos Chatzikonstantinou <nchatz...@gmail.com> writes: > > > > > ... I got inspired by Worg's website > > > which does not do any backend hacking as far as I can tell, but > > > instead puts some javascript to collapse the table of contents. > > > > WORG does not use JS. The TOC is implemented using pure CSS. > > > > > Do you have a particular backend for me to look at as a recommendation > > > of an easy source? I don't want it to be derived because I want to > > > understand the whole process. > > > > Try ox-org. > > Hello Ihor, > > I'm still struggling with the basics of derived backends. Here's what > I have so far: > <https://github.com/createyourpersonalaccount/blorg/blob/main/blorg.el>. > > I am simply trying to transcode italic elements so that they're > treated differently on headers (with <i>) and in body (with <em>). How > can I accomplish this? My function is (straight from ox-html.el): > > #+begin_src elisp > (defun blorg-html-italic (_italic contents info) > "Transcode ITALIC from Org to HTML for a blog. > Italicize if in title, otherwise emphasize." > (format > (or (cdr (assq 'italic (plist-get info :html-text-markup-alist))) "%s") > contents)) > #+end_src > > I cannot tell what the three arguments _italic, contents, info are > for, even after reading the docs, and after inspecting them with > edebug. Do I need to understand Org ASTs? Do I need to understand > Org-publish better? I'm just at loss here.
I realized what the answer is: The contents variable is just a focus of the entire Org AST, as returned by org-element-parse-buffer, and the docs of that function are very helpful to understand what the format of contents is. Regards, Nikolaos Chatzikonstantinou