mkdocs-terminal icon indicating copy to clipboard operation
mkdocs-terminal copied to clipboard

side-nav only shows items nested 2 levels deep

Open lispcat opened this issue 5 months ago • 3 comments

Description

The side-nav will only show items nested 2 levels deep. I've tried tweaking the markdown_extensions.toc.toc_depth and markdown_extensions.toc.baselevel variables, but got the same results.

Reproduction

mkdocs.yml:

site_name: test site

docs_dir: docs
site_dir: site

nav:
  - Home: index.md
  - level1:
    - level2:
      - About: about.md

theme:
  name: terminal

markdown_extensions:
  - toc:
      baselevel: "3"
      toc_depth: "3"

docs subdir structure:

├── docs
│   ├── about.md
│   └── index.md

docs/about.md:

this is the about.md file

docs/index.md:

this is the index.md file

Result: Image

Expected: I expected an About item nested below the level2 item.

Temporary workaround

I modified terminal/partials/side-nav/side-nav-item.html to support further nested items, but it's a dirty hack and could've broken something else:

https://github.com/lispcat/mkdocs-terminal/commit/a1e2da7064c2bc2491ff4a762823bd426d65c88f

Environment

  • mkdocs ver: 1.6.1
  • mkdocs-terminal ver: 4.7.0
  • pip ver: 25.2
  • OS: NixOS
  • browser: Librewolf
  • dev environment tool: devenv
    • devenv.nix:
{ pkgs, lib, config, inputs, ... }:

{
  env.GREET = "devenv";

  packages = [ pkgs.git ];

  languages.python = {
    enable = true;
    venv.enable = true;
    venv.requirements = ''
      mkdocs
      mkdocs-terminal
    '';
  };

  scripts = {
    docs-dev.exec = ''
      mkdocs serve
    '';
  };
}

lispcat avatar Aug 06 '25 00:08 lispcat

hi @lispcat ! thanks for writing in!

yes, you are right, currently only 2 levels of nesting are supported. however i would be happy to incorporate your terminal/partials/side-nav/side-nav-item.html update in https://github.com/lispcat/mkdocs-terminal/commit/a1e2da7064c2bc2491ff4a762823bd426d65c88f

let me pull it into a new feature branch i think i want to add a nesting cap feature so that the user can limit the number of displayed levels if they dont want to recurse over all the sub directories

ntno avatar Aug 14 '25 00:08 ntno

feature branch with your commit: https://github.com/ntno/mkdocs-terminal/commit/c63873a98f03e0f0ab3f8c92a95ffede28000dcc

i'll poke around in this side-nav-nesting branch and try adding a cap

ntno avatar Aug 14 '25 00:08 ntno

update: drafting changes in #194 i want to add documentation and tests before merging in (probably won't get to these until the weekend) let me know if you are interested in additional contributions or reviewing the PR @lispcat !

ntno avatar Aug 14 '25 01:08 ntno