Skip to content
Advertisement

How is the Tensorflow documentation created? (Especially the Jupyter notebook parts)

Here is an example page of the Tensorflow documentation: https://www.tensorflow.org/probability/examples/A_Tour_of_TensorFlow_Probability

Collapsible code cell Table of contents

Here is the source of that page: Link

How is the Jupyter notebook converted into the HTML website? I think the collapsible code blocks and the table of contents on the right look really nice. I want to do the same thing with my Jupyter notebooks (or at least get some inspiration).

I couldn’t find the script which converts the notebooks nor the CSS or template, which Tensorflow uses.

The “flag” which created the collapsible code cell is #@title Import { display-mode: "form" }, but I could not find reference for that.

Some ressources:

Description of the usage of the script which generates the API documentation: Link

There is tool called nbfmt, which can format notebook, but as I understand it can only update the code style, but does not convert it: Link

I’ve found _book.yaml and _index.yaml in some repositories, which might indicate bookdown.

Note that I’m not looking for an answer on how to create a collapsible code cell or a table of contents, but how Tensorflow did it. I know that there are already answers for the other two questions out there.

Thanks in advance!

Advertisement

Answer

As you’ve discovered, the tools the TF docs team use are all available on GitHub, including nbconvert, nbfmt, etc. There are also some localisation tools.

Mostly, the system works at the notebook -> markdown level, but it also generates reference docs for code -> html. These are all un-styled, “plain” content. Some YAML is also generated for navigation. In theory, these outputs can be published anywhere.

Once the content is generated, the hosting/publishing platform it’s served from is a proprietary system unfortunately. You can see the same system is used on developers.google.com, firebase.google.com, cloud.google.com, quantumai.google, developer.android.com and many more (check out the page layouts, custom HTML elements, etc), but it’s not available outside of Google.

If you have any specific questions about the tooling, you can find us over on GitHub in the tensorflow/docs repo. Feel free to ask, we’ll help if we can!

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement