首页 > 其他分享 >VuePress2.0构建项目文档系统

VuePress2.0构建项目文档系统

时间:2023-06-01 15:55:06浏览次数:59  
标签:zh ts 添加 构建 vuepress https VuePress2.0 文档 TerraMours

VuePress2.0构建项目文档系统

参考TerraMours 官网。https://terramours.site/

文件结构参考:

image-20230530170541496

1.修改首页README.md

修改项目下的README.md,修改内容:

---
home: true
heroImage: images/hero.png
heroText: TerraMours
actions:
  - text: 快速开始
    link: /guide/
    type: primary
  - text: 演示站点
    link: http://43.134.164.127:8089/
    type: secondary
features:
- title: 简洁高效
  details: TerraMours 采用了 Masa的MinimalAPI,通过极简的代码实现了高效的 HTTP API 接口的同时,提供更高的性能和更低的延迟。
- title: 领域驱动设计(DDD)
  details: TerraMours 框架实现领域驱动设计(DDD)的落地,提供更好的业务识别和管理,更好的模块划分,更好的数据映射,更好的维护性和可扩展性。
- title: 扩展开发
  details: TerraMours 已经实现了用户管理、权限验证、日志管理等基础功能,开发者可以根据业务需求快速开发相关业务系统。
footer: MIT Licensed | Copyright (c) 2023 firstsaofan
---

2.修改package.json

添加脚本:

{
  "name": "TerraMours-Starter",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "homepage": "https://github.com/vuepress",
  "bugs": {
    "url": "https://github.com/vuepress/vuepress-next/issues"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/vuepress/vuepress-next.git"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@vuepress/client": "2.0.0-beta.62",
    "@vuepress/plugin-docsearch": "2.0.0-beta.62",
    "vue": "^3.3.4",
    "vuepress": "2.0.0-beta.62"
  }
}

3.补全.vuepress

在.vuepress下补全配置文件

1.创建配置文件

在.vuepress文件夹下创建文件config.js,内容:

import { defaultTheme } from 'vuepress'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { defineUserConfig} from 'vuepress'
import {
  navbarEn,
  navbarZh,
  sidebarEn,
  sidebarZh,
} from './configs/index.js'
// const isProd = process.env.NODE_ENV === 'production'
const isProd = false
export default defineUserConfig({
    // set site base to default value
    base: '/',

    // extra tags in `<head>`
    // head,

    // site-level locales config
    locales: {
        '/': {
          lang: 'zh-CN',
          title: 'TerraMours',
          description: 'TerraMours 开源项目',
        },
        '/en/': {
        lang: 'en-US',
        title: 'TerraMours',
        description: 'TerraMours FrameWork',
        },
    },
    // configure default theme
  theme: defaultTheme({
    logo: '/images/hero.png',
    repo: 'firstsaofan/TerraMours',
    docsDir: 'docs',

    // theme-level locales config
    locales: {
      /**
       * English locale config
       *
       * As the default locale of @vuepress/theme-default is English,
       * we don't need to set all of the locale fields
       */
      '/': {
        // navbar
        navbar: navbarZh,
        selectLanguageName: '简体中文',
        selectLanguageText: '选择语言',
        selectLanguageAriaLabel: '选择语言',
        // sidebar
        sidebar: sidebarZh,
        // page meta
        editLinkText: '在 GitHub 上编辑此页',
        lastUpdatedText: '上次更新',
        contributorsText: '贡献者',
        // custom containers
        tip: '提示',
        warning: '注意',
        danger: '警告',
        // 404 page
        notFound: [
          '这里什么都没有',
          '我们怎么到这来了?',
          '这是一个 404 页面',
          '看起来我们进入了错误的链接',
        ],
        backToHome: '返回首页',
        // a11y
        openInNewWindow: '在新窗口打开',
        toggleColorMode: '切换颜色模式',
        toggleSidebar: '切换侧边栏',
        
      },

      /**
       * Chinese locale config
       */
      '/en/': {
        // navbar
        navbar: navbarEn,
        // sidebar
        sidebar: sidebarEn,
        // page meta
        editLinkText: 'Edit this page on GitHub',
      },
    },

    themePlugins: {
      // only enable git plugin in production mode
      git: isProd,
      // use shiki plugin in production mode instead
      prismjs: !isProd,
    },
  }),
  // use plugins
  plugins: [
    docsearchPlugin({
      appId: '34YFD9IUQ2',
      apiKey: '9a9058b8655746634e01071411c366b8',
      indexName: 'vuepress',
      searchParameters: {
        facetFilters: ['tags:v2'],
      },
      locales: {
        '/': {
          placeholder: '搜索文档',
          translations: {
            button: {
              buttonText: '搜索文档',
              buttonAriaLabel: '搜索文档',
            },
            modal: {
              searchBox: {
                resetButtonTitle: '清除查询条件',
                resetButtonAriaLabel: '清除查询条件',
                cancelButtonText: '取消',
                cancelButtonAriaLabel: '取消',
              },
              startScreen: {
                recentSearchesTitle: '搜索历史',
                noRecentSearchesText: '没有搜索历史',
                saveRecentSearchButtonTitle: '保存至搜索历史',
                removeRecentSearchButtonTitle: '从搜索历史中移除',
                favoriteSearchesTitle: '收藏',
                removeFavoriteSearchButtonTitle: '从收藏中移除',
              },
              errorScreen: {
                titleText: '无法获取结果',
                helpText: '你可能需要检查你的网络连接',
              },
              footer: {
                selectText: '选择',
                navigateText: '切换',
                closeText: '关闭',
                searchByText: '搜索提供者',
              },
              noResultsScreen: {
                noResultsText: '无法找到相关结果',
                suggestedQueryText: '你可以尝试查询',
                reportMissingResultsText: '你认为该查询应该有结果?',
                reportMissingResultsLinkText: '点击反馈',
              },
            },
          },
        },
      },
    }),
  ],
})
    

2.添加public文件夹

存放一些公共文件,比如图标,xml等

1.添加images文件夹

保存图片,将logo放在文件夹下

3.添加configs文件夹

存放配置

1.添加navbar文件夹

导航栏配置

1.添加zh.ts(中文配置)

image-20230530170924937

内容:

import type { NavbarConfig } from 'vuepress'
export const navbarZh: NavbarConfig =[
    {
        text: '指南',
        link: '/guide/',
      },
      {
        text: '项目开发者',
        children: [
          {
            text:"firstsaofan",
            link:"https://www.firstsaofan.top/"
          },
          {
            text:"raokun",
            link:"https://www.raokun.top/"
          }
        ],
      },
]

2.添加index.ts(配置引用)

image-20230530170909251

内容:

export * from './en.js'
export * from './zh.js'

3.添加en.ts(英文配置)

同zh.ts

2.添加sidebar文件夹

侧边栏配置

1.添加zh.ts(中文配置)

image-20230530171018728

2.添加index.ts(配置引用)

image-20230530170956070

3.添加en.ts(英文配置)

同zh.ts

4.创建md文件

参考结构图,新增自己的MD文件,然后在sidebar的配置中添加对应的文件路径配置

5.启动项目命令

pnpm docs:dev

6.项目展示

参考TerraMours 官网。https://terramours.site/

image-20230530171423534

额外配置:全局查找

https://v2.vuepress.vuejs.org/zh/reference/plugin/docsearch.html

使用方法

pnpm i -D @vuepress/plugin-docsearch@next
import { docsearchPlugin } from '@vuepress/plugin-docsearch'

export default {
  plugins: [
    docsearchPlugin({
      // 配置项
    }),
  ],
}
阅读如遇样式问题,请前往个人博客浏览: https://www.raokun.top
拥抱ChatGPT:https://ai.terramours.site
开源项目地址:https://github.com/firstsaofan/TerraMours

标签:zh,ts,添加,构建,vuepress,https,VuePress2.0,文档,TerraMours
From: https://www.cnblogs.com/raok/p/17443997.html

相关文章

  • 文档注释
    基础注释@param{number}[duration]'[]'表示可选/***函数防抖*@listens*@param{function}func目标函数*@param{number}[duration]延迟执行的时间【[]表示可选】*@return{function}防抖的函数*/functiondobounce(func,duration=100){}......
  • 转载:用pageOffice控件实现 office word文档在线编辑另存为pdf的功能
    用pageOffice控件实现officeword文档在线编辑另存为pdf的功能1应用场景OA办公中,经常要将word文档转存为pdf方法,方式文档的查看。怎么实现word文档的转存为pdf呢?2实现方法通过pageOffice实现简单的在线打开编辑word后,只要增加一行document.getElementById("PageOfficeCt......
  • ES shrink ——一般是结合rollover一起使用的,一开始没有看懂官方shrink文档,当看了这个
    rolloverElasticsearch从5.0开始,为日志场景的用户提供了一个很不错的接口,叫rollover。其作用是:当某个别名指向的实际索引过大的时候,自动将别名指向下一个实际索引。因为这个接口是操作的别名,所以我们依然需要首先自己创建一个开始滚动的起始索引:1.#curl-XPUT'http://localh......
  • 构建之法3
    虽然作为一名程序员中的菜鸟我也深知“软件=程序+软件工程”。在此之前我们学习过一个个从小到大,从简到繁的程序,到了今天才知道这些只是作为一名合格的程序员的第一步,构建之法是一本很专业的书,不仅仅从专业的角度为我们阐释了软件工程是什么?总而言之从这本书中我初步了解到了如......
  • golang实现设计模式之构建者模式总结-代码、优缺点、适用场景
    构建者模式也是一种创建型的设计模式,该模式将一个复杂对象的构造与它的表示分离,使同样的构建过程可以创建不同的对象。大白话就是,构建者模式,从输出角度看依然是创建个对象实例,但是构建者模式更关注创建的细节,或者说一个对象的创建可以拆分为多个步骤,所有的步骤完成才创建出这个对......
  • 真的勇士,才敢把文档命名为「最终版」
    前几天,年轻的同事在群里发了一个文档,名字叫「XXXX最终版」。大家一看就知道,未来一定还会出现——最终版-1最终版-2真最终版最终最终版绝对不再改版……再改我就死给你看版……所以,我的做法是,命名一般是按日期来,名称最后写一些关键信息:「20170525XXXX」「20170527XXXX评审后修改......
  • 唯一客服 -基于ChatGPT和私有数据构建智能知识库和个性化AI
    基于ChatGPT和私有数据构建智能知识库和个性化AI1.注册开通2.上传文档3.智能助理更智能,基于ChatGPT大模型算法,回答准确,逻辑清晰更安全,支持私有化部署,文档数据本地化,安全可控更全面,可用于企业AI客服,企业内部知识查询&经验分享,员工自助服务,赋能企业外部合作伙伴、个人知识库等......
  • CSS的五种定位方式【哪一种脱离文档流】
    元素自身居中(非内容)块级元素居中:margin:0auto;行内元素和行内块元素:给上级元素添加text-align:center; 定位方式包括:静态定位相对定位绝对定位固定定位浮动定位静态定位(文档流定位)格式:position:static;(默认的定位方式)......
  • 小程序容器助力构建新型超级App软件应用架构
    所谓软件架构,就是软件系统的骨骼与框架。近年来,软件及开源技术迅猛发展,软件应用架构的概念也愈加普遍。它提供了一种组织和设计软件系统的有效方法,具有许多优势和好处:模块化和可维护性:软件应用架构将系统拆分为模块化的组件,每个组件负责特定的功能或任务。这种模块化的设计使得系统......
  • mysql参考文档
    mysql数据库官方文档https://dev.mysql.com/doc/refman/8.0/en/https://dev.mysql.com/doc/refman/5.7/en/治愈系的笑容常常让我深陷其中......