Skip to content

Commit 7d45f58

Browse files
authored
docs: add version specification and notebook conversion instructions to README (#665)
1 parent 17f15e4 commit 7d45f58

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ doc-builder build datasets ~/git/datasets/docs/source --build_dir ~/tmp/test-bui
9494
```
9595
which will build HTML files in `~/tmp/test-build`. You can then inspect those files in your browser.
9696

97+
### Specifying a version
98+
99+
By default, `doc-builder` automatically determines the version:
100+
- For **Python modules**: uses the package's `__version__` attribute (or `main` for dev versions)
101+
- For **non-Python modules** (with `--not_python_module`): uses the default branch name (typically `main`)
102+
103+
You can override this behavior with the `--version` flag:
104+
105+
```bash
106+
# Build documentation for a specific semantic version (must start with "v")
107+
doc-builder build transformers ~/git/transformers/docs/source --build_dir ~/tmp/test-build --version v4.30.0
108+
109+
# Build documentation for the default branch (non-Python modules)
110+
doc-builder build hub ~/git/hub-docs/docs/source --build_dir ~/tmp/test-build --not_python_module --version main
111+
```
112+
113+
**Important**: When specifying a semantic version with `--version`, it **must start with the letter "v"** (e.g., `v1.0.0`, `v2.3.1`). For branch names like `main`, `master`, or other default branches, the "v" prefix is not required.
114+
115+
### Notebook conversion
116+
97117
`doc-builder` can also automatically convert some of the documentation guides or tutorials into notebooks. This requires two steps:
98118
- add `[[open-in-colab]]` in the tutorial for which you want to build a notebook
99119
- add `--notebook_dir {path_to_notebook_folder}` to the build command.

0 commit comments

Comments
 (0)