feat: add `@` alias for include

This commit is contained in:
Mr.Hope 2023-04-28 17:56:30 +08:00
parent 76b220540b
commit d993af3421
16 changed files with 30 additions and 12 deletions

View File

@ -1,8 +1,11 @@
import { getDirname, path } from "@vuepress/utils";
import { hopeTheme } from "vuepress-theme-hope";
import navbar from "./navbar.js";
import sidebar from "./sidebar/index.js";
const __dirname = getDirname(import.meta.url);
export default hopeTheme({
logo: "/logo.png",
hostname: "https://javaguide.cn/",
@ -51,7 +54,18 @@ export default hopeTheme({
codetabs: true,
container: true,
figure: true,
include: true,
include: {
resolvePath: (file, cwd) => {
if (file.startsWith("@"))
return path.resolve(
__dirname,
"../snippets",
file.replace("@", "./")
);
return path.resolve(cwd, file);
},
},
tasklist: true,
},
feed: {

View File

@ -12,4 +12,4 @@ icon: "configuration"
![](https://oss.javaguide.cn/xingqiu/image-20220304102536445.png)
<!-- @include: ../planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -12,4 +12,4 @@ icon: "transanction"
![](https://oss.javaguide.cn/xingqiu/image-20220304102536445.png)
<!-- @include: ../planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -9,4 +9,4 @@ category: 高可用
![](https://oss.javaguide.cn/xingqiu/image-20220304102536445.png)
<!-- @include: ../planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -19,4 +19,4 @@ head:
![](https://oss.javaguide.cn/xingqiu/image-20220304102536445.png)
<!-- @include: ../planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -20,7 +20,7 @@ title: JavaGuideJava学习&&面试指南)
[GitHub](https://github.com/Snailclimb/JavaGuide) | [Gitee](https://gitee.com/SnailClimb/JavaGuide)
<!-- @include: ./banner.snippet.md -->
<!-- @include: @banner.snippet.md -->
## 项目相关

View File

@ -19,4 +19,4 @@ category: 知识星球
![](https://oss.javaguide.cn/xingqiu/image-20220628101805897.png)
<!-- @include: ./planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -15,4 +15,4 @@ category: 知识星球
![](https://oss.javaguide.cn/xingqiu/image-20220628102848236.png)
<!-- @include: ./planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -9,7 +9,7 @@ category: 走近项目
《JavaGuide 面试突击版》在我的公众号后台回复“**PDF**”即可获取,免费的。除了 《JavaGuide 面试突击版》之外,还会免费送你多本优质面试 PDF 手册。
<!-- @include: ./gzh.md -->
<!-- @include: @gzh.md -->
## 如何看待 JavaGuide 的 star 数量很多?

View File

@ -16,7 +16,7 @@ footer: |-
<a href="https://beian.miit.gov.cn/" target="_blank">鄂ICP备2020015769号-1</a> | 主题: <a href="https://vuepress-theme-hope.github.io/v2/" target="_blank">VuePress Theme Hope</a>
---
<!-- @include: ./banner.snippet.md -->
<!-- @include: @banner.snippet.md -->
## 关于网站
@ -44,4 +44,4 @@ footer: |-
最新更新会第一时间同步在公众号,推荐关注!另外,公众号上有很多干货不会同步在线阅读网站。
<!-- @include: ./gzh.snippet.md -->
<!-- @include: @gzh.snippet.md -->

View File

@ -12,4 +12,4 @@ icon: "design"
![](https://oss.javaguide.cn/xingqiu/image-20220304102536445.png)
<!-- @include: ../planet.snippet.md -->
<!-- @include: @planet.snippet.md -->

View File

@ -22,6 +22,7 @@
},
"dependencies": {
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/utils": "2.0.0-beta.61",
"husky": "8.0.3",
"markdownlint-cli": "0.33.0",
"nano-staged": "0.8.0",

View File

@ -4,6 +4,9 @@ dependencies:
'@vuepress/client':
specifier: 2.0.0-beta.61
version: 2.0.0-beta.61
'@vuepress/utils':
specifier: 2.0.0-beta.61
version: 2.0.0-beta.61
husky:
specifier: 8.0.3
version: 8.0.3