Giter Club home page Giter Club logo

Comments (4)

shanyuhai123 avatar shanyuhai123 commented on May 24, 2024

在使用 v2 的过程中,由于 sidebar 需要手动配置,所以在写文档时会带来一个问题:
有些内容还是草稿,不添加到 sidebar 中就无法看到,而提交后 sidebar 又会导致不该显示的目录,手动修改虽行,但过于繁琐,后续看看能不能提个 PR 解决吧。

from vuepress-plugin-auto-sidebar.

shanyuhai123 avatar shanyuhai123 commented on May 24, 2024

在使用 v2 的过程中,由于 sidebar 需要手动配置,所以在写文档时会带来一个问题: 有些内容还是草稿,不添加到 sidebar 中就无法看到,而提交后 sidebar 又会导致不该显示的目录,手动修改虽行,但过于繁琐,后续看看能不能提个 PR 解决吧。

针对这种情况作了另辟蹊径的处理,在 config 中配置:

const sidebarConf = require('./sidebar')

module.exports = {
  plugins: [
    ["vuepress-plugin-auto-sidebar", {
      git: {
        // `add` 表示跟踪执行了 `git add` 的文件,`commit` 表示跟踪执行了 `git commit` 的文件
        // 不填写则跟踪所有状态
        trackStatus: 'add'
      }
    }]
  ],
  themeConfig: {
    sidebar: sidebarConf
  }
}

忽略未跟踪的文件,这样就不会在 sidebar 中产生它了。

from vuepress-plugin-auto-sidebar.

meizhaohui avatar meizhaohui commented on May 24, 2024

在使用过程中,可以设置侧边栏最大深度为2:

 "vuepress-plugin-auto-sidebar" : {
   // 侧边栏深度
   // the max value is 2 which extracts both h2 and h3 headers
   sidebarDepth: 2 
}

由于写文章中,有非常多的h4标题,如: 1.1.1.1, 1.1.1.2 等,如果想在侧边栏显示h4级标题,该如何设置呢?

from vuepress-plugin-auto-sidebar.

shanyuhai123 avatar shanyuhai123 commented on May 24, 2024

在使用过程中,可以设置侧边栏最大深度为2:

 "vuepress-plugin-auto-sidebar" : {
   // 侧边栏深度
   // the max value is 2 which extracts both h2 and h3 headers
   sidebarDepth: 2 
}

由于写文章中,有非常多的h4标题,如: 1.1.1.1, 1.1.1.2 等,如果想在侧边栏显示h4级标题,该如何设置呢?

这个控制不了,因为 vuepress1.xvuepress2.x 的默认主题都不支持更多的层级。

from vuepress-plugin-auto-sidebar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.