def setup(app: Sphinx) -> Dict[str, Any]:
app.setup_extension('sphinx.ext.linkcode')
app.connect("builder-inited", add_static_path)
app.connect('doctree-resolved', add_linkcode_node_class)
app.add_config_value('linkcode_blob', 'head', True)
app.add_config_value('linkcode_link_text', 'View on GitHub', 'html')
linkcode_blob = get_conf_val(app, "linkcode_blob")
linkcode_url = get_linkcode_url(
blob=get_linkcode_revision(linkcode_blob),
url=get_conf_val(app, 'linkcode_url'),
context=get_conf_val(app, 'html_context'),
)
linkcode_func = get_conf_val(app, "linkcode_resolve")
if not callable(linkcode_func):
print(
"Function `linkcode_resolve` not found in ``conf.py``; "
"using default function from ``sphinx_github_style``"
)
linkcode_func = get_linkcode_resolve(linkcode_url)
set_conf_val(app, 'linkcode_resolve', linkcode_func)
if not get_conf_val(app, 'pygments_style'):
set_conf_val(app, 'pygments_style', 'sphinx_github_style.GitHubStyle')
app.add_lexer('python', GitHubLexer)
app.add_css_file('github_style.css')
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}