Skip to content

Commit 82f7144

Browse files
authored
[README] document notebook conversion (#480)
1 parent 7ef7d3a commit 82f7144

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is the package we use to build the documentation of our Hugging Face repos.
88
* [Installation](#installation)
99
* [Previewing](#previewing)
1010
* [Doc building](#doc-building)
11+
* [Writing in notebooks](#writing-in-notebooks)
1112
* [Templates for GitHub Actions](#templates-for-github-actions)
1213
+ [Enabling multilingual documentation](#enabling-multilingual-documentation)
1314
+ [Redirects](#redirects)
@@ -92,6 +93,21 @@ which will build HTML files in `~/tmp/test-build`. You can then inspect those fi
9293
- add `[[open-in-colab]]` in the tutorial for which you want to build a notebook
9394
- add `--notebook_dir {path_to_notebook_folder}` to the build command.
9495

96+
## Writing in notebooks
97+
98+
You can write your docs in jupyter notebooks & use doc-builder to: turn jupyter notebooks into mdx files.
99+
100+
In some situations, such as course & tutorials, it makes more sense to write in jupyter notebooks (& use doc-builder converter) rather than writing in mdx files directly.
101+
102+
The process is:
103+
1. In your `build_main_documentation.yml` & `build_pr_documentation.yml` enable the flag [convert_notebooks: true](https://github.com/huggingface/doc-builder/blob/main/.github/workflows/build_main_documentation.yml#L46-L48).
104+
2. After this flag is enabled, doc-builder will convert all .ipynb files in [path_to_docs](https://github.com/huggingface/doc-builder/blob/main/.github/workflows/build_main_documentation.yml#L19-L20) to mdx files.
105+
106+
Moreover, you can locally convert .ipynb files into mdx files.
107+
```bash
108+
doc-builder notebook-to-mdx {path to notebook file or folder containing notebook files}
109+
```
110+
95111
## Templates for GitHub Actions
96112

97113
`doc-builder` provides templates for GitHub Actions, so you can build your documentation with every pull request, push to some branch etc. To use them in your project, simply create the following three files in the `.github/workflows/` directory:

0 commit comments

Comments
 (0)