Skip to content

Commit

Permalink
DOC: add a notebook with spaces in its file name
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed May 2, 2024
1 parent fdc25d8 commit 1eeb981
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
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

0 comments on commit 1eeb981

Please sign in to comment.