Skip to content

Commit acb66ef

Browse files
authored
Sphinx docs (#966)
1 parent 8aca5d0 commit acb66ef

File tree

14 files changed

+356
-4
lines changed

14 files changed

+356
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ android/
1616
ios/
1717
desktop/
1818
build/
19+
_build/
1920

2021
coverage
2122

.readthedocs.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# [Read the Docs] configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
sphinx:
7+
builder: html
8+
configuration: doc/_sphinx/conf.py
9+
fail_on_warning: false
10+
11+
python:
12+
version: "3.8"
13+
install:
14+
- requirements: doc/_sphinx/requirements.txt

doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ short).
1313

1414
We also provide stand-alone packages that extend the Flame functionality:
1515
- [flame_audio](https://pub.dev/packages/flame_audio) Which provides audio capabilities using the
16-
`audioplayers` package.
16+
`audioplayers` package.
1717
- [flame_forge2d](https://pub.dev/packages/flame_forge2d) Which provides physics capabilities using
1818
our own `Box2D` port called `Forge2D`.
1919
- [flame_tiled](https://pub.dev/packages/flame_tiled) Which provides integration with the

doc/_sphinx/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
3+
# You can set these variables from the command line, and also
4+
# from the environment for the first two.
5+
SPHINXOPTS ?= -c .
6+
SPHINXBUILD ?= sphinx-build
7+
SOURCEDIR = ..
8+
BUILDDIR = ../_build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/_sphinx/conf.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
8+
# -- Project information -----------------------------------------------------
9+
10+
project = 'Flame'
11+
copyright = '2021, Blue Fire Team'
12+
author = 'Blue Fire Team'
13+
14+
root_doc = "index"
15+
16+
17+
# -- General configuration ---------------------------------------------------
18+
19+
# Add any Sphinx extension module names here, as strings. They can be
20+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
21+
# ones.
22+
extensions = [
23+
'myst_parser', # Markdown support
24+
]
25+
26+
# Configuration options for MyST:
27+
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
28+
myst_enable_extensions = [
29+
'dollarmath',
30+
'html_admonition',
31+
'html_image',
32+
'linkify',
33+
'replacements',
34+
'smartquotes',
35+
]
36+
37+
# Auto-generate link anchors for headers at levels H1 and H2
38+
myst_heading_anchors = 2
39+
40+
# List of patterns, relative to source directory, that match files and
41+
# directories to ignore when looking for source files.
42+
# This pattern also affects html_static_path and html_extra_path.
43+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'summary.md']
44+
45+
46+
# -- Options for HTML output -------------------------------------------------
47+
48+
# The theme to use for HTML and HTML Help pages.
49+
html_theme = "sphinx_book_theme"
50+
51+
# See https://sphinx-book-theme.readthedocs.io/en/latest/customize/index.html
52+
html_theme_options = {
53+
"logo_only": True,
54+
"path_to_docs": "doc",
55+
"repository_branch": "main",
56+
"repository_url": "https://github.com/flame-engine/flame",
57+
"use_edit_page_button": True,
58+
"use_repository_button": True,
59+
}
60+
html_title = "Flame"
61+
html_logo = "images/logo_flame.png"
62+
html_favicon = "images/favicon.ico"
63+
64+
# Style for syntax highlighting
65+
pygments_style = 'monokai'
66+
67+
# Add any paths that contain custom static files (such as style sheets) here,
68+
# relative to this directory. They are copied after the builtin static files,
69+
# so a file named "default.css" will overwrite the builtin "default.css".
70+
html_static_path = ['images', 'styles']
71+
72+
73+
def setup(app):
74+
"""Add functions to the Sphinx setup."""
75+
app.add_css_file("custom.css")

doc/_sphinx/images/favicon.ico

4.19 KB
Binary file not shown.

doc/_sphinx/images/logo_flame.png

12.3 KB
Loading

doc/_sphinx/make.bat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=..
11+
set BUILDDIR=..\_build
12+
set SPHINXOPTS=-c .
13+
14+
if "%1" == "" goto help
15+
16+
%SPHINXBUILD% >NUL 2>NUL
17+
if errorlevel 9009 (
18+
echo.
19+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20+
echo.installed, then set the SPHINXBUILD environment variable to point
21+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
22+
echo.may add the Sphinx directory to PATH.
23+
echo.
24+
echo.If you don't have Sphinx installed, grab it from
25+
echo.https://www.sphinx-doc.org/
26+
exit /b 1
27+
)
28+
29+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
30+
goto end
31+
32+
:help
33+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
34+
35+
:end
36+
popd

doc/_sphinx/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
linkify-it-py>=1.0
2+
myst-parser>=0.15.2
3+
pygments>=2.10
4+
sphinx>=4.2
5+
sphinx-book-theme>=0.1.4

doc/_sphinx/styles/custom.css

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
:root {
2+
--pst-color-inline-code: 255, 140, 50;
3+
--pst-color-link: 100, 150, 200;
4+
--pst-color-preformatted-background: 50, 50, 50;
5+
--pst-color-primary: 240, 240, 240;
6+
--pst-color-sidebar-caption: 250, 250, 255;
7+
--pst-color-sidebar-link: 150, 160, 170;
8+
--pst-color-sidebar-link-active: 80, 190, 255;
9+
--pst-color-text-base: 211, 211, 211;
10+
--pst-color-toc-link: 130, 130, 130;
11+
}
12+
13+
body {
14+
background-color: #3a3a3a;
15+
}
16+
17+
#site-navigation {
18+
background-color: #202225;
19+
}
20+
#site-navigation::-webkit-scrollbar {
21+
width: 4px;
22+
}
23+
#site-navigation::-webkit-scrollbar-track {
24+
background: #202225;
25+
}
26+
#site-navigation::-webkit-scrollbar-thumb,
27+
#site-navigation::-webkit-scrollbar-thumb:vertical {
28+
background: #000;
29+
}
30+
31+
32+
.topbar .topbar-main button.topbarbtn {
33+
background-color: #636363;
34+
color: #2f2f2f;
35+
}
36+
37+
#navbar-toggler {
38+
color: #777;
39+
}
40+
41+
.navbar_extra_footer {
42+
display: none;
43+
}
44+
45+
div.navbar-brand-box {
46+
padding: .5em 0 1em 0;
47+
}
48+
49+
div.navbar-brand-box a.navbar-brand {
50+
display: flex;
51+
align-items: center;
52+
}
53+
54+
div.navbar-brand-box a.navbar-brand img {
55+
max-width: 24vh;
56+
margin: 0;
57+
}
58+
59+
pre {
60+
border: none;
61+
box-shadow: 0px 0px 3px black;
62+
color: #888;
63+
position: relative;
64+
}
65+
66+
code {
67+
background-color: #222;
68+
border-radius: 3pt;
69+
padding: 2pt 3pt;
70+
}
71+
72+
div[class^="highlight-"] pre:before {
73+
background: black;
74+
border-bottom-left-radius: 5px;
75+
border-top-right-radius: 5px;
76+
color: #58d0ff;
77+
font-size: 80%;
78+
padding: 1px 8px;
79+
position: absolute;
80+
right: 0;
81+
top: 0;
82+
}
83+
84+
div.highlight-dart pre:before {
85+
content: "dart";
86+
}
87+
div.highlight-yaml pre:before {
88+
content: "yaml";
89+
color: #5f5;
90+
}
91+
div.highlight-text pre:before {
92+
content: "text";
93+
color: #666;
94+
}
95+
96+
/* Cancel some of the existing styles */
97+
#site-navigation nav ul.nav li a, #site-navigation nav ul.nav ul li a {
98+
color: rgba(var(--pst-color-sidebar-link), 1);
99+
}
100+
#site-navigation nav ul.nav a:hover, #site-navigation nav ul.nav li.active>a, #site-navigation nav ul.nav li.active>a:hover {
101+
color: rgba(var(--pst-color-sidebar-link-active), 1);
102+
}
103+
.bd-toc div.onthispage, .bd-toc .toc-entry a {
104+
color: rgba(var(--pst-color-toc-link), 1);
105+
}
106+
.bd-toc nav {
107+
background: inherit;
108+
}
109+
.bd-toc nav > .nav {
110+
border-color: #111;
111+
}
112+
nav.bd-links p.caption {
113+
margin-bottom: 0.2em;
114+
}
115+
main.bd-content #main-content h1 {
116+
color: rgba(var(--pst-color-h1), 1);
117+
}
118+
main.bd-content #main-content h2 {
119+
color: rgba(var(--pst-color-h2), 1);
120+
}
121+
main.bd-content #main-content h3 {
122+
color: rgba(var(--pst-color-h3), 1);
123+
}
124+
main.bd-content #main-content h4 {
125+
color: rgba(var(--pst-color-h4), 1);
126+
}
127+
main.bd-content #main-content h5 {
128+
color: rgba(var(--pst-color-h5), 1);
129+
}
130+
#site-navigation h1.site-logo {
131+
color: rgba(var(--pst-color-h1), 1);
132+
}
133+
.form-control {
134+
background-color: transparent;
135+
}
136+
.topbar {
137+
background-color: #3a3a3a;
138+
}
139+
.tocsection {
140+
border-color: black;
141+
}
142+
main.bd-content #main-content .prev-next-bottom .right-next .prevnext-label, main.bd-content #main-content .prev-next-bottom .left-prev .prevnext-label {
143+
color: #808080;
144+
}
145+
146+
.bd-sidebar .nav li>a {
147+
padding: .1rem 1.5rem;
148+
}

0 commit comments

Comments
 (0)