fastai / nbdev

Create delightful software with Jupyter Notebooks
https://nbdev.fast.ai/
Apache License 2.0
4.8k stars 484 forks source link

sidebar generation does not work as expected when nbs are in folders 3 or more levels deep #1357

Closed deven-gqc closed 8 months ago

deven-gqc commented 11 months ago

Provide a minimally reproducible example

  1. start a new project with the nbdev_new template
  2. add new notebooks in the nbs folder 3 or more levels deep

This is what a project of mine look like

image

Upon running nbdev_preview, the sidebar is generated but it created a different section of a nb in the same category

image

The generated sidebar looks like this,

website:
  sidebar:
    contents:
      - index.ipynb
      - section: exp
        contents:
          - section: camvid
            contents:
              - exp/camvid/4 labels.ipynb
      - section: exp
        contents:
          - section: camvid
            contents:
              - exp/camvid/Untitled0.ipynb
      - section: exp
        contents:
          - section: camvid
            contents:
              - exp/camvid/camvid.ipynb
      - section: exp
        contents:
          - section: camvid
            contents:
              - exp/camvid/skimage save camvid labels.ipynb

It should ideally look like this

website:
  sidebar:
    contents:
      - index.ipynb
      - section: exp
        contents:
          - section: camvid
            contents:
              - exp/camvid/4 labels.ipynb
              - exp/camvid/Untitled0.ipynb
              - exp/camvid/camvid.ipynb
              - exp/camvid/skimage save camvid labels.ipynb

@hamelsmu do you think this is expected behavior or is it a bug?

hamelsmu commented 11 months ago

Seems like a bug - won't have time to look at this for a long time though :/

If you are up for please feel free to send a PR and I'll happily review

deven367 commented 8 months ago

Fixed in #1307. @hamelsmu can you please close this issue? this is now fixed.