@@ -64,6 +64,9 @@ excellent resources at https://www.rust-lang.org/learn, we recommend the
64
64
[ "Comprehensive Rust" mini-course] ( https://google.github.io/comprehensive-rust/ )
65
65
for an overview, especially if you are familiar with C++.
66
66
67
+ <!-- - TODO: A section asking for people to report documentation bugs and
68
+ ---- asking them to check if the problem exists in the prerelease docs.
69
+ ---->
67
70
68
71
## Setting up a development environment
69
72
@@ -131,7 +134,116 @@ These are listed roughly in order of decreasing importance.
131
134
use ` nextest ` with ` insta ` ,
132
135
use ` cargo insta test --workspace --test-runner nextest ` .
133
136
134
- ## Modifying protobuffers (this is not common)
137
+ ## Previewing the HTML documentation
138
+
139
+ The documentation for ` jj ` is automatically published to the website
140
+ < https://martinvonz.github.io/jj/ > . At the moment, this is experimental,
141
+ but we hope to advertise this website to our users soon.
142
+
143
+ When editing documentation, we'd appreciate it if you checked that the
144
+ result will look as expected when published to the website.
145
+
146
+ ### Prerequisites
147
+
148
+ To build the website, you must have Python and ` poetry ` installed. If
149
+ your distribution packages ` poetry ` , something like `apt install
150
+ python3-poetry` is likely the best way to install it. Otherwise, you
151
+ can download Python form < https://python.org > or follow the [ Python
152
+ installation instructions] . Finally, follow the [ Poetry installation
153
+ instructions] .
154
+
155
+ [ Python installation instructions ] : https://docs.python.org/3/using/index.html
156
+ [ Poetry installation instructions] : https://python-poetry.org/docs/#installation
157
+
158
+ Once you have ` poetry ` installed, it can install the rest of the required
159
+ tools into a virtual environment by running
160
+
161
+ poetry install
162
+
163
+ If you get messages about unlocking a keyring, try the following instead:
164
+
165
+ ``` shell
166
+ # https://github.com/python-poetry/poetry/issues/1917
167
+ PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring poetry install
168
+ ```
169
+
170
+ ### Building the HTML docs for one ` jj ` commit with live reload
171
+
172
+ The HTML docs are built with
173
+ [ MkDocs] ( https://github.com/mkdocs/mkdocs ) . After following the above
174
+ steps, you should be able to open the docs in your browser by running:
175
+
176
+ ``` shell
177
+ # Note: this and all the commands below should be run from the root of
178
+ # the `jj` source tree.
179
+ poetry run -- mkdocs serve
180
+ ```
181
+
182
+ and opening < https://128.0.0.1:8000 > in your browser.
183
+
184
+ As you edit the ` md ` files, the website should be rebuilt and reloaded
185
+ in your browser automatically unless build errors occur (which would
186
+ be reported in the terminal from which you ran ` mkdocs serve ` ).
187
+
188
+ ### How to build the entire website (not usually necessary)
189
+
190
+ The full ` jj ` website includes the documentation for several ` jj ` versions
191
+ (` prerelease ` , latest release, and the older releases). The top-level
192
+ URL < https://martinvonz.github.io/jj > is hardcoded to redirect to
193
+ < https://martinvonz.github.io/jj/latest > , which in turn redirects to
194
+ the docs for the last stable version.
195
+
196
+ The different versions of documentation are managed and deployed with
197
+ [ ` mike ` ] ( https://github.com/jimporter/mike ) , which can be run with
198
+ ` poetry run -- mike ` .
199
+
200
+ On a POSIX system, one way to build the entire website is as follows (on
201
+ Windows, you will have to understand the shell script and run the corresponding
202
+ commands):
203
+
204
+ 1 . Check out ` jj ` as a Git repository or a co-located ` jj + git ` repository
205
+ (` jj clone --colocate ` ), cloned from your fork of ` jj ` (e.g. ` jjfan.github.com/jj ` ).
206
+
207
+ 2 . Make sure ` jjfan.github.com/jj ` includes the ` gh-pages ` branch of the jj repo
208
+ and run ` git fetch origin gh-pages ` .
209
+
210
+ 3 . Go to the Github repository settings, enable Github Pages, and configure them
211
+ to use the ` gh-pages ` branch (this is usually the default).
212
+
213
+ 4 . Run the same ` sh ` script that is used in Github CI (details below):
214
+
215
+ ``` shell
216
+ .github/scripts/docs-build-deploy ' https://jjfan.github.io/jj/' \
217
+ prerelease main --push
218
+ ```
219
+
220
+ This should build the version of the docs from the current commit,
221
+ deploy it as a new commit to the ` gh-pages` branch,
222
+ and push the ` gh-pages` branch to the origin.
223
+
224
+ 5. Now, you should be able to see the full website, including your latest changes
225
+ to the ` prerelease` version, at ` https://jjfan.github.io/jj/prerelease/` .
226
+
227
+ 6. (Optional) When you are done, you may want to reset the ` gh-branches` to the same
228
+ spot as it is in the upstream. If you configured the ` upstream` remote and are in a
229
+ colocated repo, this can be done with:
230
+
231
+ ` ` ` shell
232
+ jj git fetch --remote upstream
233
+ jj branch set gh-pages -r gh-pages@upstream
234
+ jj git push --branch upstream
235
+ ` ` `
236
+
237
+ # ### Explanation of the `docs-build-deploy` script
238
+
239
+ The script sets up the ` site_url` mkdocs config to ' https://jjfan.github.io/jj/' . If this config
240
+ does not match the URL where you loaded the website, some minor website features
241
+ (like the version switching widget) will have reduced functionality.
242
+
243
+ Then, the script passes the rest of its arguments to ` potery run -- mike deploy` , which does
244
+ the rest of the job. Run ` poetry run -- mike help` to find out what the arguments do.
245
+
246
+ # # Modifying protobuffers (this is not common)
135
247
136
248
Occasionally, you may need to change the ` .proto` files that define jj' s data
137
249
storage format. In this case, you will need to add a few steps to the above
0 commit comments