Skip to content

Commit e51b1ad

Browse files
committed
Add :html target
1 parent 815164a commit e51b1ad

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

docs.bzl

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,23 @@ def docs(source_dir = "docs", data = [], deps = []):
137137
data = data,
138138
)
139139

140-
sphinx_docs(
141-
name = "needs_json",
142-
srcs = [":docs_sources"],
143-
config = ":" + source_dir + "/conf.py",
144-
extra_opts = [
145-
"-W",
146-
"--keep-going",
147-
"-T", # show more details in case of errors
148-
"--jobs",
149-
"auto",
150-
"--define=external_needs_source=" + str(data),
151-
],
152-
formats = ["needs"],
153-
sphinx = ":sphinx_build",
154-
tools = data,
155-
visibility = ["//visibility:public"],
156-
)
140+
# Create sphinx_docs targets for different output formats
141+
formats = {"needs_json": "needs", "html": "html"}
142+
for target_name, format_type in formats.items():
143+
sphinx_docs(
144+
name = target_name,
145+
srcs = [":docs_sources"],
146+
config = ":" + source_dir + "/conf.py",
147+
extra_opts = [
148+
"-W",
149+
"--keep-going",
150+
"-T", # show more details in case of errors
151+
"--jobs",
152+
"auto",
153+
"--define=external_needs_source=" + str(data),
154+
],
155+
formats = [format_type],
156+
sphinx = ":sphinx_build",
157+
tools = data,
158+
visibility = ["//visibility:public"],
159+
)

docs/how-to/commands.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
| Target | What it does |
66
| --------------------------- | ---------------------------------------------------------------------- |
7-
| `bazel run //:docs` | Builds documentation |
7+
| `bazel build //:html` | Builds documentation in Bazel sandbox |
8+
| `bazel run //:docs` | Builds documentation outside of Bazel |
89
| `bazel run //:live_preview` | Creates a live_preview of the documentation viewable in a local server |
910
| `bazel run //:ide_support` | Sets up a Python venv for esbonio (Remember to restart VS Code!) |
1011

1112
## Internal targets (do not use directly)
1213

13-
| Target | What it does |
14-
| --------------------------- | --------------------------- |
15-
| `bazel build //:needs_json` | Creates a 'needs.json' file |
14+
| Target | What it does |
15+
| ----------------------------- | --------------------------- |
16+
| `bazel build //:needs_json` | Creates a 'needs.json' file |
17+
| `bazel build //:docs_sources` | Sources like rst files |

0 commit comments

Comments
 (0)