Skip to content

Commit ae25c5b

Browse files
fix: update readme.md
1 parent 0c29618 commit ae25c5b

File tree

1 file changed

+113
-18
lines changed

1 file changed

+113
-18
lines changed

README.md

Lines changed: 113 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,39 @@ This site uses [Sphinx](https://www.sphinx-doc.org/en/master/) as a framework an
1010
- Docs added to this repository should be removed from their original location (e.g. Google Drive, ResFS, OneDrive, etc.) after it is committed.
1111
- Be kind, considerate, and thoughtful.
1212

13+
## Setup and Installation
14+
15+
### Install and Configure Sphinx
16+
17+
Create or activate a virtual Python environment for the project:
18+
19+
```bash
20+
python3 -m venv venv
21+
source venv/bin/activate
22+
```
23+
24+
Install the requirements which include Sphinx and myst-parser (for Markdown parsing):
25+
26+
```bash
27+
pip install -r requirements-docs.txt
28+
```
29+
30+
The `requirements-docs.txt` file contains both Sphinx and myst-parser to handle ReStructuredText and Markdown formats.
31+
32+
### Initial Sphinx Setup
33+
34+
If setting up Sphinx for the first time, create a directory to contain documentation (in our case, `sphinx`), cd to that directory, then run `sphinx-quickstart`. This will create the files `conf.py`, `index.rst`, and `make.bat`. It will also create a destination directory (the default is `_build`) for generated HTML:
35+
36+
```bash
37+
cd sphinx
38+
sphinx-quickstart
39+
```
40+
41+
Edit the `conf.py` file similar to our existing [conf.py](sphinx/conf.py).
42+
1343
## Run Locally
1444

15-
To run Sphinx locally, you need to create a Python3 virtual environment, install the requirements, and run `make html`. See below:
45+
To run Sphinx locally and build the documentation:
1646

1747
```bash
1848
python3 -m venv venv
@@ -22,26 +52,72 @@ cd sphinx
2252
make html
2353
```
2454

25-
Each time you make a change, you'll need to run `make html` again from the `sphinx` directory. You should see a list of warnings in the terminal each time to indicate potential issues in the repository. See below:
55+
Each time you make a change, you'll need to run `make html` again from the `sphinx` directory. You should see a list of warnings in the terminal each time to indicate potential issues in the repository. Run this prior to pushing to GitHub:
2656

2757
```bash
2858
checking consistency... /Users/g584f396/GitHub/specify.github.io/sphinx/aws/aws_authentication.rst: WARNING: document isn't included in any toctree [toc.not_included]
2959
```
3060
31-
You can access it by opening the `index.html` file in your browser (e.g.
61+
You can access the built documentation by opening the `index.html` file in your browser (e.g.
3262
`file:///Users/g584f396/GitHub/specify.github.io/sphinx/_build/html/index.html`).
3363
64+
## Writing and Editing Documentation
65+
66+
### Documentation Format
67+
68+
Write all documents in ReStructuredText (.rst) or Markdown (.md) format. The requirements include both Sphinx and myst-parser to handle each format. Organize documents in logical subdirectories within the `sphinx` folder.
69+
70+
### Important Guidelines
71+
72+
- Each document must contain only one top-level title, which will be displayed in the Table of Contents
73+
- Any number of sub-level headings may be included in each document
74+
- Edit the `index.rst` file to include page names under the Table of Contents (toctree)
75+
- Include paths relative to the documentation directory, and filenames without extension
76+
- The `:maxdepth:` parameter indicates how many sublevels will be displayed in the Table of Contents
77+
- Only if there are very few pages should `:maxdepth:` be more than 1
78+
79+
### Building and Testing
80+
81+
In the documentation directory, run the following to build pages locally and check formatting. The command will build documentation and print errors and warnings in the terminal output:
82+
83+
```bash
84+
make html
85+
```
86+
87+
## GitHub Pages Publishing
88+
89+
### Repository Setup
90+
91+
This repository uses GitHub Pages for automatic deployment. The site is published to https://specify.github.io/ using GitHub Actions.
92+
93+
### GitHub Actions Configuration
94+
95+
The repository uses a GitHub Action configured in `.github/workflows/build_sphinx_docs.yml` to automatically build and deploy the documentation when changes are pushed to the main branch.
96+
97+
### Deployment Process
98+
99+
1. When code is pushed to GitHub, the GitHub Action runs automatically
100+
2. Sphinx builds the documentation
101+
3. The built site is deployed to the `gh-pages` branch
102+
4. GitHub Pages serves the content from this branch
103+
5. The site is available at https://specify.github.io/ within minutes
104+
105+
34106
## Contribute
35107
36108
Contribution for this repository is limited only to SCC staff.
37109
38-
1. Clone the repository
110+
### Step-by-Step Contribution Process
111+
112+
1. **Clone the repository**
39113
40114
```bash
41115
gh repo clone specify/specify.github.io
42116
```
43117
44-
2. Create a new `.md` or `.rst` file under the appropriate directory (e.g. `server_management`, `testing`, `security`, etc.) or create a new directory to begin a new category.
118+
2. **Create a new document**
119+
120+
Create a new `.md` or `.rst` file under the appropriate directory (e.g. `server_management`, `testing`, `security`, etc.) or create a new directory to begin a new category.
45121
46122
```bash
47123
├── LICENSE
@@ -66,7 +142,7 @@ Contribution for this repository is limited only to SCC staff.
66142
└── testing
67143
```
68144
69-
For example, I may want to add `reports.md` to the repository under `server_management`, so I would add this below like so:
145+
For example, to add `reports.md` to the repository under `server_management`:
70146
71147
```bash
72148
└── sphinx
@@ -75,23 +151,42 @@ Contribution for this repository is limited only to SCC staff.
75151
└── reports.md
76152
```
77153
78-
3. Preview, proofread, and double-check your document for accuracy. Once saved, the file will be available at this URL (after the base domain)
79-
80-
```
81-
/server_management/reports.html
82-
```
83-
84-
4. You can add this to the sidebar and homepage by adding it to the `index.rst` file in the `./sphinx/` directory under the appropriate category. You just need to add the path to your file within that directory minus the file extension (no `.md` or `.rst`).
154+
3. **Add to Table of Contents**
155+
156+
Add your document to the sidebar and homepage by editing the `index.rst` file in the `./sphinx/` directory under the appropriate category. Add the path to your file within that directory minus the file extension (no `.md` or `.rst`).
85157
86158
If the category you want does not yet exist, you can add a new one in the same format and structure as the others.
87159
88160
```rst
89161
.. toctree::
90-
:maxdepth: 1
91-
:caption: Server Management:
162+
:maxdepth: 1
163+
:caption: Server Management:
164+
165+
server_management/check_asset_usage
166+
server_management/reports
167+
```
168+
169+
4. **Preview and test locally**
170+
171+
Before committing, preview, proofread, and double-check your document for accuracy:
172+
173+
```bash
174+
cd sphinx
175+
make html
176+
```
177+
178+
Once saved, the file will be available at this URL pattern (after the base domain):
92179
93-
server_management/check_asset_usage
94-
server_management/reports
95180
```
181+
/server_management/reports.html
182+
```
183+
184+
5. **Commit and deploy**
185+
186+
Save and commit to the `main` branch of this repository on GitHub. GitHub will automatically update the pages site (https://specify.github.io/) within minutes and the document will be available publicly.
187+
188+
### Content Guidelines
96189
97-
5. Save and commit to the `main` branch of this repository on GitHub. GitHub will automatically update the pages site (https://specify.github.io/) within minutes and the document will be available publicly.
190+
- Ensure your documentation follows the contribution guidelines at the top of this README
191+
- Remove documents from their original location (Google Drive, ResFS, OneDrive, etc.) after committing to this repository
192+
- Test your changes locally before pushing to ensure proper formatting and no build errors

0 commit comments

Comments
 (0)