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

Strongly recommend supporting pinyinSidebar #55

Open caojiantao opened 1 year ago

caojiantao commented 1 year ago

I noticed that there is a pinyinNav used to be compatible with vuepress-pluin-permalink-pinyin, it seems that it forgot to be compatible with sidebar

/**
 * Translate chinese to pinyin.
 * Compatible with vuepress-pluin-permalink-pinyin.
 * @param {Array} navArr
 */
function transliteratePinyin(navArr) {
  return navArr.map(nav => {
    const result = { ...nav };
    if (nav.link) {
      result.link = slugify(nav.link, { ignore: ["/", "."] });
    }
    if (nav.items) {
      result.items = transliteratePinyin(nav.items);
    }
    return result;
  });
}
ozum commented 1 year ago

I need help supporting pinyin. Would you like to add a PR?

caojiantao commented 1 year ago

I need help supporting pinyin. Would you like to add a PR?

It is my pleasure.