ozum / vuepress-bar

VuePress sidebar and navbar generator based on file and directory structure. Focus your documents, not sidebar or navbar.
90 stars 40 forks source link

sort correctly when subsection appears before file #57

Open andreaswachowski opened 1 year ago

andreaswachowski commented 1 year ago

When comparing the title when the child is an object, the associated folder-structure is ignored, which leads to weird results. This fix will recursively look for a string-child, thus preserving the folder structure in the comparison and maintaining the desired sort order.

Try the test case without the fix: The main sections will switch places, so that section 02 appears before section 01.

This only happens, however, with a subsection (here 01-section/a) that is alphabetically before the second child (here 01-section/b). When the folder a were renamed to c, the original logic works as expected.