Skip to content

Commit

Permalink
Require directories to be crosslinked to have a trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed May 17, 2021
1 parent dd6b402 commit 81addd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mkdocs_literate_nav/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def make_nav(
abs_link = out_item = posixpath.normpath(posixpath.join(roots[0], link).lstrip("/"))
if abs_link == ".":
abs_link = ""
if globber.isdir(abs_link):
if link.endswith("/") and globber.isdir(abs_link):
try:
out_item = get_nav_for_roots((abs_link, *roots))
except RecursionError as e:
Expand Down
8 changes: 8 additions & 0 deletions tests/markdown_to_nav/nested/test_dir_without_slash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
files:
- foo/bar.md
- foo/index.md
navs:
/: |
* [Foo](foo)
output:
- Foo: foo

0 comments on commit 81addd9

Please sign in to comment.