9. VSCode special filesο
9.1. Add filesο
Add the
.gitignorefile using the VSCode terminal. Run from within the project folder.
type nul > .gitignore
type nul > .readthedocs.yaml
Add the files below using the VSCode terminal. Run from within the docs folder.
type nul > requirements.txt
type nul > .gitignore
Add the
_templates/breadcrumbs.htmlfile using the VSCode terminal. Run from within the docs folder.
type nul > _templates/breadcrumbs.html
Tip
If using windows powershell as the terminal, adding files from the terminal can be done using the following:
ni filename
e.g. ni requirements.txt
9.2. docs/requirements.txtο
Use a requirements file
docs/requirements.txtto specify Sphinx and extensions to sphinx for read the docs.See: https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html
Use this text in the requirements file with specific version numbers if there is a reason for using specific versions:
As of Dec 2025, read the docs uses python 3.12.
sphinx
sphinx_rtd_theme
sphinx-copybutton
sphinx-design
sphinx-togglebutton
sphinx-new-tab-link
If the version numbers are left off, read the docs will fetch the latest version that is compatible with the version of python it is using.
There is no need to include explicitly docutils, since it will be taken care of along with the Sphinx requirement.
sphinx
sphinx_rtd_theme
sphinx-copybutton
# useful sphinx extensions
sphinx-design
sphinx-togglebutton
sphinx-new-tab-link
# for interactive jupyter
notebook
jupyter-sphinx
sphinx-thebe
9.3. docs/.readthedocs.yamlο
Use a config file
.readthedocs.yamlso that the requirements file can be used.Get the file contents from the main example at: https://docs.readthedocs.io/en/stable/config-file/v2.html
This sets some of the advanced settings for read the docs that would otherwise be accessed by Admin:Advance Settings in Read The Docs.
e.g the setting to Build PDF or ePub are controlled in the .yaml file.
9.4. docs/.gitignoreο
Use a
docs/.gitignorefile so that the build folder is ignored when pushing the docs to the github repo.Set the contents of the file
.gitignore:
_build
9.5. .gitignoreο
To prevent the .vscode folder from being pushed to GitHub, use a
.gitignorefile in the project folder.To release any .vscode files that may have been previously cached by git use in the VSCode terminal:
git rm -r --cached .vscode.Set the contents of the file
.gitignore:
**/.vscode
See https://git-scm.com/docs/gitignore for use of
.gitignore.
9.6. Fixing .gitignore that isnβt workingο
There could be several reasons why your .gitignore file is not working as expected such as Files already tracked by Git: .gitignore only ignores untracked files. If the files are already being tracked by Git, you need to remove them from the repository and add them back, this time respecting the rules in your .gitignore. You can do this with the following commands:
git rm -rf --cached .
git add .
9.8. Custom cssο
Add a folder
cssto the_staticfolder.
mkdir _static/css
Add a
custom cssfile containing any css that will override the theme css.
type nul > _static/css/custom.css
As per Custom css; add the code below to the
Options for html outputsection ofconf.pyfile to use the custom css.
html_css_files = ['css/custom.css']
See:
custom.css.This contains custom css including that used in these docs for inline reST and the copy button extension used for code blocks.
See more details at: https://docs.readthedocs.io/en/latest/guides/adding-custom-css.html
9.9. Custom logosο
Add a
logo.pngfile to the_staticfolder, with width <= 200 pixels. To save room, use a height <=50 pixels.>As per Custom logo; add the code below to the
Options for html outputsection ofconf.pyfile to use the custom logo.
html_logo = '_static/logo.png'
Add a
favicon.icofile to the_staticfolder, with size 32 x 32 pixels.As per Custom logo; add the code below to the
Options for html outputsection ofconf.pyfile to use the custom logo.
html_favicon = "_static/favicon.ico"