Skip to content

Commit 1eeb981

Browse files
committed
DOC: add a notebook with spaces in its file name
1 parent fdc25d8 commit 1eeb981

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

doc/a notebook name with spaces.ipynb

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"nbsphinx": "hidden"
7+
},
8+
"source": [
9+
"This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"# A Notebook With Spaces in Its File Name\n",
17+
"\n",
18+
"File names with spaces often need special treatment,\n",
19+
"so it's probably better to avoid them.\n",
20+
"\n",
21+
"In Markdown links,\n",
22+
"the spaces have to be replaced by `%10`,\n",
23+
"as shown in\n",
24+
"[the section about links](markdown-cells.ipynb#Links-to-Other-Notebooks).\n",
25+
"\n",
26+
"This is also relevant when using the\n",
27+
"`nbsphinx-toctree` cell tag, as shown\n",
28+
"[here](subdir/toctree.ipynb)."
29+
]
30+
}
31+
],
32+
"metadata": {
33+
"kernelspec": {
34+
"display_name": "Python 3 (ipykernel)",
35+
"language": "python",
36+
"name": "python3"
37+
},
38+
"language_info": {
39+
"codemirror_mode": {
40+
"name": "ipython",
41+
"version": 3
42+
},
43+
"file_extension": ".py",
44+
"mimetype": "text/x-python",
45+
"name": "python",
46+
"nbconvert_exporter": "python",
47+
"pygments_lexer": "ipython3",
48+
"version": "3.11.7"
49+
}
50+
},
51+
"nbformat": 4,
52+
"nbformat_minor": 4
53+
}

doc/markdown-cells.ipynb

+8
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,14 @@
544544
"[mylink]: subdir/a-notebook-in-a-subdir.ipynb\n",
545545
"```\n",
546546
"\n",
547+
"When a notebook file name contains spaces,\n",
548+
"they have to be replaced by `%10`, like in\n",
549+
"[this link](../a%10notebook%10name%10with%10spaces.ipynb):\n",
550+
"\n",
551+
"```\n",
552+
"[this link](../a%10notebook%10name%10with%10spaces.ipynb)\n",
553+
"```\n",
554+
"\n",
547555
"Links to sub-sections are also possible, e.g.\n",
548556
"[this subsection](subdir/a-notebook-in-a-subdir.ipynb#A-Sub-Section).\n",
549557
"\n",

doc/subdir/toctree.ipynb

+6-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@
9494
"\n",
9595
"</div>\n",
9696
"\n",
97-
"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",
97+
"The following cell is tagged with `nbsphinx-toctree` and contains a link to the notebooks\n",
98+
"[yet-another.ipynb](../yet-another.ipynb) and\n",
99+
"[a notebook name with spaces.ipynb](../a%10notebook%10name%10with%10spaces.ipynb)\n",
100+
"and an external link (which will only be visible in the HTML output).\n",
98101
"It also contains a section title which will be used as `toctree` caption\n",
99102
"(which also will only be visible in the HTML output)."
100103
]
@@ -113,6 +116,8 @@
113116
"\n",
114117
"[A Notebook that's just a \"toctree\" Target](../yet-another.ipynb)\n",
115118
"\n",
119+
"[A Notebook With Spaces in Its File Name](../a%10notebook%10name%10with%10spaces.ipynb)\n",
120+
"\n",
116121
"[An External Link (HTML only)](https://nbsphinx.readthedocs.io/)\n",
117122
"\n",
118123
"Only the first section title (optional) and links to other source files (and external links) are used,\n",

0 commit comments

Comments
 (0)