org-ai icon indicating copy to clipboard operation
org-ai copied to clipboard

export of ai special blocks

Open titaniumbones opened this issue 2 years ago • 4 comments

I'd love to have ai special blocks export with some formatting, either for inclusion in blogs or just for sharing with friends in casual conversations. Do you already have thoughts about how to do that?

titaniumbones avatar Mar 20 '23 14:03 titaniumbones

I'll give it some thought. There are a number of ways to go about it. Defining something for every backend is out of my personal scope but I can provide some steps explaining how customizations can be made.

Out of the box markdown and html give special-blocks a separate div element and class such as:

<div class="ai" id="orgdb494e1">
...
</div>

LaTeX does

\begin{ai}
...
\end{ai}

So that's better than nothing but this can be improved no doubt.

rksm avatar Mar 20 '23 21:03 rksm

And any kind of contribution is of course very welcome!

rksm avatar Mar 20 '23 21:03 rksm

I did something yesterday with ox-confluence-en, like:

(defun org-confluence-en-special-block (special-block contents info)
  (let ((block-type (downcase (org-element-property :type special-block))))
    (if (member block-type '("ai" "note"))
        (org-confluence-en--block "text" "Confluence" (concat (upcase block-type) " " "Example") "true" contents))))

This outputs:

{toc}

{code:theme=Confluence|language=text|title=AI Example|collapse=true}
[SYS]: You are a helpful assistant. 

[AI]: Thank you! How may I assist you today? 
{code}

@titaniumbones hope this helps.

lroolle avatar Apr 14 '23 16:04 lroolle

Thank you, will look into it soon!

rksm avatar Apr 17 '23 02:04 rksm