docs.rst - jgrey4296/jgrey4296.github.io GitHub Wiki

Sphinx / RST

RST

Syntax

indentation: relative, consistent. roles: inline directives: block level

.. _reference:

 Some *italic* and **bold** text
`interpreted text`
``inline literal as monospace``
reference_ and `phrase reference`_ and anonRef__ (two underscores) and  _`internal reference`.

|substitution reference|
footnote [1]_.
citation [CIT2002]_.
https:://docutils.sourceforge.io

-------

.. [1] The footnote text.

.. |substitution reference| will be replaced with this text.
inline delimters: * ` | _
escape: \* etc

A horizontal bar:

--------

literal block ::

    Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus,
    et dictum nunc justo sit amet elit.

and also::

> Fusce commodo.
> Nullam rutrum.  Donec pretium posuere tellus.
Bullet Lists: (requires blank line below)

- blah
- bloo

- blee
  continued text must be aligned

Enumerated Lists:

1. blah
2. bloo

3. blee
#. auto-enumerated.

Definition Lists:

what
   some definiton text.

how
   another definition.

Field Lists:

:Authors:
   bob
   bill

:Version:
  1.0
|---+-------+------+-----+------|
| A | table | like | org | mode |
|---+-------+------+-----+------|
| 1 |     2 |    3 |   4 |    5 |
|---+-------+------+-----+------|
.. WORD :: General form

.. image :: images/ball1.gif

”.. blockname :: ”

  • Admonitions: attention, caution, danger, error, hint, important, note, time, warning
  • image
  • figure
  • date
  • target-notes
  • include
  • raw
  • meta
  • title
  • topic
  • sidebar
  • line-block
  • parsed-literal
  • code
  • math
  • rubric
  • epigraph
  • highlights
  • pull-quote
  • compound
  • container
  • table
  • csv-table
  • list-table
  • contents
  • sectnum
  • header
  • footer
field list at top of file is added to environment as metadata
  • toctree
  • sectionauthor
  • codeauthor
  • index
  • only
  • admonitions: attention, caution, danger, error, hint, important, note, tip, warning, admonition, seealso
  • version changes: versionadded, versionchanged, deprecated, versionremoved
  • rubric
  • hlist
  • code-block
  • sourcecode
  • code
  • literal
  • literalinclude
  • highlight
  • glossary (:sorted:)
  • math
  • productionlist

toctree

  • :class:
  • :name:
  • :caption:
  • :numbered:
  • :titlesonly:
  • :glob:
  • :reversed:
  • :hidden:
  • :includehidden:

code

  • :linenos:
  • :lineno-start:
  • :emphasize-lines:
  • :force:
  • :captionpostion:
  • :name:
  • :class:
  • :dedent:

index

.. index::
   single: entryname; subname
   pair: first; second
   triple: first; second; third
   see: from; to
   seealso: from; to

.. index:: ! main

Also a paragraph level :index:`refence`.

productionlist

.. productionlist::
   try_stmt: try1_stmt | try2_stmt
   try1_stmt: "try" ":" `suite`
            : ("except" [`expression` ["," `target`]] ":" `suite`)+
            : ["else" ":" `suite`]
            : ["finally" ":" `suite`]
   try2_stmt: "try" ":" `suite`
            : "finally" ":" `suite`

unicode

Copyright |copy| 2020

.. |copy| unicode:: 0xA9 .. copyright sign

Docutils

Sphinx

CLI

sphinx-build --help

Config

	#!/usr/bin/env python3
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use pl.Path.resolve to make it absolute, like shown here.
#
import os
import sys
import pathlib as pl
sys.path.insert(0, pl.Path('../$1').resolve())

import $1

# -- Project information -----------------------------------------------------

project   = '$1'
copyright = '2022, `user-full-name`'
author    = '`user-full-name`'

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.doctest',
              'sphinx.ext.autodoc',
              'sphinx.ext.autosummary',
              'sphinx.ext.napoleon']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['**/flycheck_*.py']

autosummary_generate = True

autodoc_default_options = {
    'members'       : True,
    'undoc-members' : True,
    # 'private-members': True,
    # 'special-members': True,
    'inherited-members': True,
    'show-inheritance' : True,
    }
add_module_names = False
autodoc_inherit_docstrings = True

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

html_theme_options = {

    }

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

Themes

Alabaster

Basic

Classic

sphinxdoc

scrolls

agogo

nature

pyramid

haiku

traditional

epub

bizstyle

Read the docs

Book

PyData

Groundwork

Main Extensions

sphinx.ext.autodoc - Include documentation from docstrings

use ‘autofunction’ directives to insert docstrings from code.

sphinx.ext.autosummary - Generate autodoc summaries

use ‘autosummary’ directives to generate autofunctions members of modules

sphinx.ext.autogen - Documents autosummary listings

sphinx.ext.apidoc - generate whole packages

autoapi

pip install sphinx-autoapi

sphinx.ext.graphviz - Add Graphviz graphs

  • graphviz
  • graph
  • digraph
graphviz_dot graphviz_dot_args graphviz_output_format

sphinx.ext.imgconverter - A reference image converter using Imagemagick

sphinx.ext.linkcode

sphinx.ext.viewcode - Add links to highlighted source code

sphinx-prompt

myst-parser

sphinx-version-warning

sphinx-hoverxref

sphinx.ext.coverage - Collect doc coverage stats

Secondary Extensions

sphinx.ext.autosectionlabel - Allow reference sections using its title

sphinx.ext.doctest - Test snippets in the documentation

sphinx.ext.duration - Measure durations of Sphinx processing

sphinx.ext.extlinks - Markup to shorten external links

sphinx.ext.githubpages - Publish HTML docs in GitHub Pages

sphinx.ext.ifconfig - Include content based on configuration

sphinx.ext.inheritance_diagram - Include inheritance diagrams

sphinx.ext.intersphinx - Link to other projects’ documentation

sphinx.ext.napoleon - Support for NumPy and Google style docstrings

sphinx.ext.todo - Support for todo items

Sphinx-Rust

Math support for HTML outputs in Sphinx

doxysphinx

copier-sphinxcontrib

datatemplates

fulltoc

domaintools

programoutput

versioning

erlangdomain

multiversion

sphinx-lint

plantuml

tikz

Writing Extensions

Pygments

Doxygen<->Sphinx : Breathe

Links

⚠️ **GitHub.com Fallback** ⚠️