Skip to content

Commit

Permalink
docs: Add no IDE live preview
Browse files Browse the repository at this point in the history
Use sphinx-autobuild to implement live preview without requiring VSCode integration.
This allows previewing on save independent of IDE.

Signed-off-by: Nicolae Dicu <[email protected]>
  • Loading branch information
nicu1989 committed Feb 4, 2025
1 parent 4c5e976 commit 273c683
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Score supports multiple methods for generating documentation, tailored to differ
1. **Bazel-based builds** for clean, sandboxed outputs.
2. **Incremental builds** for quick iterations during development.
3. **IDE integration** for live previews, live warnings and even faster iterations.
4. **IDE independent live preview** for live previews of documentation without IDE integration.

### Bazel-based Build

Expand Down Expand Up @@ -64,22 +65,46 @@ point your IDE to the .venv_docs virtual environment.

Re-run //docs:ide_support if you update Sphinx extensions or other dependencies.

### IDE independent live preview

For a documentation live preview independent of an IDE (CLI + browser only), `sphinx-autobuild` can be used.

Create venv for docs:

```sh
bazel run //docs:ide_support
```

Activate the virtual environment:
```sh
source .venv_docs/bin/activate
```

Run sphinx autobuild:
```sh
sphinx-autobuild docs/ docs/_build/html --host 0.0.0.0
```

Go to: http://localhost:8000/

Now every time a doc is saved, the preview will be rebuilt.

### Testing

Use the following command to run all available tests:

```
$ bazel test //...
```
```

However it's also possible to run specific tests or set of tests.
However it's also possible to run specific tests or set of tests.

To run all tests of a certain language use the command below, here an example for python.
```
$ bazel query 'kind(py.*, tests(//...))' | xargs bazel tests
```

Grouping of tests via tags is also supported:
Grouping of tests via tags is also supported:
```
$ bazel test --test_tag_filters=docs-build
```
Expand Down
1 change: 1 addition & 0 deletions docs/_tooling/sphinx_extensions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ py_library(
deps = [
requirement("sphinx"),
requirement("sphinx-needs"),
requirement("sphinx-design"),
requirement("sphinxcontrib-plantuml"),
"//docs:score_metamodel",
],
Expand Down
1 change: 1 addition & 0 deletions docs/_tooling/sphinx_extensions/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
Sphinx==8.1.3
sphinx-needs==4.1.0
sphinxcontrib-plantuml==0.30
sphinx-autobuild==2024.10.3

0 comments on commit 273c683

Please sign in to comment.