-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 add basis for the docs (#421)
* feat: 🎸 add basis for the docs * ci: 🎡 fix the path * ci: 🎡 add delete doc comment workflow * chore: 🤖 add make preview for the docs * docs: ✏️ update the docs/ README * docs: ✏️ list of endpoints * docs: ✏️ write documentation * docs: ✏️ fix the format inside a "Tip" tag * Update docs/source/index.mdx Co-authored-by: Mario Šaško <mario@huggingface.co> * Apply suggestions from code review Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> Co-authored-by: Mario Šaško <mario@huggingface.co> * Apply suggestions from code review Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com> * docs: ✏️ Apply suggestions from code review * docs: ✏️ allow to click on the link in the examples * ci: 🎡 publish the doc to huggingface/doc-build Co-authored-by: Mario Šaško <mario@huggingface.co> Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
- Loading branch information
1 parent
f2f5706
commit 5860f15
Showing
15 changed files
with
976 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- doc-builder* | ||
- v*-release | ||
|
||
jobs: | ||
build: | ||
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main | ||
with: | ||
commit_sha: ${{ github.sha }} | ||
package: datasets-server | ||
additional_args: --not_python_module | ||
secrets: | ||
token: ${{ secrets.HUGGINGFACE_PUSH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Build PR Documentation | ||
|
||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main | ||
with: | ||
commit_sha: ${{ github.event.pull_request.head.sha }} | ||
pr_number: ${{ github.event.number }} | ||
package: datasets-server | ||
additional_args: --not_python_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Delete dev documentation | ||
|
||
on: | ||
pull_request: | ||
types: [ closed ] | ||
|
||
|
||
jobs: | ||
delete: | ||
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main | ||
with: | ||
pr_number: ${{ github.event.number }} | ||
package: datasets-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.9.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BUILD_DIR?=~/tmp/doc-datasets-server | ||
|
||
.PHONY: install | ||
install: | ||
poetry install | ||
|
||
.PHONY: build | ||
build: | ||
poetry run doc-builder build datasets-server source/ --build_dir $(BUILD_DIR) --not_python_module | ||
|
||
.PHONY: preview | ||
preview: | ||
poetry run doc-builder preview datasets-server source/ --not_python_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!--- | ||
Copyright 2022 The HuggingFace Team. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# Generate the documentation | ||
|
||
To generate the documentation, you first have to build it. Several packages are necessary to build the doc, | ||
you can install them with the following command, in this directory: | ||
|
||
```bash | ||
make install | ||
``` | ||
|
||
--- | ||
|
||
**NOTE** | ||
|
||
You only need to generate the documentation to inspect it locally (if you're planning changes and want to | ||
check how they look like before committing for instance). You don't have to commit the built documentation. | ||
|
||
--- | ||
|
||
## Preview the documentation | ||
|
||
Once you have setup the `doc-builder` and additional packages, you can preview the documentation by typing the | ||
following command: | ||
|
||
```bash | ||
make preview | ||
``` | ||
|
||
The documentation is available at http://localhost:3000/. | ||
|
||
## Build the documentation | ||
|
||
To build the documentation, launch: | ||
|
||
```bash | ||
BUILD_DIR=/tmp/doc-datasets-server/ make build | ||
``` | ||
|
||
You can adapt the `BUILD_DIR` environment variable to set any temporary folder that you prefer. This command will create it and generate | ||
the MDX files that will be rendered as the documentation on the main website. You can inspect them in your favorite | ||
Markdown editor. | ||
|
||
--- | ||
|
||
**NOTE** | ||
|
||
It's not possible to see locally how the final documentation will look like for now. Once you have opened a PR, you | ||
will see a bot add a comment to a link where the documentation with your changes lives. | ||
|
||
--- | ||
|
||
## Adding a new element to the navigation bar | ||
|
||
Accepted files are Markdown (.md or .mdx). | ||
|
||
Create a file with its extension and put it in the source directory. You can then link it to the toc-tree by putting | ||
the filename without the extension in the [`_toctree.yml`](https://github.com/huggingface/datasets-server/blob/main/docs/source/_toctree.yml) file. | ||
|
||
## Adding an image | ||
|
||
Due to the rapidly growing repository, it is important to make sure that no files that would significantly weigh down the repository are added. This includes images, videos and other non-text files. We prefer to leverage a hf.co hosted `dataset` like | ||
the ones hosted on [`hf-internal-testing`](https://huggingface.co/hf-internal-testing) in which to place these files and reference | ||
them by URL. We recommend putting them in the following dataset: [huggingface/documentation-images](https://huggingface.co/datasets/huggingface/documentation-images). | ||
If an external contribution, feel free to add the images to your PR and ask a Hugging Face member to migrate your images | ||
to this dataset. |
Oops, something went wrong.