搭建一个基于 Markdown的文档编辑框架 - vue3 - vuepress (中)

vue3-vuepress

搭建一个基于 Markdown的文档编辑框架 - vue3 - vuepress (中)
gitee:vue3-vuepress

基础配置

1.系统的配置文件

docs > .vuepress > config.ts

import { defineUserConfig, defaultTheme } from 'vuepress'

export default {
  lang: 'zh-CN',
  title: 'VuePress !',
  description: '加载失败',
  theme: defaultTheme({
    // 主题设置
    logo: '/nm.png',
    repo: 'https://github.com/bobo456123/VuepressDoc.git',
    repoLabel: 'GitHub',
    navbar: require('./config/nav'),
    sidebar: require('./config/sidebar'),
    editLink: false,
    editLinkText: '编辑此页',
    editLinkPattern: '',
    sidebarDepth: 2,
    lastUpdated: true,
    lastUpdatedText: '更新时间',
    contributors: false,
    contributorsText: '贡献者',
    notFound: [
      '这里什么都没有',
      '我们怎么到这来了?',
      '这是一个 404 页面',
      '看起来我们进入了错误的链接',
    ],
    backToHome: '返回首页',

    // a11y
    openInNewWindow: '在新窗口打开',
    toggleDarkMode: '切换夜间模式',
    toggleSidebar: '切换侧边栏',
  }),
}
2.菜单配置

创建两个文件

docs > .vuepress > config > nav.js

module.exports = [
    { text: 'VuePress', link: '/reference/vuepress/one' }, //标题 和 地址(路径跟上第一个文字的路径)
  {
    text: 'Vue',
    children: [
      { text: 'Vue3.x', link: 'https://v3.cn.vuejs.org/' },
      {
        text: 'Element Plus',
        link: 'https://element-plus.gitee.io/zh-CN/guide/design.html',
      },
    ],
  },
]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hBlrnNvS-1666084195028)(/vuepress1.png)]

docs > .vuepress > config > sidebar.js

module.exports = {
  '/reference/vuepress/': require('../../reference/vuepress/sidebar'), // 多个继续后面添加(sidebar、文章的侧边菜单)
}

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RqaiczX4-1666084195029)(/press2.png)]

3.新建文档书写目录 和文件

docs > reference > vuepress

docs > reference > vuepress > sidebar.md

module.exports = [
  {
    title: 'vuepress',
    collapsable: true,
    children: [
        { text: '第一部分', link: '/reference/vuepress/one' },
        { text: '第二部分', link: '/reference/vuepress/two' },
    ],
  },
]

docs > reference > vuepress > one.md

### one

docs > reference > vuepress > two.md

### two

至此 我们就可以书写笔记文章啦

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值