Package release: Org-Roam-UI

Thank you for releasing this @ThomasFKJorna

I really helps me interconnect and rediscover old notes that are now relevant again.

1 Like

Org-roam-ui is really neat! I’d love to be able to export it as an external website, so that I can share my notes with the world, brain-dump style. Is there a way to do that with org-roam-ui?

Edit: Paging @ThomasFKJorna. I imagine since org-roam-UI uses web technologies, it shouldn’t be that hard, right? What all would be needed to make that happen?

1 Like

Hi, has anybody succeeded in deploying org-roam-ui on a webserver?
I would be interested in running a small instancebehind a reverse proxy or by stripping out the Emacs interaction? Can anybody guide me on this?

Best regards and thanks!

Hi, if anybody is interested in this:

I added the capability to publish org-roam-ui 's content as a static HTML-page. The code can be found here. There are no changes that interfere with org-roam-ui 's core functionality.

As a very first prototype, I implemented the publishing as a two-step-process.

  1. Call M-x org-roam-ui-export and specify a temporary output directory (e.g. tmp ) to house the “raw” graph- and note-data as it will be used by next.js
  2. Run cd standalone && ./build-static-server /path/to/exported/dir/
    This patches org-roam-ui and builds a Docker container with all needed packages. This container is then used to create the static HTML export by calling yarn build and yarn export .

Afterwards, the directory ./standalone/out/ will contain the static version of your org-roam-data . You can scp it to your webserver directly and make it accessible to people as you are used to within your Emacs.

Best regards,
jgru

3 Likes

Looks great. Thanks

1 Like

Dear jgru,
Thanks a lot for your new point of view.

In order to test your functionality, I followed your posts.
01 : I downloaded org-roam-ui-add-export-capability first.
02 :To make org-roam-ui-export work, I changed the contents of
Copy the contents of add-export-capability into the .emacs.d org-roam-ui folder
to the org-roam-ui folder of .emacs.d.
03 : Now that M-x org-roam-ui export has been invoked
Create a new temporary output directory and copy the
exported the note-data file.

Now, I am not sure what to do from here.
Please tell me the procedure.
The second part of your procedure
Run cd standalone && . /build-static-server /path/to/exported/dir/
This patches org-roam-ui and builds a Docker container with all the needed packages.
This container is then used to create the static HTML export by calling yarn build and yarn export .

Q 01 :Where is the “standalone” folder or file?

In my environment, I have .emacs.d > elpa > 28.0 > develop >
org-roam-ui-20220225.2151 > standalone ( Folder ) > build-static-server.sh
This is the arrangement of the files.
I will “point” to this folder in the terminal, and then run
build-static-server.sh to be invoked.
Is that what you mean?
Specify this file, then && . /build-static-server.
sh file, but it did not work.

By the way, I am running Mac OS 10.14.6 Mojave with
I am using org-roam-ui from Spacemacs0.999.0@28.0.92 (Emacs 28.0.92).
I have installed yarn with homebrew in advance.
I have also updated node, a dependency package of yarn, to the latest version.
I have updated it to the latest version. We have also added the yarn-mode
package in spacemacs.

Q02 : The directory . /standalone/out/
Where is the “out” folder located?

Q03 : Where is the “dot” in front of “standalone” from?
Where is the “dot” in front of “standealone” from?

Thx and regards, WAKAMATSU

Hi Wakamatsu,

thanks for you message.

Please tell me the procedure.

Sure, I’ll try. It is a two-step process:

  1. Export to a temporary directory from within Emacs by running org-roam-ui-export. (Seems like you already did that)
  2. Drop into a shell and run the build-standalone-server.sh-script

In more detail:

  1. git clone https://github.com/jgru/org-roam-ui.git
  2. cd org-roam-ui && git checkout add-export-capability
  3. In Emacs: M-x find-file org-roam-ui/org-roam-ui.el and M-x eval-buffer to install the export-function
  4. M-x org-roam-ui-export and specify /tmp/export/ for example
  5. Back in your shell (at the root dir of the cloned repo):
    cd standalone && ./build-standalone-server.sh /tmp/export/
  6. Transfer the newly created directory called out to your webserver

Q 01 :Where is the “standalone” folder or file?

The standalone-directory is part of the branched git-repo. You can find it here. It contains the patches for the “hosting”-part of org-roam-ui.

Q02 : The directory . /standalone/out/

This will be created during running ./build-standalone-server.sh-script.
Pass the path to the temporary directory as a positional argument to this script.

Q03 : Where is the “dot” in front of “standalone” from?

I think this is alread answered by Q1. The dot refers to the root-dir of the branched git-repo.

After having exported to a temporary directory, run the script ./build-standalone-server.sh, which requires a working Docker, to build the webroot containing the static HTML.

If you do not want to use docker , then you can remove the part docker run -it -v $(pwd)/..:/usr/src/app orui-dev from https://github.com/jgru/org-roam-ui/blob/b7068518f52446e6fb4668c869706f04fde12381/standalone/build-standalone-server.sh#L22-L26.

I hope this clarification helps.

Best regards,
jgru

P.S.: org-noter-documents and bibliographic-notes are not working right now.

Dear jgru,
Thanks a lot for your guidance.
I am stuck on the problem.

Maybe I misunderstood in your more detail No.3.
In Emacs: M-x find-file org-roam-ui/org-roam-ui.el and M-x eval-buffer to install the export-function

This org-roam-ui.el’s location, I judge this el file on my
[ /Users/kuni7/.emacs.d/elpa/28.0/develop/org-roam-ui-20220225.2151/org-roam-ui.el], but your reliability of indication is in a git cloned folder
[/Users/kuni7/org-roam-ui/org-roam-ui.el] here ?
Q 01 : Which one is correct card or another??

Q 02 : How can I activate a docker daemon ?
Q 03 :How to transfer newly created directory call out to my webserver ?

I look forward to hearing from you at your earliest convenience.
Thx and regards, WAKAMATSU

P.S
$cd /Users/kuni7/org-roam-ui/standalone
kuni7: standalone $./build-standalone-server.sh /Users/kuni7/org-roam-ui-tmp-export
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
patch: **** rejecting file name with “…” component: …/pages/index.tsx
patch: **** rejecting file name with “…” component: …/util/uniorg.tsx
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See ‘docker run --help’.
patch: **** rejecting file name with “…” component: …/pages/index.tsx
patch: **** rejecting file name with “…” component: …/util/uniorg.tsx

$brew info docker
docker: stable 20.10.14, HEAD
/usr/local/Cellar/docker/20.10.14 (12 files, 55.9MB) *
Built from source on 2022-04-24 at 10:28:26
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d

Hi Wakamatsu,

Maybe I misunderstood in your more detail No.3.

Q 01 : Which one is correct card or another??

All filepaths given in my above answer are relative to the repo containing the extension/patches.
You need to eval the file containing the newly added
Correct isttherefore the linked file, which contains

(defun org-roam-ui-export ()
 ...)

(See here)

Q 02 : How can I activate a docker daemon ?

Follow the installation instructions given at the official website. Evetually, you need to run it with sudo-rights. Since I’m running Linux, I can’t provide any more help on this.

Q 03 :How to transfer newly created directory call out to my webserver ?

How did you previously transfer files to your webserver?
There are several options. You could use Emacs’ Tramp-mode or the utility scp:

scp -r org-roam-ui/standalone/out/ someuser@example.org:~

Hope this helps.

Best regards,
jgru

Dear jgru,
Under your tutelage it will evolve toward a fair percentage of half way.

Thanks a lot for your advisement.
After reinstall Docker.app via Homebrew (brew install --cask docker),
make it through, I hope.

standalone $./build-standalone-server.sh /Users/kuni7/org-roam-ui-tmp-export
[+] Building 58.6s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.5s
=> => transferring dockerfile: 245B 0.3s
=> [internal] load .dockerignore 0.4s
=> => transferring context: 2B
etc…etc…

Done in 326.81s.
yarn run v1.22.15
$ export NODE_OPTIONS=–openssl-legacy-provider && next export -o standalone/out/
info - Using webpack 5. Reason: Enabled by default webpack5 | Next.js
info - using build directory: /usr/src/app/build
info - Copying “static build” directory
info - No “exportPathMap” found in “next.config.js”. Generating map from “./pages”
info - Launching 1 workers
warn - Statically exporting a Next.js application via next export disables API routes.
This command is meant for static-only hosts, and is not necessary to make your application static.
Pages in your application without server-side data dependencies will be automatically statically exported by next build, including pages powered by getStaticProps.
Learn more: api-routes-static-export | Next.js
info - Copying “public” directory
info - Exporting (2/2)
Export successful. Files written to /usr/src/app/standalone/out
Done in 22.92s.
patch: **** rejecting file name with “…” component: …/pages/index.tsx
patch: **** rejecting file name with “…” component: …/util/uniorg.tsx

I will move on the next project with my webserver.
Pardon the brevity of this note.
Thx and regards, WAKAMATSU

P.S
At 75 years of age, understanding new things is not going as well as one might expect.
However, although it seems to be a tough field, being able to understand new types of linguistic expression.It is an interesting experience for a professional classical musician to be able to understand a new type of language expression, which is very refreshing and useful for the performance.

Good to read that you succeeded in using it.

Best regards,
jgru

Dear jgru,
Thanks a lot.
I have a question for exported files.
They do not have own file extension.

How can I get those files with their file extension ?
On your guidance
4. M-x org-roam-ui-export and specify /tmp/export/ for example
Could not I get with file extensions via org-roam-ui-export?
Thx and regards, WAKAMATSU
P.S
original files like those
org-roam-ui-original

Hi @WAKA,

the modification aims at strips out each node with its ID. (It’s not intended to serve as a one-to-one replica).

You could get the .org-extension by modifying those to lines to add a suffix:

Best regards,
jgru

Dear jgru,
Thanks a lot for your Infomations.
It is a good lesson for me.
I will learn what I should learn, but I should say progress gently.
I cannot tell you how thankful I am.

Faithfully, WAKAMATSU

Dear jgru,
I apologise for writing up all these ridiculous questions.
I make a thorough review of the points put forth by
org-roam-ui.el -------->>
L674 : (write-region content nil (concat notes-dir cid) 'append)))

uniorg.tsx.patch---------->>
L10 : + fetch(notes/${id})

The contents of the two files you gave me,
are exactly the same description as the one I was currently using.
I apologise for the rudimentary question.

[quote]
You could get the .org-extension by modifying those to lines to add a suffix:
This sentence I could not understand how should I add and which words?
(write-region content nil (concat notes-dir cid) 'append)))
[unquote]

For the L 674 sufiction from org-roam-ui.el,
do I simply change ‘nil’ to ‘t’?
What additions should be made to L10 in uniorg.tsx.patch, as you suggest?
What should I add to L10 in uniorg.tsx.patch?
Do you mean to write supplementary the file extensions “.md” and “.org” other than [id] here?
I think it is necessary to insert “;” or “,” etc. for multiple postscripts, but what (or which) should I use?
Respectfully, WAKAMATSU

Dear jgru,
Could you please share your wisdom with me?
This.
[[ Export one/multiple Org-Roam file with backlinks? - How To - Org-roam ]]
Export one/multiple Org-Roam file with backlinks?

What is the fundamental difference between exporting with org-roam-ui-export and exporting with org-roam-ui-export?
I am currently using org-hugo to check the context of files created with org-roam. I am trying to make context checking work for files created with org-roam.
Simply using ox-hugo would result in compiled files being
only stored in the ‘post’ folder.
If I can run the above py file.
"output_file = f “contents/posts/{path.with_suffix(’.md’).name}”
By changing the destination of contents/posts/ in
contents/basic/ or contents/memo/ or contents/One/ or
contents/Two/ etc. I think you can export to any folder you want.
I am wondering if it is possible to export to the folder I want?
I can build a virtual site using a static site generator other than hugo,
such as Jekyll or Gatsby, and check the screen on the localhost of the virtual site. I have not tried anything other than Hexo, Hugo and Sphinx yet.
I did not get to the point of building a site successfully with Jekyll.
This time, I decided to use hugo, which seems to be compatible with org-roam. Sorry for the long explanation.
Now, back to the story.
Where is the original aim of using org-roam-ui-export?
Forgive me if I do not understand the functionality of this org-roam-ui-export.
If you do not mind my asking, what was your ‘goal’ when you created this functionality? I would be very grateful if you could explain in more detail.
Faithfully, WAKAMATSU

Hi @WAKA,

this patch serves only one purpose: Visualize your org-roam-ui-graph interactively on a remote and exposed webserver – nothing more and nothing less. It is not intended for end-users. I linked to it because other tinkerers requested similar functionality on various place.
I certainly think you are better off with an end-user oriented solution like ox-hugo. (I have not used that myself, however)

Best regards,
jgru

Dear Dear jgru,
Thanks a lor for your intelligible answer.
I will be in touch with your regarding the study of org-roam-ui-export.
You taught me something!
I appreciate your continued support.
Respectfully, WAKAMATSU

Dear jgru,
If you do not mind, please tell me about the following two points.
Q01 : Is the org-roam-ui.el L674 ‘nil’ to ‘t’?
Q02 : Which linux distribution are you using to
org-roam-ui-export?
Respectfully, WAKAMATSU
P.S
Are you using Nix or ArchLinux or another Linux?

Hello WAKA,

Q01 : Is the org-roam-ui.el L674 ‘nil’ to ‘t’?

This parameter corresponds to END is ignored since START is a string. Setting it to nil is intentional and “correct”. Refer to the documentation at Writing to Files (GNU Emacs Lisp Reference Manual)

Q02 : Which linux distribution are you using to
org-roam-ui-export?

Plain debian. This funciton does not contain any OS- or distro-specific code.

Best regards,
jgru