jooy2 / vitepress-sidebar

🔌 VitePress Sidebar is a plugin for VitePress that automatically configures and manages the sidebar of your page with simple settings.
https://vitepress-sidebar.cdget.com
MIT License
158 stars 7 forks source link

`sortMenusOrderNumericallyFromLinkwork` doesn't work on folder with no link #183

Open trdthg opened 1 week ago

trdthg commented 1 week ago

Hi! Currently, I use useFolderTitleFromIndexFileand useTitleFromFileHeading

I want to implement the following sorting:

1-xxx(folder)
  - index.md
  - xxx.md
2-xxx.md(file)
3-xxx(folder)
  - index.md
  - xxx.md

Is there something like sortBy[File|Folder]Name option works for both file and folder?

By the way, I don't want to use filename as the title, or use Frontmatter

jooy2 commented 1 week ago

Hello! Thank you for using vitepress-sidebar.

All sorting is done after importing the headings from a file or frontmatter, markdown heading, so you can try first to see how the imported headings affect the sorting.

If your titles contain numbers, you need to set the sortMenusOrderNumericallyFromTitle option to true to sort them in the correct order. In contrast, you should use the sortMenusOrderNumericallyFromLink option instead, as it sorts based on the value of the link, not the title.

If you're still having issues, please provide a specific reproduction with your folder structure and we'll take a look.

Notes: If you set the debugPrint option to true, you can see the full settings and output in the console.

Regards,

trdthg commented 1 week ago

I have marked the titles in the example below, assuming they all start with # This is Title, they will not include any numbers

1-bbb(folder)
  - index.md ---------- # This is Title
  - xxx.md
2-ccc.md(file) -------- # This is Title
3-aaa(folder)
  - index.md ---------- # This is Title
  - xxx.md

So I think sortMenusOrderNumericallyFromTitle or sortMenusOrderNumericallyFromLink won't be useful

Is this an AI automatic reply? Are you sure you have carefully reviewed the issue?