Skip to content
/ kit Public

使用vitepress将博客和工具库的markdown文件生成为网页

Notifications You must be signed in to change notification settings

wenonly/kit

Repository files navigation

Kit

当前文档最初只是用于打包组件库,并展示组件库的文档,后面不断扩展就将博客迁移到了当前文档中。

Kit代表成套的工具,我计划将开发过程中好用的工具都放在这里,打包并生成方便查看的文档,能够在文档中直接预览组件的效果。

文档语法

本项目文档使用vitepress,详细语法阅读文档。 又对vitepress进行了一些扩展。

在原有语法的基础上加了一些其它语法。

  1. 读取 typescript 文件中的 interface,生成文档表格。这样只需要在编写库的时候定义好类型,在文档中引入文件即可按表格展示库的参数说明。

    <!-- 文件路径::params:InterfaceName -->
    
    <<< @/packages/kit/src/utils/index.ts::params:IConfig
  2. 可以在文档或主题中导入博客数据列表

    import blogConfig from "config:blog";
  3. 可以在文档中导入html路径,直接展示效果和源码。

    <script setup>
    import { HtmlViewer } from "@wenonly/html-viewer";
    import viewerData from "./index.html?viewer";
    </script>
    
    <html-viewer :src="viewerData.source" iframeHeight="calc(100vh - 451px)" />
  4. 可以在文档中使用 mermaid 语法

    Code with ```mmd

    flowchart LR
    Start --> Stop

    Visualize with ```mermaid

    flowchart LR
    Start --> Stop
    
    Loading

编译所有 packages 目录中的库

pnpm -r run build

发布 packages 目录中编译好的库

# 生成变更集
pnpm changeset
# 修改版本
pnpm changeset version
# 发布
pnpm changeset publish

About

使用vitepress将博客和工具库的markdown文件生成为网页

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published