1616# If extensions (or modules to document with autodoc) are in another directory,
1717# add these directories to sys.path here. If the directory is relative to the
1818# documentation root, use os.path.abspath to make it absolute, like shown here.
19- #
2019import os
2120import sys
2221from datetime import datetime
22+ from distutils .version import LooseVersion
23+
24+ import sphinx
25+ from m2r import MdInclude
2326
2427sys .path .insert (0 , os .path .abspath ("sphinxext" ))
2528sys .path .insert (0 , os .path .abspath (os .path .pardir ))
3134# -- General configuration ------------------------------------------------
3235
3336# If your documentation needs a minimal Sphinx version, state it here.
34-
35- # needs_sphinx = '1.0'
37+ needs_sphinx = "3.5"
3638
3739# generate autosummary even if no references
3840autosummary_generate = True
39- autodoc_default_flags = ["members" , "inherited-members" ]
4041add_module_names = False
4142
4243# Add any Sphinx extension module names here, as strings. They can be
4344# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4445# ones.
4546extensions = [
46- "sphinx.ext.autodoc" ,
47- "sphinx.ext.autosummary" ,
48- "sphinx.ext.doctest" ,
49- "sphinx.ext.ifconfig" ,
50- "sphinx.ext.intersphinx" ,
51- "sphinx.ext.linkcode" ,
52- "sphinx.ext.mathjax" ,
53- "sphinx.ext.napoleon" ,
54- "sphinx.ext.todo" ,
55- "sphinx_copybutton" ,
56- "sphinx_gallery.gen_gallery" ,
57- "sphinxarg.ext" ,
58- "m2r" ,
59- "numpydoc" ,
47+ "sphinx.ext.autodoc" , # standard
48+ "sphinx.ext.autosummary" , # standard
49+ "sphinx.ext.doctest" , # runs doctests
50+ "sphinx.ext.intersphinx" , # links code to other packages
51+ "sphinx.ext.linkcode" , # links to code from api
52+ "sphinx.ext.napoleon" , # alternative to numpydoc
53+ "sphinx_copybutton" , # for copying code snippets
54+ "sphinx_gallery.gen_gallery" , # example gallery
55+ "sphinxarg.ext" , # argparse
56+ "recommonmark" , # markdown parser
6057]
6158
62- from distutils .version import LooseVersion
63-
64- import sphinx
65-
6659if LooseVersion (sphinx .__version__ ) < LooseVersion ("1.4" ):
6760 extensions .append ("sphinx.ext.pngmath" )
6861else :
109102# The name of the Pygments (syntax highlighting) style to use.
110103pygments_style = "sphinx"
111104
112- # If true, `todo` and `todoList` produce output, else they produce nothing.
113- todo_include_todos = False
114-
115-
116- # -- Options for HTML output ----------------------------------------------
105+ # -----------------------------------------------------------------------------
106+ # Napoleon settings
107+ # -----------------------------------------------------------------------------
108+ napoleon_google_docstring = False
109+ napoleon_numpy_docstring = True
110+ napoleon_include_init_with_doc = True
111+ napoleon_include_private_with_doc = False
112+ napoleon_include_special_with_doc = False
113+ napoleon_use_admonition_for_examples = False
114+ napoleon_use_admonition_for_notes = False
115+ napoleon_use_admonition_for_references = False
116+ napoleon_use_ivar = True
117+ napoleon_use_param = False
118+ napoleon_use_keyword = True
119+ napoleon_use_rtype = False
117120
118- # The theme to use for HTML and HTML Help pages. See the documentation for
119- # a list of builtin themes.
120- #
121- # installing theme package
121+ # -----------------------------------------------------------------------------
122+ # HTML output
123+ # -----------------------------------------------------------------------------
124+ # The theme to use for HTML and HTML Help pages.
125+ # See the documentation for a list of builtin themes.
122126html_theme = "sphinx_rtd_theme"
123127
124128# Theme options are theme-specific and customize the look and feel of a theme
125- # further. For a list of options available for each theme, see the
126- # documentation.
127- #
128- # html_theme_options = { }
129+ # further. For a list of options available for each theme, see the documentation.
130+ html_theme_options = {
131+ "includehidden" : False , # don't show hidden TOCs in sidebar
132+ }
129133html_sidebars = {"**" : ["globaltoc.html" , "relations.html" , "searchbox.html" , "indexsidebar.html" ]}
130134
131135# Add any paths that contain custom static files (such as style sheets) here,
132136# relative to this directory. They are copied after the builtin static files,
133137# so a file named "default.css" will overwrite the builtin "default.css".
134138html_static_path = ["_static" ]
135139
136-
137- def setup (app ):
138- "From https://github.com/rtfd/sphinx_rtd_theme/issues/117."
139- app .add_stylesheet ("theme_overrides.css" )
140- app .add_stylesheet ("pymare.css" )
141- app .connect ("autodoc-process-docstring" , generate_example_rst )
142-
143-
144140html_favicon = "_static/nimare_favicon.png"
145141html_logo = "_static/nimare_banner.png"
146142
147- # -- Options for HTMLHelp output ------------------------------------------
148-
143+ # -----------------------------------------------------------------------------
144+ # HTMLHelp output
145+ # -----------------------------------------------------------------------------
149146# Output file base name for HTML help builder.
150147htmlhelp_basename = "pymaredoc"
151148
@@ -185,30 +182,26 @@ def setup(app):
185182 "reference_url" : {
186183 # The module you locally document uses None
187184 "pymare" : None ,
188- "matplotlib" : "https://matplotlib.org/" ,
189- "numpy" : "http://docs.scipy.org/doc/numpy/" ,
190185 },
191186}
192187
193188# Generate the plots for the gallery
194- plot_gallery = "True"
195-
196- # -- Options for Texinfo output -------------------------------------------
197-
198- # Grouping the document tree into Texinfo files. List of tuples
199- # (source start file, target name, title, author,
200- # dir menu entry, description, category)
201- texinfo_documents = [
202- (
203- "index" ,
204- "project-template" ,
205- "project-template Documentation" ,
206- "Vighnesh Birodkar" ,
207- "project-template" ,
208- "One line description of project." ,
209- "Miscellaneous" ,
210- ),
211- ]
189+ plot_gallery = True
190+
191+
192+ def setup (app ):
193+ """From https://github.com/rtfd/sphinx_rtd_theme/issues/117."""
194+ app .add_stylesheet ("theme_overrides.css" )
195+ app .add_stylesheet ("pymare.css" )
196+ app .connect ("autodoc-process-docstring" , generate_example_rst )
197+ # Fix to https://github.com/sphinx-doc/sphinx/issues/7420
198+ # from https://github.com/life4/deal/commit/7f33cbc595ed31519cefdfaaf6f415dada5acd94
199+ # from m2r to make `mdinclude` work
200+ app .add_config_value ("no_underscore_emphasis" , False , "env" )
201+ app .add_config_value ("m2r_parse_relative_links" , False , "env" )
202+ app .add_config_value ("m2r_anonymous_references" , False , "env" )
203+ app .add_config_value ("m2r_disable_inline_math" , False , "env" )
204+ app .add_directive ("mdinclude" , MdInclude )
212205
213206
214207def generate_example_rst (app , what , name , obj , options , lines ):
@@ -221,16 +214,3 @@ def generate_example_rst(app, what, name, obj, options, lines):
221214 if not os .path .exists (examples_path ):
222215 # touch file
223216 open (examples_path , "w" ).close ()
224-
225-
226- # Documents to append as an appendix to all manuals.
227- # texinfo_appendices = []
228-
229- # If false, no module index is generated.
230- # texinfo_domain_indices = True
231-
232- # How to display URL addresses: 'footnote', 'no', or 'inline'.
233- # texinfo_show_urls = 'footnote'
234-
235- # If true, do not generate a @detailmenu in the "Top" node's menu.
236- # texinfo_no_detailmenu = False
0 commit comments