Skip to content

Commit

Permalink
docs: Updated documentation theme (#856)
Browse files Browse the repository at this point in the history
* backup

* theme and css

* apply changes

* apply changes

* fix headline responsive
  • Loading branch information
felixdittrich92 committed Mar 18, 2022
1 parent 2b70a94 commit c08c0bd
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 19 deletions.
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
sphinx<3.5.0
sphinx-rtd-theme==0.4.3
sphinx>=3.0.0,!=3.5.0
sphinxemoji>=0.1.8
sphinx-copybutton>=0.3.1
docutils<0.18
recommonmark>=0.7.1
sphinx-markdown-tables>=0.0.15
sphinx-tabs>=3.3.0
furo>=2022.3.4
13 changes: 11 additions & 2 deletions docs/source/_static/css/mindee.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@
display: block;
}

.wy-nav-content {
max-width: 1000px !important;
h1 {
font-family: "Helvetica Neue", Arial, sans-serif;
/* style fix for headline that it fits into one line */
font-size: 240%;
}

h1, h2, h3, h4, h5, .caption-text {
font-family: "Helvetica Neue", Arial, sans-serif;
}

/* Github button */

.github-repo {
display: flex;
justify-content: center;
}
4 changes: 2 additions & 2 deletions docs/source/_static/js/custom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 41 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import sys
from datetime import datetime

import sphinx_rtd_theme

sys.path.insert(0, os.path.abspath('../..'))
import doctr

Expand Down Expand Up @@ -48,6 +46,7 @@
'sphinx_copybutton',
'recommonmark',
'sphinx_markdown_tables',
'sphinx_tabs.tabs',
]

intersphinx_mapping = {
Expand All @@ -67,26 +66,39 @@


# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'friendly'
pygments_dark_style = "monokai"
highlight_language = 'python3'

# -- 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 = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'furo'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'collapse_navigation': False,
'display_version': False,
'logo_only': False,
'analytics_id': 'G-40DVRMX8T4',
"sidebar_hide_name": True,
"navigation_with_keys": True,
"light_css_variables": {
"color-sidebar-background": "#082747",
"color-sidebar-background-border": "#082747",
"color-sidebar-caption-text": "white",
"color-sidebar-link-text--top-level": "white",
"color-sidebar-link-text": "white",
"sidebar-caption-font-size": "normal",
"color-sidebar-item-background--hover": " #5dade2",
},
"dark_css_variables": {
"color-sidebar-background": "#1a1c1e",
"color-sidebar-background-border": "#1a1c1e",
"color-sidebar-caption-text": "white",
"color-sidebar-link-text--top-level": "white",
},
}

html_logo = '_static/images/Logo-docTR-white.png'
Expand All @@ -102,6 +114,26 @@
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']

# Add googleanalytics id
# ref: https://github.com/orenhecht/googleanalytics/blob/master/sphinxcontrib/googleanalytics.py
def add_ga_javascript(app, pagename, templatename, context, doctree):

metatags = context.get('metatags', '')
metatags += """
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={0}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){{dataLayer.push(arguments);}}
gtag('js', new Date());
gtag('config', '{0}');
</script>
""".format(app.config.googleanalytics_id)
context['metatags'] = metatags


def setup(app):
app.add_config_value('googleanalytics_id', 'G-40DVRMX8T4', 'html')
app.add_css_file('css/mindee.css')
app.add_js_file('js/custom.js')
app.connect('html-page-context', add_ga_javascript)
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
********************************
docTR: Document Text Recognition
================================
********************************

State-of-the-art Optical Character Recognition made seamless & accessible to anyone, powered by TensorFlow 2 & PyTorch

Expand Down
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@
"mypy>=0.812",
"pydocstyle>=6.1.1",
# Docs
"sphinx<3.5.0",
"sphinx-rtd-theme==0.4.3",
"sphinx>=3.0.0,!=3.5.0",
"sphinxemoji>=0.1.8",
"sphinx-copybutton>=0.3.1",
"docutils<0.18",
"recommonmark>=0.7.1",
"sphinx-markdown-tables>=0.0.15",
"sphinx-tabs>=3.3.0",
"furo>=2022.3.4",
]

deps = {b: a for a, b in (re.findall(r"^(([^!=<>]+)(?:[!=<>].*)?$)", x)[0] for x in _deps)}
Expand Down Expand Up @@ -148,12 +149,13 @@ def deps_list(*pkgs):

extras["docs_specific"] = deps_list(
"sphinx",
"sphinx-rtd-theme",
"sphinxemoji",
"sphinx-copybutton",
"docutils",
"recommonmark",
"sphinx-markdown-tables",
"sphinx-tabs",
"furo",
)

extras["docs"] = extras["all"] + extras["docs_specific"]
Expand Down

0 comments on commit c08c0bd

Please sign in to comment.