Generates a static site for org-roam-ui from org-roam files managed on GitHub. And it is easy to publish to GitHub Pages. https://ikoamu.github.io/publish-org-roam-ui/
  • JavaScript 77.2%
  • Shell 22.8%
Find a file
Shotaro Aoki 23fbb1f5cb
Merge pull request #30 from ikoamu/default-section-open
doc: add default-section-open
2024-10-13 20:07:36 +09:00
.github/workflows Remove unnecessary step in workflow 2024-03-16 20:46:44 +09:00
example update document 2024-04-07 20:08:01 +09:00
.gitignore Build the index and copy it next to the search data 2024-09-15 14:52:30 +02:00
action.yml fix: .env setting 2024-09-28 21:54:19 +09:00
build-index.js Build the index and copy it next to the search data 2024-09-15 14:52:30 +02:00
create_notes.sh support no-timestamp file 2024-04-04 08:48:27 +09:00
generate_graphdata.js add cite links 2024-06-30 16:37:39 +09:00
generate_searchdata.mjs feat generate searchdata script 2024-04-07 19:42:59 +09:00
LICENSE Create LICENSE 2024-03-24 03:33:51 +09:00
local.sh feat: Add .env file with default section open flag(local.sh) 2024-10-03 23:18:23 +09:00
package-lock.json Update package version to 1.5.0 2024-10-13 19:58:34 +09:00
package.json Update package version to 1.5.0 2024-10-13 19:58:34 +09:00
README.md doc: add default-section-open 2024-10-13 20:06:44 +09:00

publish-org-roam-ui

This action generates a static site for org-roam-ui from org-roam files managed on GitHub.

It also allows deployment to GitHub Pages. (See https://ikoamu.github.io/publish-org-roam-ui/)

By using this, you can easily publish your org-roam as a digital garden 🌱

How to Use

First, please manage the .org files in org-roam-directory and the db file in org-roam using git.

(setq org-roam-directory "/path/to/org-roam-dir")
(setq org-roam-db-location "/path/to/org-roam-dir/<org-roam-filename>.db")
cd /path/to/org-roam-dir/
git init

Then, a static org-roam-ui site is easily generated for the artifact by creating a workflow like the following.

name: Generate static org-roam-ui page
on:
  push:
    branches:
      - main
jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Generate org-roam-ui page
        uses: ikoamu/publish-org-roam-ui@main
        with:
          org-roam-db-filename: <org-roam-filename>.db
generated artifact

Deploy to GitHub Pages by setting deploy-to-pages to true. And sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.

Under the repositories Settings > GitHub Pages select Deply from Action.

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Generate org-roam-ui page
        uses: ikoamu/publish-org-roam-ui@main
        with:
          org-roam-db-filename: <org-roam-filename>.db
          deploy-to-pages: true

Show Image

You can create an img directory directly under the repository and display image files stored there.

[[./img/test.png]]

Store org files in subdirectory

Set org-roam-directory to store org files in a subdirectory instead of directly under the repository.

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Generate org-roam-ui page
        uses: ikoamu/publish-org-roam-ui@main
        with:
          org-roam-directory: org-files
          org-roam-db-filename: org-roam.db
YourRepository
├── .github/workflows
├── org-files
│   ├── img
│   │   ├── img1.png
│   │   └── img2.png
│   ├── org-roam.db
│   ├── roam1.org
│   ├── roam2.org
│   └── ・・・
├── README.org
└── ・・・

Setting site tile

You can change the title of the site by specifying site-tile. (The default is ORUI)

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Generate org-roam-ui page
        uses: ikoamu/publish-org-roam-ui@main
        with:
          org-roam-db-filename: <org-roam-filename>.db
          site-title: my org-roam!

Default section open

Sections can be kept closed during initial display.

jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - name: Generate org-roam-ui page
        uses: ikoamu/publish-org-roam-ui@main
        with:
          org-roam-db-filename: <org-roam-filename>.db
          default-section-open: false

Customized org-roam-ui

Sites generated by publish-org-roam-ui have additional features implemented that are not in the original org-roam-ui.

Code highlighting

Sites generated by publish-org-roam will have code blocks highlighted.

code highlighting screenshot

Search feature

Search by title, tags, or content and instantly open a node.

search screenshot

Support #+ATTR_HTML keyword in images

By writing the #+ATTR_HTML keyword for an image, it will be set as HTML attributes for the <img> tag.

#+ATTR_HTML: :alt org-mode-unicorn :width 280px :align right
[[./img/org-mode-unicorn.svg]]
HTML attributes example screenshot

Local Build

If you don't want to upload org files to the repository, you can obtain the same site as generated by GitHub Actions by running the site generation script locally.

git clone git@github.com:ikoamu/publish-org-roam-ui.git
cd publish-org-roam-ui
./local.sh /path/to/org-roam-dir <org-roam-filename>.db