Kungsgeten / org-brain-export

Export org-brain to other formats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exporting org-brain

Kungsgeten opened this issue · comments

org-brain-export is a new package. Some people have asked me about export support for org-brain. It seems like people are working on different solutions, and I think that the same kind of stuff will need to be done in many of the solutions. Because of this org-brain-export can hopefully provide some common ground.

At the moment I've started with basic HTML and GraphViz dot export. Mostly since these have been the most requested formats in the org-brain repository discussions.

Thanks tried it quickly, with a small brain it worked, for .dot format I can recommend XDot.
https://github.com/jrfonseca/xdot.py

Regarding the html export it could support in future any background image and some javascript movable objects/names, which you could place on the background image map, those objects should be clickable, linking to the .org file on harddisk, ready to edit, for example.

Hi,

So I took a test. The export in "dot" gives this.

Org-brain simple example :

#+BRAIN_PARENTS: index

* Entry 3
  :PROPERTIES:
  :ID:       2076cb0a-3426-4043-a694-8ef0f97fb20e
  :CREATED:  <2020-01-10 ven. 16:45>
  :END:
* Entry 2
  :PROPERTIES:
  :ID:       68919660-1072-4807-9d0d-10821733be50
  :CREATED:  <2020-01-10 ven. 16:45>
  :END:
* Entry 1
  :PROPERTIES:
  :ID:       df25370c-25ea-4bbf-b1a0-b371482344a6
  :CREATED:  <2020-01-10 ven. 16:45>
  :END:
** Entry with special caracters like é or ç
   :PROPERTIES:
   :ID:       08fd52b6-c9b4-467d-9233-5682418bc331
   :CREATED:  <2020-01-10 ven. 16:51>
   :END:

Some content with some é and ç caracters. 

Export to dot.file

digraph G {
concentrate=true;
obChild%201 [label="Child 1"];
obChild%201 -> ob2076cb0a34264043a6948ef0f97fb20e;
obChild%201 -> ob68919660107248079d0d10821733be50;
obChild%201 -> obdf25370c25ea4bbfb1a0b371482344a6;
obChild%202 [label="Child 2"];
obChild%202 -> obd0fa6b37a6d04718acb41564e0cb9182;
obChild%202 -> ob3c48d62b10a64d70961f7ab1557c1998;
obChild%202 -> ob6bd7edf843cc482cbd613cd2dfd64e66;
obChild%203 [label="Child 3"];
obChild%203 -> ob2a922791f62d4554a7fab1921a3b656a;
obChild%203 -> ob4ecc398f2539460782dc8b9f8a7527d6;
obChild%203 -> obd5c2bbdb14604df4ae9ef18fe6977f73;
obindex [label="index"];
obindex -> obChild%201;
obindex -> obChild%202;
obindex -> obChild%203;
ob2076cb0a34264043a6948ef0f97fb20e [label="Entry 3"];
ob68919660107248079d0d10821733be50 [label="Entry 2"];
obdf25370c25ea4bbfb1a0b371482344a6 [label="Entry 1"];
obdf25370c25ea4bbfb1a0b371482344a6 -> ob08fd52b6c9b4467d92335682418bc331;
ob08fd52b6c9b4467d92335682418bc331 [label="Entry with special caracters like é or ç"];
obd0fa6b37a6d04718acb41564e0cb9182 [label="Entry 6"];
ob3c48d62b10a64d70961f7ab1557c1998 [label="Entry 5"];
ob6bd7edf843cc482cbd613cd2dfd64e66 [label="Entry 4"];
ob2a922791f62d4554a7fab1921a3b656a [label="Entry 9"];
ob4ecc398f2539460782dc8b9f8a7527d6 [label="Entry 8"];
obd5c2bbdb14604df4ae9ef18fe6977f73 [label="Entry 7"];
}

Result (with this tool)

image

The visible problems are as follows:

  • the "index" link to "obChild"
  • the node "svg" completely right

@bepolymathe Thanks for testing! What kind of entry is "Child 1" (I don't see it in your example)? It seems like a file entry. What is the name of the file? Could be the case that spaces in file names messes things up.

Hi,

"Child 1" is a child of "index" like that :

#+BRAIN_CHILDREN: Child%201 Child%202 Child%203

#+TITLE: index

I’ll try without space in name...

You’re right. Without space in file name, it’s better...
image
But "index" remains alone

By playing a little with the "friends" we get to things that are starting to become explicit.

image

I wonder if there would be a way to show the tags assigned to the headlines 🤔

URL's can be added like this as well:

org-brain [label="issues" URL="https://github.com/Kungsgeten/org-brain-export/issues/2"];

To convert into a clickable SVG which can be opened in the browser at least:
dot -Tsvg test.dot -o test.svg

Cool would be if we could run local scripts via clicks as well, not sure if this is possible, that would allow any triggering options you might want in future.

Yes and if you want identify node with active link (with color red for example).

org-brain [label="issues" URL="https://github.com/Kungsgeten/org-brain-export/issues/2" color="red"]

@michaelsjackson can you export to html my exemple ?

It would be neat if the HTML export could (perhaps as an option) include a clickable graph for every entry.

It would be neat if the HTML export could (perhaps as an option) include a clickable graph for every entry.

It would be even cooler if there were a way to make the in-Emacs graph clickable. :) Maybe, somehow, the clickable SVG/HTML could be parsed by Emacs, and then clicks on the image could be looked up based on that?

@alphapapa I haven't used images in Emacs much. Can a part of an image be clicked to trigger a function? I agree that it would be nice :)

@alphapapa do you think we could consider something based on org-graph-view ?

Please not, org-graph-view is not working in emacs-25.3, which I am using, then I could also not use org-brain's later versions, without any emacs update. I prefer the text view anyway, but could imagine liking an alternative clickable svg export of the graph, partially or even completely, in case I want to use it in some presentation.

I have been wondering whether it may be sensible to leverage something like mkdocs to export entire org-brains into a static website. Org-roam uses Hugo, but mkdoc already has a variety of plugins and themes and an apparently large community, and seems better suited to documentation or brain-dumps. Pandoc apparently converts a large number of org files to markdown very quickly - and that is an established workflow I guess, even if one were using Hugo like in org-roam. It would save the effort of bothering about CSS and appearance - and only focus on figuring out how the articles are linked as parent/friend etc during an export.

I think for example - a simple html export without search functionality and so on makes org-brain export significantly less useful.