Skip to content

Commit

Permalink
add tutorial role to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf committed Dec 29, 2019
1 parent ec189e9 commit 15ae39e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
25 changes: 23 additions & 2 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,29 @@
/* Custom classes */

.small { font-size:40% }
.smaller, .pr, .noteversion { font-size:70% }
.noteversion::after { content: "/" }
.smaller, .pr { font-size:70% }


/* Custom classes with bootstrap buttons */

.tutorial {
font-weight: bold;
padding: 2px 5px;
white-space: nowrap;
max-width: 100%;
background: #f07e44;
border: solid 1px #f07e44;
border-radius: .25rem;
font-size: 75%;
/* font-family: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",Courier,monospace; */
color: #404040;
overflow-x: auto;
box-sizing: border-box;
}

.tutorial:visited {
color: #404040;
}


/* Formatting of RTD markup: rubrics and sidebars and admonitions */
Expand Down
17 changes: 13 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
todo_include_todos = False
api_dir = HERE / 'api' # function_images

scanpy_tutorials_url = 'https://scanpy-tutorials.readthedocs.io/en/latest/'

intersphinx_mapping = dict(
anndata=('https://anndata.readthedocs.io/en/stable/', None),
bbknn=('https://bbknn.readthedocs.io/en/latest/', None),
Expand All @@ -84,10 +86,7 @@
scvelo=('https://scvelo.readthedocs.io/', None),
seaborn=('https://seaborn.pydata.org/', None),
sklearn=('https://scikit-learn.org/stable/', None),
scanpy_tutorials=(
'https://scanpy-tutorials.readthedocs.io/en/latest',
None,
),
scanpy_tutorials=(scanpy_tutorials_url, None),
)


Expand Down Expand Up @@ -115,6 +114,16 @@ def setup(app):
app.add_stylesheet('css/custom.css')


def autolink(url_template, title_template='{}'):
from docutils import nodes
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
url = url_template.format(text)
title = title_template.format(text)
node = nodes.reference(rawtext, title, refuri=url, **options)
return [node], []
return role


# -- Options for other output formats ------------------------------------------


Expand Down
6 changes: 6 additions & 0 deletions docs/extensions/github_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def register_links(app: Sphinx, config: Config):
app.add_role(
'noteversion', AutoLink('noteversion', f'{gh_url}/releases/tag/{{}}')
)
# tutorial links
scanpy_tutorials_url = 'https://scanpy-tutorials.readthedocs.io/en/latest/'
app.add_role(
'tutorial',
AutoLink('tutorial', f'{scanpy_tutorials_url}/{{}}.html', '{}')
)


def setup(app: Sphinx):
Expand Down
3 changes: 2 additions & 1 deletion docs/release-latest.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.. role:: small
.. role:: smaller


.. rubric:: New functionality

- :func:`~scanpy.tl.ingest` maps labels and embeddings of reference data to new data, see the `ingest tutorial`_ :pr:`651` :smaller:`S Rybakov, A Wolf`
- :func:`~scanpy.tl.ingest` maps labels and embeddings of reference data to new data, see tutorial :tutorial:`integrating-data-using-ingest` :pr:`651` :smaller:`S Rybakov, A Wolf`
- :mod:`~scanpy.queries` recieved many updates including enrichment through gprofiler_ and more advanced biomart queries :pr:`467` :smaller:`I Virshup`
- :func:`~scanpy.set_figure_params` allows setting `figsize`

Expand Down

0 comments on commit 15ae39e

Please sign in to comment.