diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index b7bd70862c..a5a8f5cc97 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -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 */ diff --git a/docs/conf.py b/docs/conf.py index b99da26eda..70a66c2f06 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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), @@ -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), ) @@ -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 ------------------------------------------ diff --git a/docs/extensions/github_links.py b/docs/extensions/github_links.py index 88d62de6b7..40c86be257 100644 --- a/docs/extensions/github_links.py +++ b/docs/extensions/github_links.py @@ -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): diff --git a/docs/release-latest.rst b/docs/release-latest.rst index 72fd847fb8..2354dacf14 100644 --- a/docs/release-latest.rst +++ b/docs/release-latest.rst @@ -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`