Skip to content

Commit 60b92fe

Browse files
committed
Update docs
1 parent f9ac059 commit 60b92fe

10 files changed

+82
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
_build
22
.venv
3+
.DS_Store
4+
*.egg-info
35
sphinx_venv
46
*.pyc

docs/.DS_Store

0 Bytes
Binary file not shown.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"sphinx.ext.githubpages", # used for hosting on GitHub Pages
3030
"sphinx.ext.todo",
3131
"autoapi.extension",
32+
"sphinx.ext.autosectionlabel",
3233
"sphinx.ext.autodoc",
3334
"sphinx.ext.napoleon",
3435
"sphinx_copybutton", # adds a copy button to source code blocks

docs/guides/.DS_Store

0 Bytes
Binary file not shown.

docs/guides/guide_installation.rst

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,47 @@ Clone the `sphinx-documentation-demo <https://github.com/bioteam/sphinx-document
1919
2020
2. Installing Sphinx
2121
---------------------------------
22-
Sphinx, and extensions for Sphinx, are *python packages* that can be installed on your computer.
23-
The packages you need to install are in :code:`requirements.txt` in the :code:`sphinx-documentation-demo` repository.
22+
Sphinx and its extensions are *python packages* that can be installed.
23+
The packages you need to install are in :code:`pyproject.toml` located in the :code:`sphinx-documentation-demo` repository.
2424
It's a good idea to install them in a **virtual environment**.
2525

2626

2727

28-
2a. Using :code:`venv` to install
28+
2a. Using :code:`install.sh` to install
2929
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30+
The :code:`install.sh` script can be used to create a new python environment and install the scripts needed for Sphinx to function.
31+
While in the :code:`sphinx-documentation-demo` directory, run:
3032

3133
.. code-block:: bash
3234
33-
python -m venv sphinx_venv
34-
source sphinx_venv/bin/activate
35-
pip install -r requirements.txt
35+
bash install.sh
3636
37+
This will create a **hidden** environment folder :code:`.env` and install the packages located in :code:`pyproject.toml`.
3738

39+
2b. Activating environment using :code:`source.sh`
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
After using :code:`install.sh`, or **whenever you open a new command terminal**, make sure that you **activate** the environment by running the following command while in the :code:`sphinx-documentation-demo` directory:
42+
.. _My target:
3843

39-
3. Building Documentation
40-
-------------------------
44+
.. code-block:: bash
45+
46+
source source.sh
47+
48+
If successful, you should have :code:`(.env)` inserted at the beginning of your command prompt.
49+
50+
51+
3. Building Documentation on your Laptop
52+
----------------------------------------
53+
The :code:`docs/` folder in the :code:`sphinx-documentation-demo` project contains the .rst files that we will compile into a static webpage.
54+
You can either run :code:`sphinx-build` (see section 3a) or :code:`sphinx-autobuild` (see section 3b).
55+
56+
.. warning::
57+
58+
Make sure you have activated your python virtual environment before using either option.
59+
See :ref:`2b. Activating environment using :code:`source.sh``
60+
61+
3a. Using :code:`sphinx-build`
62+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4163
The documentation for the :code:`sphinx-documentation-demo` is located in :code:`docs/`.
4264
While in the root project directory, do:
4365

@@ -50,8 +72,11 @@ You can open the file :code:`docs/index.html` on your computer to view the HTML
5072

5173

5274

53-
3a. Using :code:`sphinx-autobuild`
75+
3b. Using :code:`sphinx-autobuild`
5476
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77+
.. tip::
78+
79+
This option is probably the one you want.
5580
The :code:`sphinx-autobuild` extension allows us to build local documentation whenever we make changes.
5681
It also refreshes the web browser so you can see the changes "live". This makes it **very convenient for rapid development**.
5782

@@ -65,7 +90,49 @@ You can then point your web browser to: http://127.0.0.1:8000/
6590

6691
Remote Build on GitHub
6792
======================
93+
The :code:`_build` directory **should not be pushed to GitHub**.
94+
Instead we will use a GitHub Workflow to automatically build documentation that is pushed to the repository.
95+
The built documentation will then be automatically served up on a webpage in :code:`GitHub Pages`
96+
97+
1. Set up GitHub Pages
98+
----------------------
99+
GitHub Pages allow users to view web pages generated by our documentation.
100+
While there already a page set up for the :code`sphinx-documentation-demo` project, you will need to do the following steps for a new project:
101+
102+
1a. Navigate to Page settings
103+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104+
.. figure:: images/guide_install_repo_settings.png
105+
:class: sd-border-2
106+
107+
Click the Settings tab in the project you want to add to GitHub Pages.
108+
109+
110+
.. figure:: images/guide_install_repo_page_tab.png
111+
:class: sd-border-2
112+
113+
Click the Pages tab (in the left sidebar) in the Settings page.
114+
115+
116+
1b. Select branch to use with GitHub Pages
117+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118+
.. warning::
119+
120+
The GitHub repo must be **public** in order for it to be accessible via GitHub Pages.
121+
122+
.. figure:: images/guide_install_page_branch.png
123+
:class: sd-border-2
124+
125+
When documentation is successfully deployed, you will see a link that looks like :code:`A`. For a new repo, this will not be active.
126+
You will need to set the branch (see :code:`B`).
127+
This demo uses a separate branch called :code:`gh-pages` to deploy documentation.
128+
129+
2. Using GitHub Workflow to Build Documentation
130+
-----------------------------------------------
131+
GitHub can automatically discover workflows located in the :code:`.github/workflows` directory within the project directory.
132+
We will be using a workflow to build documentation whenever a new commit is pushed to the repository.
68133

69-
.. todo::
134+
2a. Example Workflow
135+
~~~~~~~~~~~~~~~~~~~~
136+
We will be reviewing the workflow that :code:`sphinx-documentation-demo` uses.
137+
You can find the workflow in :code:`sphinx-documentation-demo/.github/workflows/documentation.yml`
70138

71-
Finish the guide for remote building on GitHub.

docs/guides/images/.DS_Store

6 KB
Binary file not shown.
Loading
Loading
Loading

docs/guides/layout/layout_basic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ The left navigation bar allows users to navigate between documents that have bee
101101
Each tab will have its own left navigation bar, allowing you to organize :term:`rST` files into one "folder" per tab.
102102

103103
Right Navigation Bar
104-
===================
104+
=====================
105105
.. figure:: images/layout_right.png
106106
:class: sd-border-2
107107

0 commit comments

Comments
 (0)