Skip to content

Commit 0561038

Browse files
committed
Add subdirectory also to :doc: reference definitions
Fixes #168.
1 parent 207e1ec commit 0561038

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/subdir/a-notebook-in-a-subdir.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"\n",
4343
"</div>\n",
4444
"\n",
45+
"A link to a notebook in the same sub-directory: [link](toctree.ipynb).\n",
46+
"\n",
4547
"A link to a notebook in the parent directory: [link](../markdown-cells.ipynb).\n",
4648
"\n",
4749
"A link to a local file: [link](../images/notebook_icon.png).\n",

src/nbsphinx.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,10 +1076,8 @@ def apply(self):
10761076
target_docname = nbconvert.filters.posix_path(os.path.normpath(
10771077
os.path.join(os.path.dirname(env.docname), target)))
10781078
if target_docname in env.found_docs:
1079-
if target_ext:
1080-
target = target_docname + target_ext
1081-
target = target.lower()
1082-
target = '/' + target
1079+
target = target_docname + target_ext
1080+
target = '/' + target.lower()
10831081
linktext = node.astext()
10841082
xref = sphinx.addnodes.pending_xref(
10851083
reftype=reftype, reftarget=target, refdomain=refdomain,

0 commit comments

Comments
 (0)