diff --git a/public/turtorial/01/README.md b/public/turtorial/01/README.md index 23760c6..f474ea2 100644 --- a/public/turtorial/01/README.md +++ b/public/turtorial/01/README.md @@ -11,6 +11,9 @@ color: red; } ``` +```js +console.log("122") +``` ## 什么是 HTML diff --git a/public/turtorial/02/README.md b/public/turtorial/02/README.md index 302946b..4452c6a 100644 --- a/public/turtorial/02/README.md +++ b/public/turtorial/02/README.md @@ -1 +1,7 @@ -# 什么是 CSS \ No newline at end of file +# 什么是 CSS + +```css +.greeting { + color: red; +} +``` \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 8ea6b6d..0407299 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,10 +29,10 @@ whenever(ctrl_r, () => {}) :date-locale="dateZhCN" inline-theme-disabled > - + - + @@ -71,14 +71,13 @@ + diff --git a/src/main.ts b/src/main.ts index f712e23..eb06613 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,10 +1,28 @@ import { createApp } from "vue" import { create } from "naive-ui" +import { marked } from "marked" import "normalize.css" import "github-markdown-css/github-markdown-light.css" import "highlight.js/styles/github.min.css" import App from "./App.vue" +import { markedHighlight } from "marked-highlight" +import hljs from "highlight.js" + +marked.use({ + gfm: true, + async: true, +}) +marked.use( + markedHighlight({ + langPrefix: "hljs language-", + highlight(code, lang) { + const language = hljs.getLanguage(lang) ? lang : "plaintext" + return hljs.highlight(code, { language }).value + }, + }), +) + const app = createApp(App) const naive = create() app.use(naive) diff --git a/src/store.ts b/src/store.ts index f0e03c8..dc66fd0 100644 --- a/src/store.ts +++ b/src/store.ts @@ -3,12 +3,16 @@ import { useStorage } from "@vueuse/core" const defaultHTML = `
黄岩一职
` const defaultCSS = `.welcome { color: red; + font-size: 24px; }` export const html = useStorage("web-html", defaultHTML) export const css = useStorage("web-css", defaultCSS) export const js = useStorage("web-js", "") +export const tab = useStorage("web-tab", "html") +export const size = useStorage("web-fontsize", 24) + export function reset(lang: "html" | "css" | "js") { if (lang === "html") { html.value = defaultHTML @@ -18,18 +22,3 @@ export function reset(lang: "html" | "css" | "js") { js.value = "" } } - -export const size = useStorage("web-fontsize", 24) -export function changeSize(num: number) { - size.value = num -} - -export const step = useStorage("web-turtorial-step", "01") -export function prev() { - let num = parseInt(step.value) - 1 - step.value = num.toString().padStart(2, "0") -} -export function next() { - let num = parseInt(step.value) + 1 - step.value = num.toString().padStart(2, "0") -}