Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[README] document notebook conversion #480

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This is the package we use to build the documentation of our Hugging Face repos.
* [Installation](#installation)
* [Previewing](#previewing)
* [Doc building](#doc-building)
* [Writing in notebooks](#writing-in-notebooks)
* [Templates for GitHub Actions](#templates-for-github-actions)
+ [Enabling multilingual documentation](#enabling-multilingual-documentation)
+ [Redirects](#redirects)
Expand Down Expand Up @@ -92,6 +93,21 @@ which will build HTML files in `~/tmp/test-build`. You can then inspect those fi
- add `[[open-in-colab]]` in the tutorial for which you want to build a notebook
- add `--notebook_dir {path_to_notebook_folder}` to the build command.

## Writing in notebooks

You can write your docs in jupyter notebooks & use doc-builder to: turn jupyter notebooks into mdx files.

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.

The process is:
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).
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.

Moreover, you can locally convert .ipynb files into mdx files.
```bash
doc-builder notebook-to-mdx {path to notebook file or folder containing notebook files}
```

## Templates for GitHub Actions

`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:
Expand Down
Loading