Skip to content

Commit a793a2b

Browse files
committed
feat: 🎸 update packages; rust playground
✅ Closes: 1
1 parent 5ca46da commit a793a2b

File tree

80 files changed

+2956
-2367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2956
-2367
lines changed

.vitepress/config.mts

+26-14
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ import { defineConfig } from "vitepress";
33
import { SearchPlugin } from "@ver5/vitepress-plugin-search";
44

55
import markIt from "markdown-it-mark";
6-
import { REPO_URL, SRC_DOC, OUT_DIR, AUTHOR } from "./const";
7-
import { gHLink2JSON } from "./utils";
6+
import { REPO_URL, SRC_DOC, OUT_DIR, BASE_PATH, link_plugin_rules } from "./const";
87
import nav from "./nav";
98
import { books, sidebar } from "./sidebar";
10-
import { linkPlugin } from "./plugins/linkPlugin";
11-
import { rustCodePlugin } from "./plugins/rustcode/runCodePlugin";
12-
import { imageSizePlugin } from "./plugins/imagePlugin";
13-
import { alignPlugin } from "./plugins/alignPlugin";
149

15-
const BASE_PATH = gHLink2JSON(REPO_URL).label.replace(AUTHOR, '');
10+
import { InlineLinkPreviewElementTransform } from "@ver5/vitepress-plugin-link-preview/markdown";
11+
12+
import { type rustPlaygroundOptions, rustPlaygroundPlugin } from "@ver5/vitepress-plugin-rust-playground/markdown";
13+
import { type ImageOptions, imagePlugin } from "@ver5/markdown-it-image";
14+
import { type InternalLinkOptions, internalLinkPlugin } from "@ver5/markdown-it-internal-link";
15+
import { alignPlugin } from "@ver5/markdown-it-align";
1616

17-
console.log(resolve(__dirname))
1817
// https://vitepress.dev/reference/site-config
1918
export default defineConfig({
2019
lang: "zh-CN",
@@ -41,20 +40,33 @@ export default defineConfig({
4140
allow: [],
4241
ignore: [],
4342
tokenize: "forward",
44-
separator: ' ', // fix search result link problems
43+
separator: " ", // fix search result link problems
4544
}),
4645
],
4746
},
4847
lastUpdated: true,
4948
cleanUrls: false,
5049
markdown: {
50+
container: {
51+
tipLabel: "提示",
52+
warningLabel: "警告",
53+
dangerLabel: "危险",
54+
infoLabel: "信息",
55+
detailsLabel: "详细信息",
56+
},
5157
lineNumbers: true,
5258
config(md) {
53-
alignPlugin(md);
54-
markIt(md);
55-
linkPlugin(md, { books });
56-
rustCodePlugin(md);
57-
imageSizePlugin(md);
59+
md
60+
.use<rustPlaygroundOptions>(rustPlaygroundPlugin)
61+
.use(markIt)
62+
.use(alignPlugin)
63+
.use<InternalLinkOptions>(internalLinkPlugin, {
64+
sidebar: books,
65+
base: BASE_PATH,
66+
rules: link_plugin_rules
67+
})
68+
.use<ImageOptions>(imagePlugin)
69+
.use(InlineLinkPreviewElementTransform);
5870
},
5971
},
6072
themeConfig: {

.vitepress/const.ts

+22-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,27 @@ export const SRC_DOC = "docs";
33

44
export const OUT_DIR = "dist";
55

6-
export const AUTHOR = 'uxiew'
6+
export const AUTHOR = "uxiew";
77

8-
export const REPO_URL = 'https://github.com/uxiew/rust_study'
8+
export const BASE_PATH = "/rust_study";
99

10-
export const RUST_REPO_URL = 'https://github.com/rust-lang/rust'
10+
export const REPO_URL = "https://github.com/uxiew" + BASE_PATH;
11+
12+
export const RUST_REPO_URL = "https://github.com/rust-lang/rust";
13+
14+
export const link_plugin_rules = {
15+
"RFC 文档|RFC 项目": "https://rust-lang.github.io/rfcs/",
16+
"RFC 1216": "https://rust-lang.github.io/rfcs/1216-bang-type.html",
17+
"RFC 12684": "https://github.com/rust-lang/rust/pull/53693",
18+
19+
"rust-lang/rust": RUST_REPO_URL,
20+
21+
"src/std/prelude/": "https://doc.rust-lang.org/src/std/prelude/mod.rs.html#102",
22+
23+
"std::prelude": "https://doc.rust-lang.org/std/prelude/index.html",
24+
"std::marker": "https://doc.rust-lang.org/std/marker/index.html",
25+
"std::sync::atomic": "https://doc.rust-lang.org/std/sync/atomic/index.html",
26+
"std::panic": "https://doc.rust-lang.org/std/panic/index.html",
27+
"std::sync::mpsc": "https://doc.rust-lang.org/std/sync/mpsc/index.html",
28+
"std::thread::spawn": "https://doc.rust-lang.org/std/thread/fn.spawn.html",
29+
};

.vitepress/nav.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ export default [
1212
items: [
1313
{ text: "Rust 官网", link: "https://www.rust-lang.org/" },
1414
{ text: "Rust 源码", link: "https://github.com/rust-lang/rust/blob/master/library/" },
15-
{ text: "Rust blog", link: "https://blog.rust-lang.org/" },
15+
{ text: "Rust 博客", link: "https://blog.rust-lang.org/" },
1616
{ text: "Rust 标准库", link: "https://doc.rust-lang.org/std/" },
1717
{ text: "Rust Playground", link: "https://play.rust-lang.org/" },
1818
{ text: "Rust 参考", link: "https://doc.rust-lang.org/reference/" },
1919
{ text: "Rust 秘典(死灵书)", link: "https://doc.rust-lang.org/nomicon/" },
2020
{ text: "Rust 未稳定特性手册", link: "https://doc.rust-lang.org/nightly/unstable-book/" },
2121
{ text: "Rust 版本指南", link: "https://doc.rust-lang.org/nightly/edition-guide/" },
2222
{ text: "Rust RFCs", link: "https://rust-lang.github.io/rfcs/" },
23+
{ text: "Rust API 指南", link: "https://rust-lang.github.io/api-guidelines/" },
2324
{ text: "Rust 社区", link: "https://users.rust-lang.org/" },
2425
{ text: "cargo 文档", link: "https://doc.rust-lang.org/cargo/" },
2526
{ text: "rustc 文档", link: "https://doc.rust-lang.org/rustc/" },
@@ -49,6 +50,7 @@ export default [
4950
{ text: "Rust Cookbook", link: "https://rust-lang-nursery.github.io/rust-cookbook/" },
5051
{ text: "The Rust Performance Book", link: "https://nnethercote.github.io/perf-book/profiling.html" },
5152
{ text: "Rust Atomics and Locks", link: "https://rustcc.github.io/Rust_Atomics_and_Locks/" },
53+
{ text: "Command Line Applications in Rust", link: "https://rust-cli.github.io/book/index.html/" },
5254
],
5355
},
5456
];

.vitepress/plugins/README.md

-22
This file was deleted.

.vitepress/plugins/alignPlugin.ts

-96
This file was deleted.

.vitepress/plugins/autoSidebar.ts

-141
This file was deleted.

0 commit comments

Comments
 (0)