You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Navigate to the docs/ folder
Initialize Sphinx
sphinx-quickstart
When prompted, you can use the default options for most settings.
When asked to separate source and build directories, say 'yes'.
After completion, you should see a new folder named source and another named build within the docs/ folder, along with a Makefile and a make.bat file.
Configure Sphinx
Open the conf.py file which will be located in docs/source/.
Add any specific Sphinx extensions or themes you'd like to use here.
Convert Markdown Files to reStructuredText (Optional)
If you'd like to keep your existing Markdown documentation, install the m2r or recommonmark extension to enable Sphinx to read Markdown files.
Copy code
pip install m2r2
Then, add it to the extensions list in conf.py.
python
Copy code
extensions = ['m2r2']
Include the Markdown files in the Sphinx toctree by editing the index.rst file in the source/ directory.
Generate API Documentation (For Python Modules)
If your project is a Python package, you can auto-generate API documentation.
bash
Copy code
sphinx-apidoc -o ./source/ ../YourPythonModule/
Build the Documentation
bash
Copy code
make html
The HTML files will be generated in docs/build/html.
Check the Documentation Locally
Open the index.html in docs/build/html with a web browser to make sure everything looks good.
Commit and Push Changes
bash
Copy code
git add .
git commit -m "Set up Sphinx documentation"
git push origin main
Set Up GitHub Pages (Optional)
Go to your GitHub repository settings.
Scroll down to the GitHub Pages section.
Set the source to main (or whichever branch you're using) and /docs/build/html as the folder.
Click Save.
The text was updated successfully, but these errors were encountered:
Details
Create docs page for this repository with Sphinx
Navigate to the docs/ folder
Initialize Sphinx
sphinx-quickstart
When prompted, you can use the default options for most settings.
When asked to separate source and build directories, say 'yes'.
After completion, you should see a new folder named source and another named build within the docs/ folder, along with a Makefile and a make.bat file.
Configure Sphinx
Open the conf.py file which will be located in docs/source/.
Add any specific Sphinx extensions or themes you'd like to use here.
Convert Markdown Files to reStructuredText (Optional)
If you'd like to keep your existing Markdown documentation, install the m2r or recommonmark extension to enable Sphinx to read Markdown files.
Copy code
pip install m2r2
Then, add it to the extensions list in conf.py.
python
Copy code
extensions = ['m2r2']
Include the Markdown files in the Sphinx toctree by editing the index.rst file in the source/ directory.
Generate API Documentation (For Python Modules)
If your project is a Python package, you can auto-generate API documentation.
bash
Copy code
sphinx-apidoc -o ./source/ ../YourPythonModule/
Build the Documentation
bash
Copy code
make html
The HTML files will be generated in docs/build/html.
Check the Documentation Locally
Open the index.html in docs/build/html with a web browser to make sure everything looks good.
Commit and Push Changes
bash
Copy code
git add .
git commit -m "Set up Sphinx documentation"
git push origin main
Set Up GitHub Pages (Optional)
Go to your GitHub repository settings.
Scroll down to the GitHub Pages section.
Set the source to main (or whichever branch you're using) and /docs/build/html as the folder.
Click Save.
The text was updated successfully, but these errors were encountered: