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

DOC: add a notebook with spaces in its file name #774

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
53 changes: 53 additions & 0 deletions doc/a notebook name with spaces.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"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": [
"# A Notebook With Spaces in Its File Name\n",
"\n",
"File names with spaces often need special treatment,\n",
"so it's probably better to avoid them.\n",
"\n",
"In Markdown links,\n",
"the spaces have to be replaced by `%10`,\n",
"as shown in\n",
"[the section about links](markdown-cells.ipynb#Links-to-Other-Notebooks).\n",
"\n",
"This is also relevant when using the\n",
"`nbsphinx-toctree` cell tag, as shown\n",
"[here](subdir/toctree.ipynb)."
]
}
],
"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.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
8 changes: 8 additions & 0 deletions doc/markdown-cells.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,14 @@
"[mylink]: subdir/a-notebook-in-a-subdir.ipynb\n",
"```\n",
"\n",
"When a notebook file name contains spaces,\n",
"they have to be replaced by `%10`, like in\n",
"[this link](../a%10notebook%10name%10with%10spaces.ipynb):\n",
"\n",
"```\n",
"[this link](../a%10notebook%10name%10with%10spaces.ipynb)\n",
"```\n",
"\n",
"Links to sub-sections are also possible, e.g.\n",
"[this subsection](subdir/a-notebook-in-a-subdir.ipynb#A-Sub-Section).\n",
"\n",
Expand Down
7 changes: 6 additions & 1 deletion doc/subdir/toctree.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
"\n",
"</div>\n",
"\n",
"The following cell is tagged with `nbsphinx-toctree` and contains a link to the notebook [yet-another.ipynb](../yet-another.ipynb) and an external link (which will only be visible in the HTML output).\n",
"The following cell is tagged with `nbsphinx-toctree` and contains a link to the notebooks\n",
"[yet-another.ipynb](../yet-another.ipynb) and\n",
"[a notebook name with spaces.ipynb](../a%10notebook%10name%10with%10spaces.ipynb)\n",
"and an external link (which will only be visible in the HTML output).\n",
"It also contains a section title which will be used as `toctree` caption\n",
"(which also will only be visible in the HTML output)."
]
Expand All @@ -113,6 +116,8 @@
"\n",
"[A Notebook that's just a \"toctree\" Target](../yet-another.ipynb)\n",
"\n",
"[A Notebook With Spaces in Its File Name](../a%10notebook%10name%10with%10spaces.ipynb)\n",
"\n",
"[An External Link (HTML only)](https://nbsphinx.readthedocs.io/)\n",
"\n",
"Only the first section title (optional) and links to other source files (and external links) are used,\n",
Expand Down
Loading