blob: 350b4584b2fe895e0c46701511dfad86d30d3d95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# publish-org-roam-ui
This action generates a static site for [org-roam-ui](https://github.com/org-roam/org-roam-ui) from [org-roam](https://www.orgroam.com/) 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.
```lisp
(setq org-roam-directory "/path/to/org-roam-dir")
(setq org-roam-db-location "/path/to/org-roam-dir/<org-roam-filename>.db")
```
```bash
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.
```yml
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
```
<img width="669" alt="generated artifact" src="https://github.com/ikoamu/publish-org-roam-ui/assets/38206334/fdc9f133-c97c-4d3b-b328-3a1d86560e83">
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_.
```yml
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.
```org
[[./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.
```yml
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)
```yml
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.
```yml
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.
<img width="840" alt="code highlighting screenshot" src="https://github.com/ikoamu/publish-org-roam-ui/assets/38206334/446d2575-8079-473f-a886-be2b2bec03be">
### Search feature
Search by title, tags, or content and instantly open a node.
<img width="533" alt="search screenshot" src="https://github.com/ikoamu/publish-org-roam-ui/assets/38206334/26f20ce8-1dbf-4377-bee2-fa14da7de105">
### 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.
```org
#+ATTR_HTML: :alt org-mode-unicorn :width 280px :align right
[[./img/org-mode-unicorn.svg]]
```
<img width="533" alt="HTML attributes example screenshot" src="https://github.com/ikoamu/publish-org-roam-ui/assets/38206334/75c32431-15c7-4fad-a019-039a3a2c6e4e">
## 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.
```bash
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
```
|