@ruan-cat/vitepress-preset-config 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.mjs +5 -3
- package/dist/theme.mjs +2 -0
- package/package.json +1 -1
- package/src/config.mts +4 -1
- package/src/theme.ts +6 -1
package/dist/config.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { merge as merge2, isUndefined, cloneDeep as cloneDeep2 } from "lodash-es
|
|
|
6
6
|
import consola from "consola";
|
|
7
7
|
import { addChangelog2doc, hasChangelogMd, copyReadmeMd } from "@ruan-cat/utils/node-esm";
|
|
8
8
|
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
9
|
+
import { copyOrDownloadAsMarkdownButtons } from "vitepress-plugin-llms";
|
|
9
10
|
|
|
10
11
|
// src/config/plugins.ts
|
|
11
12
|
import vitepressPluginLlmstxt from "vitepress-plugin-llms";
|
|
@@ -22,12 +23,12 @@ var defaultGitChangelogOptions = {
|
|
|
22
23
|
function getPlugins(extraConfig) {
|
|
23
24
|
const plugins = [];
|
|
24
25
|
const {
|
|
25
|
-
llmstxt,
|
|
26
|
+
llmstxt: llmstxt2,
|
|
26
27
|
gitChangelog = defaultGitChangelogOptions,
|
|
27
28
|
gitChangelogMarkdownSection
|
|
28
29
|
} = (extraConfig == null ? void 0 : extraConfig.plugins) || {};
|
|
29
|
-
if (!isFalse(
|
|
30
|
-
plugins.push(vitepressPluginLlmstxt(
|
|
30
|
+
if (!isFalse(llmstxt2)) {
|
|
31
|
+
plugins.push(vitepressPluginLlmstxt(llmstxt2));
|
|
31
32
|
}
|
|
32
33
|
if (!isFalse(gitChangelog)) {
|
|
33
34
|
plugins.push(GitChangelog(gitChangelog));
|
|
@@ -166,6 +167,7 @@ var defaultUserConfig = {
|
|
|
166
167
|
config(md) {
|
|
167
168
|
md.use(vitepressDemoPlugin);
|
|
168
169
|
MermaidPlugin(md);
|
|
170
|
+
md.use(copyOrDownloadAsMarkdownButtons);
|
|
169
171
|
},
|
|
170
172
|
codeTransformers: [
|
|
171
173
|
// @ts-ignore FIXME: 这里出现奇怪的类型报错 屏蔽了
|
package/dist/theme.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { NolebaseGitChangelogPlugin } from "@nolebase/vitepress-plugin-git-chang
|
|
|
3
3
|
import "@nolebase/vitepress-plugin-git-changelog/client/style.css";
|
|
4
4
|
import TwoslashFloatingVue from "@shikijs/vitepress-twoslash/client";
|
|
5
5
|
import "@shikijs/vitepress-twoslash/style.css";
|
|
6
|
+
import CopyOrDownloadAsMarkdownButtons from "vitepress-plugin-llms/vitepress-components/CopyOrDownloadAsMarkdownButtons.vue";
|
|
6
7
|
import Teek from "vitepress-theme-teek";
|
|
7
8
|
import "vitepress-theme-teek/index.css";
|
|
8
9
|
import { Mermaid } from "@leelaa/vitepress-plugin-extended";
|
|
@@ -10,6 +11,7 @@ function defaultEnhanceAppPreset({ app, router, siteData }) {
|
|
|
10
11
|
app.use(NolebaseGitChangelogPlugin);
|
|
11
12
|
app.use(TwoslashFloatingVue);
|
|
12
13
|
app.component("Mermaid", Mermaid);
|
|
14
|
+
app.component("CopyOrDownloadAsMarkdownButtons", CopyOrDownloadAsMarkdownButtons);
|
|
13
15
|
}
|
|
14
16
|
var defaultTheme = {
|
|
15
17
|
extends: Teek,
|
package/package.json
CHANGED
package/src/config.mts
CHANGED
|
@@ -14,7 +14,7 @@ export { addChangelog2doc, copyReadmeMd };
|
|
|
14
14
|
|
|
15
15
|
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
16
16
|
|
|
17
|
-
import llmstxt from "vitepress-plugin-llms";
|
|
17
|
+
import llmstxt, { copyOrDownloadAsMarkdownButtons } from "vitepress-plugin-llms";
|
|
18
18
|
|
|
19
19
|
import { defaultTeekConfig, handleTeekConfig, handlePlugins } from "./config/index.ts";
|
|
20
20
|
|
|
@@ -137,6 +137,9 @@ const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
|
|
|
137
137
|
|
|
138
138
|
// @ts-ignore
|
|
139
139
|
MermaidPlugin(md);
|
|
140
|
+
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
md.use(copyOrDownloadAsMarkdownButtons);
|
|
140
143
|
},
|
|
141
144
|
|
|
142
145
|
codeTransformers: [
|
package/src/theme.ts
CHANGED
|
@@ -13,12 +13,16 @@ import "@nolebase/vitepress-plugin-git-changelog/client/style.css";
|
|
|
13
13
|
import TwoslashFloatingVue from "@shikijs/vitepress-twoslash/client";
|
|
14
14
|
import "@shikijs/vitepress-twoslash/style.css";
|
|
15
15
|
|
|
16
|
+
/** @see https://github.com/okineadev/vitepress-plugin-llms/blob/main/README.md */
|
|
17
|
+
// @ts-ignore FIXME: 该组件直接使用时没有故障的 但是tsup打包有故障 故忽略类型报错
|
|
18
|
+
import CopyOrDownloadAsMarkdownButtons from "vitepress-plugin-llms/vitepress-components/CopyOrDownloadAsMarkdownButtons.vue";
|
|
19
|
+
|
|
16
20
|
// https://vp.teek.top/guide/quickstart.html#teek-引入
|
|
17
21
|
import Teek from "vitepress-theme-teek";
|
|
18
22
|
import "vitepress-theme-teek/index.css";
|
|
19
23
|
|
|
20
24
|
/** @see https://vitepress-ext.leelaa.cn/Mermaid.html#全局引入 */
|
|
21
|
-
// @ts-ignore
|
|
25
|
+
// @ts-ignore FIXME: 忽略类型导出的bug 避免tsup打包失败
|
|
22
26
|
import { Mermaid } from "@leelaa/vitepress-plugin-extended";
|
|
23
27
|
|
|
24
28
|
/**
|
|
@@ -44,6 +48,7 @@ function defaultEnhanceAppPreset({ app, router, siteData }: EnhanceAppContext) {
|
|
|
44
48
|
app.use(NolebaseGitChangelogPlugin);
|
|
45
49
|
app.use(TwoslashFloatingVue);
|
|
46
50
|
app.component("Mermaid", Mermaid);
|
|
51
|
+
app.component("CopyOrDownloadAsMarkdownButtons", CopyOrDownloadAsMarkdownButtons);
|
|
47
52
|
/**
|
|
48
53
|
* 放弃全局注册demo展示组件
|
|
49
54
|
* 在生产环境内使用peer对等依赖
|