Skip to content

Commit 3ca5479

Browse files
germa89pyansys-ci-botRevathyvenugopal162
authored
feat: add 'serve' command to Makefile and make.bat for serving documentation (#698)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Revathyvenugopal162 <[email protected]> Co-authored-by: Revathy Venugopal <[email protected]>
1 parent d34e0e7 commit 3ca5479

File tree

5 files changed

+77
-22
lines changed

5 files changed

+77
-22
lines changed

doc/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
7+
DOCSDIR = doc
78
SOURCEDIR = source
89
BUILDDIR = _build
910
AUTOAPI_OUTDIR = source/examples/api
@@ -32,3 +33,8 @@ pdf:
3233
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3334
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
3435
(test -f $(BUILDDIR)/latex/ansys_sphinx*.pdf && echo pdf exists) || exit 1
36+
37+
# Serve docs
38+
serve:
39+
@echo "Serving docs..."
40+
@cd ../ && stb serve $(DOCSDIR)/$(SOURCEDIR)

doc/changelog.d/698.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add 'serve' command to Makefile and make.bat for serving documentation

doc/make.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ if "%SPHINXBUILD%" == "" (
99
)
1010
set SOURCEDIR=source
1111
set BUILDDIR=_build
12+
set DOCSDIR=doc
1213
set GALLERY_EXAMPLES=%SOURCEDIR%\examples\gallery-examples
1314
set AUTOAPI_OUTDIR=%SOURCEDIR%\examples\api\
1415

1516
if "%1" == "" goto help
1617
if "%1" == "pdf" goto pdf
1718
if "%1" == "clean" goto clean
19+
if "%1" == "serve" goto serve
1820

1921
%SPHINXBUILD% >NUL 2>NUL
2022
if errorlevel 9009 (
@@ -46,5 +48,11 @@ if exist %BUILDDIR% rmdir /S /Q %BUILDDIR%
4648
if exist %GALLERY_EXAMPLES% rmdir /S /Q %GALLERY_EXAMPLES%
4749
if exist %AUTOAPI_OUTDIR% rmdir /S /Q %AUTOAPI_OUTDIR%
4850

51+
52+
:serve
53+
cd ../
54+
stb serve $(DOCSDIR)/$(SOURCEDIR)
55+
56+
4957
:end
5058
popd

doc/source/contribute/developer.rst

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,55 @@ To modify the SCSS files, follow these steps:
229229

230230
1. Navigate to the ``src/ansys_sphinx_theme/assets/styles/`` directory.
231231
2. Edit the relevant SCSS files as needed.
232-
3. Build the SCSS files using the following command:
232+
3. Build the library using the following command along with the documentation dependencies:
233233

234234
.. code-block:: bash
235235
236236
python -m pip install -e '.[doc]'
237-
stb serve doc/source
237+
238+
This command installs the library in editable mode and builds the SCSS files.
239+
240+
.. important::
241+
242+
The built SCSS files are stored in the
243+
``src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/`` directory.
244+
These files are regenerated during each build process, so avoid editing them directly.
245+
246+
4. Build the documentation and serve it locally using any of the following commands:
247+
248+
.. tab-set::
249+
250+
.. tab-item:: using Tox (recommended)
251+
252+
**Linux/macOS/UNIX/Windows**
253+
254+
.. code-block:: bash
255+
256+
python -m tox -e doc-serve
257+
258+
.. tab-item:: using Makefile
259+
260+
.. tab-set::
261+
262+
.. tab-item:: Linux or macOS
263+
264+
.. code-block:: bash
265+
266+
make -C doc serve
267+
268+
.. tab-item:: Windows
269+
270+
.. code-block:: bash
271+
272+
doc\make.bat serve
273+
274+
.. tab-item:: using stb
275+
276+
**Linux/macOS/UNIX/Windows**
277+
278+
.. code-block:: bash
279+
280+
stb serve doc/source
238281
239282
After the build completes, the documentation is served on ``localhost`` and automatically opens
240283
in the default web browser. SCSS file changes are monitored, and the documentation rebuilds automatically.
@@ -250,11 +293,7 @@ To modify the SCSS files, follow these steps:
250293
This command builds the documentation, opens it in the default browser, and monitors the source files for changes to
251294
trigger automatic rebuilds.
252295

253-
.. important::
254296

255-
The built SCSS files are stored in the
256-
``src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/styles/`` directory.
257-
These files are regenerated during each build process, so avoid editing them directly.
258297

259298

260299
Build the documentation
Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
(?i)ansys
2+
(?i)autoapi
3+
(?i)Boolean
4+
(?i)css
5+
(?i)favicon
6+
(?i)HTML
7+
(?i)linkcode
8+
(?i)pydata
29
(?i)sphinx
10+
(?i)Sphinx-Gallery
311
(?i)theme
4-
(?i)Boolean
12+
(?i)whatsnew
13+
astroid
14+
Chris
515
datatable
616
debounce
7-
MeiliSearch
8-
(?i)linkcode
17+
Gedam
18+
html_context
19+
link_code_branch
920
link_code_library
1021
link_code_source
11-
link_code_branch
12-
html_context
13-
(?i)autoapi
14-
(?i)HTML
22+
MeiliSearch
1523
multi-version
16-
(?i)css
17-
PDF
1824
namespaces
19-
(?i)pydata
25+
PDF
2026
Pradyun
21-
Gedam
22-
Chris
2327
Sewell
24-
(?i)Sphinx-Gallery
25-
(?i)favicon
26-
astroid
27-
(?i)whatsnew
28+
stb

0 commit comments

Comments
 (0)