Skip to content

Commit

Permalink
Docs formatting (#37)
Browse files Browse the repository at this point in the history
* Update to Sphinx theme

* added new theme to docs reqs

* Basic themeing

* Added logo

* removed blurple

* styled for mobile

* Cleanup

* Fixed overflow on mobile

* Load custom CSS from hosed docs

Co-authored-by: John Myers <john@gretel.ai>
  • Loading branch information
arronhunt and John Myers committed Jul 7, 2020
1 parent ad1f7ec commit c406021
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ help:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Config options for sphinx-autobuild
livehtml:
sphinx-autobuild -B "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2 changes: 1 addition & 1 deletion docs/_static/styles.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import url('https://fonts.googleapis.com/css?family=Inter');
@import url("https://python.docs.gretel.cloud/latest/_static/styles.css");
47 changes: 29 additions & 18 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,75 @@

import sphinx

sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath("../src"))


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

project = 'Gretel Synthetics'
copyright = '2020, Gretel.ai'
author = 'Gretel.ai'
project = "Gretel Synthetics"
copyright = "2020, Gretel.ai"
author = "Gretel.ai"


# -- 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.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.napoleon', 'm2r']
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"m2r",
"sphinx_rtd_theme",
]

source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
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 = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- 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 = "sphinx_rtd_theme"
html_logo = "img/gretel_logo_white.png"

# 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']
html_static_path = ["_static"]
html_css_files = ["styles.css"]

html_theme_options = {
'sidebar_width': '250px',
'font_family': 'Inter'
'logo_only': True,
'display_version': True,
'style_nav_header_background': '#0c0c0d',
}

html_css_files = [
'styles.css'
]


def monkeypatch(cls):
""" decorator to monkey-patch methods """

def decorator(f):
method = f.__name__
old_method = getattr(cls, method)
setattr(cls, method, lambda self, *args, **kwargs: f(old_method, self, *args, **kwargs))
setattr(
cls,
method,
lambda self, *args, **kwargs: f(old_method, self, *args, **kwargs),
)

return decorator


# workaround until https://github.com/miyakogi/m2r/pull/55 is merged
@monkeypatch(sphinx.registry.SphinxComponentRegistry)
def add_source_parser(_old_add_source_parser, self, *args, **kwargs):
Expand Down
Binary file added docs/img/gretel_logo_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
m2r
sphinx==3.0.3
sphinx-rtd-theme
-r ../requirements.txt

0 comments on commit c406021

Please sign in to comment.