QC2168 / vite-plugin-vitepress-auto-sidebar

The vite plugin that automatically generates sidebar data by scanning directories, based on vitepress
MIT License
85 stars 12 forks source link

增加两个功能:指定文章前缀让文章可以排序 / 菜单增加了折叠配置 #5

Closed wcySpring closed 1 year ago

wcySpring commented 1 year ago

你好,我在使用的过程中在我的本地案例中增加了

菜单增加了折叠配置

image

文章可以排序

image image

代码上我增加了两个配置

image

wcySpring commented 1 year ago

如果可以的话 我可以将我的代码合并过来

QC2168 commented 1 year ago

@wcySpring 哈喽 兄弟,可以提交个Pr,没问题的话我这边合并一下

QC2168 commented 1 year ago

有选项更变时,要记得更新下README.md

wcySpring commented 1 year ago

已经更新 但代码风格配置不同需要二次格式化一下

QC2168 commented 1 year ago

嗯 我后续追加下lint

wcySpring commented 1 year ago

hello, 指定文章前缀 功能出发地点是文字是有顺序的,我想通过特定名字标识符用来,将文件按照顺序展示。如果我 没有按照特定标识符排序如下 image 但实际顺序我先颠倒过来因此我用了1. 2.来标记 image

但我在菜单展示后的效果并不想展示 1. 2. 因为他仅仅作为一个我文章顺序标记 image

可能你错误理解我的pr 我的清除前缀是吧,提供特殊符号 例如. 前面的都清除掉,当然也可能是 @ # 任何符合 1#css 2#ass,变成 css ass

function removePrefix(str, identifier) {
    const index = str.indexOf(identifier)
    if (index === -1) {
        // 如果字符串中不存在标识符,则返回原始字符串
        return str
    } else {
        // 否则返回标识符后面的所有字符
        return str.slice(index + identifier.length)
    }
}
wcySpring commented 1 year ago

如果有需要的话 我可以将我之前pr在提交回来,并不是现在的简单字符串替换为空,希望的是一个更加动态的