Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Edit on GitHub #4460

Merged
merged 9 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ dependencies:
- zarr>=2.4
- pip
- pip:
- scanpydoc
# relative to this file. Needs to be editable to be accepted.
- -e ../..
3 changes: 3 additions & 0 deletions doc/_templates/autosummary/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:github_url: {{ fullname | github_url | escape_underscores }}

{% extends "!autosummary/base.rst" %}
20 changes: 20 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

import datetime
import os
import pathlib
import subprocess
import sys
from contextlib import suppress

import sphinx_autosummary_accessors
from jinja2.defaults import DEFAULT_FILTERS

import xarray

Expand Down Expand Up @@ -78,6 +80,7 @@
"IPython.sphinxext.ipython_console_highlighting",
"nbsphinx",
"sphinx_autosummary_accessors",
"scanpydoc.rtd_github_links",
]

extlinks = {
Expand All @@ -97,6 +100,15 @@
"""

autosummary_generate = True

# for scanpydoc's jinja filter
project_dir = pathlib.Path(__file__).parent.parent
html_context = {
"github_user": "pydata",
"github_repo": "xarray",
"github_version": "master",
}

autodoc_typehints = "none"

napoleon_use_param = False
Expand Down Expand Up @@ -404,3 +416,11 @@
"dask": ("https://docs.dask.org/en/latest", None),
"cftime": ("https://unidata.github.io/cftime", None),
}


def escape_underscores(string):
return string.replace("_", r"\_")


def setup(app):
DEFAULT_FILTERS["escape_underscores"] = escape_underscores