From db87a1d67578eafd48fe10849d6bb0fcf5b03ba9 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 26 Feb 2025 14:44:05 +0800 Subject: [PATCH] update --- package-lock.json | 10 ++++++++++ package.json | 1 + public/turtorial/01/README.md | 4 ++++ src/components/Tutorial.vue | 3 +++ src/main.ts | 4 +++- src/utils.ts | 27 +++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/utils.ts diff --git a/package-lock.json b/package-lock.json index 5ee259a..d81db1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "github-markdown-css": "^5.8.1", "highlight.js": "^11.11.1", "marked": "^15.0.7", + "marked-alert": "^2.1.2", "marked-highlight": "^2.2.1", "naive-ui": "^2.41.0", "normalize.css": "^8.0.1", @@ -1860,6 +1861,15 @@ "node": ">= 18" } }, + "node_modules/marked-alert": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/marked-alert/-/marked-alert-2.1.2.tgz", + "integrity": "sha512-EFNRZ08d8L/iEIPLTlQMDjvwIsj03gxWCczYTht6DCiHJIZhMk4NK5gtPY9UqAYb09eV5VGT+jD4lp396E0I+w==", + "license": "MIT", + "peerDependencies": { + "marked": ">=7.0.0" + } + }, "node_modules/marked-highlight": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/marked-highlight/-/marked-highlight-2.2.1.tgz", diff --git a/package.json b/package.json index 8c49e25..4adda00 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "github-markdown-css": "^5.8.1", "highlight.js": "^11.11.1", "marked": "^15.0.7", + "marked-alert": "^2.1.2", "marked-highlight": "^2.2.1", "naive-ui": "^2.41.0", "normalize.css": "^8.0.1", diff --git a/public/turtorial/01/README.md b/public/turtorial/01/README.md index bfd4239..efc486e 100644 --- a/public/turtorial/01/README.md +++ b/public/turtorial/01/README.md @@ -1,5 +1,9 @@ # HTML 基本标签 +> [!NOTE] +> 这是测试的版本 + + ## 标题 `h1` 到 `h6`,一共六级标题。 diff --git a/src/components/Tutorial.vue b/src/components/Tutorial.vue index f44a725..5bba9a1 100644 --- a/src/components/Tutorial.vue +++ b/src/components/Tutorial.vue @@ -115,9 +115,12 @@ watch(step, render) .markdown-body pre code { white-space: pre-wrap; + padding: 0; + font-size: 1rem; } .codeblock-action { + margin-bottom: 1rem; font-family: v-sans, system-ui, diff --git a/src/main.ts b/src/main.ts index 7555cc8..2d031fe 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,9 +8,10 @@ import "github-markdown-css/github-markdown-light.css" //@ts-ignore import "highlight.js/styles/github.min.css" import App from "./App.vue" - +import markedAlert from "marked-alert" import { markedHighlight } from "marked-highlight" import hljs from "highlight.js" +import { alertVariants } from "./utils" marked.use({ gfm: true, @@ -25,6 +26,7 @@ marked.use( }, }), ) +marked.use(markedAlert({ variants: alertVariants })) const app = createApp(App) const naive = create() diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..fb27634 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,27 @@ +export const alertVariants = [ + { + type: "note", + icon: '', + title: "注意", + }, + { + type: "tip", + icon: '', + title: "提示", + }, + { + type: "important", + icon: '', + title: "重要", + }, + { + type: "warning", + icon: '', + title: "警告", + }, + { + type: "caution", + icon: '', + title: "小心", + }, +]