-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOC: Separate notebooks for different gallery types
- Loading branch information
Showing
8 changed files
with
259 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"nbsphinx": "hidden" | ||
}, | ||
"source": [ | ||
"This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Gallery With Links (HTML only)\n", | ||
"\n", | ||
"Contrary to\n", | ||
"[nbsphinx-gallery](gallery-with-nested-documents.ipynb),\n", | ||
"the cell tag/metadata `nbsphinx-link-gallery`\n", | ||
"creates a gallery from notebooks (and other source) files\n", | ||
"without including them as sub-sections.\n", | ||
"Other than that, it works in a similar way,\n", | ||
"but only the options\n", | ||
"`\"name\"`,\n", | ||
"`\"caption\"` and\n", | ||
"`\"reversed\"` are supported.\n", | ||
"In LaTeX output, this has no effect.\n", | ||
"The cell is ignored and nothing is added to the LaTeX document.\n", | ||
"\n", | ||
"In reST files\n", | ||
"(and [raw reST cells](../raw-cells.ipynb#reST)),\n", | ||
"the\n", | ||
"[nblinkgallery](../a-normal-rst-file.rst#thumbnail-link-galleries-html-only)\n", | ||
"directive can be used.\n", | ||
"\n", | ||
"The following Markdown cell\n", | ||
"has the `nbsphinx-link-gallery` tag,\n", | ||
"which turns the contained links into a gallery\n", | ||
"and uses the first section title as `caption`:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"tags": [ | ||
"nbsphinx-link-gallery" | ||
] | ||
}, | ||
"source": [ | ||
"## This is a thumbnail gallery with links to existing documents:\n", | ||
"\n", | ||
"This paragraph will be ignored.\n", | ||
"Only links are taken into account.\n", | ||
"\n", | ||
"## This section title will be ignored\n", | ||
"\n", | ||
"... because only the first title in this cell is used.\n", | ||
"\n", | ||
"* [Dummy Notebook 2](due-rst.pct.py)\n", | ||
"* [An Orphan Notebook](../orphan.ipynb)\n", | ||
"* [Notebook About Code Cells](../code-cells.ipynb)\n", | ||
"* [Thumbnail With a Tooltip](cell-metadata.ipynb)\n", | ||
"* [A Page About Contributing (Not a Notebook)](../contributing.rst)\n", | ||
"* [A Page Using reStructuredText (Not a Notebook)](../a-normal-rst-file.rst)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"nbsphinx": "hidden" | ||
}, | ||
"source": [ | ||
"This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Gallery With Nested Documents\n", | ||
"\n", | ||
"You can create\n", | ||
"[thumbnail galleries in reST files](../a-normal-rst-file.rst#thumbnail-galleries),\n", | ||
"but you can also create such galleries in Jupyter notebooks\n", | ||
"by adding the `nbsphinx-gallery`\n", | ||
"cell tag or metadata,\n", | ||
"which is used just like the\n", | ||
"[nbsphinx-toctree](../subdir/toctree.ipynb) cell tag/metadata.\n", | ||
"For possible options, see the [toctree](../subdir/toctree.ipynb) notebook.\n", | ||
"\n", | ||
"<div class=\"alert alert-info\">\n", | ||
"\n", | ||
"Note\n", | ||
"\n", | ||
"In LaTeX output this behaves just like ``toctree``,\n", | ||
"i.e. no thumbnail gallery is shown,\n", | ||
"but the linked files are included in the document.\n", | ||
"\n", | ||
"Like with ``toctree`` you should avoid adding content\n", | ||
"after a gallery (except other toctrees and galleries)\n", | ||
"because this content would appear in the LaTeX output\n", | ||
"*after* the content of all included source files,\n", | ||
"which is probably not what you want.\n", | ||
"\n", | ||
"</div>\n", | ||
"\n", | ||
"The following cell has the `nbsphinx-gallery` tag,\n", | ||
"which creates a thumbnail gallery.\n", | ||
"The *first* section title in that cell (if available)\n", | ||
"is used as `caption` (unless it is already given in the metadata).\n", | ||
"\n", | ||
"The notebooks in the following gallery describe different ways\n", | ||
"how to select which images are used as thumbnails.\n", | ||
"The notebooks are added as sub-sections under the current section,\n", | ||
"just like when using ``toctree``.\n", | ||
"If you want to create a gallery from links to notebooks\n", | ||
"that are already included somewhere else,\n", | ||
"you can use [nbsphinx-link-gallery](gallery-with-links.ipynb)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"tags": [ | ||
"nbsphinx-gallery" | ||
] | ||
}, | ||
"source": [ | ||
"This section title will be used as ``caption``:\n", | ||
"\n", | ||
"## This is a thumbnail gallery with sub-documents:\n", | ||
"\n", | ||
"This paragraph will be ignored.\n", | ||
"Only links and the first section title are scanned,\n", | ||
"everything else is ignored.\n", | ||
"\n", | ||
"* [Using a Cell Tag to Select a Thumbnail](cell-tag.ipynb)\n", | ||
"* [Using Cell Metadata to Select a Thumbnail](cell-metadata.ipynb)\n", | ||
"* [Choosing from Multiple Outputs](multiple-outputs.ipynb)\n", | ||
"* [No Thumbnail Available](no-thumbnail.ipynb)\n", | ||
"* [Specifying a Thumbnail File](thumbnail-from-conf-py.ipynb)\n", | ||
"\n", | ||
"## This section title will be ignored\n", | ||
"\n", | ||
"... because only the first title in this cell is used." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.