From ca4364834bb61039ef3d591cd7a80a6f422b3918 Mon Sep 17 00:00:00 2001 From: abab2320 <1589841436@qq.com> Date: Fri, 23 May 2025 17:37:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90markdown=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front/vue-unilife/package.json | 1 + Front/vue-unilife/pnpm-lock.yaml | 12 ++ Front/vue-unilife/src/App.vue | 18 +-- Front/vue-unilife/src/assets/style/style.css | 18 +-- .../src/components/MarkdownRender.vue | 113 ++++++++++++++++++ .../PostContent/MarkdownContent.vue | 11 +- .../PostDetailPage/SidebarCategory.vue | 6 +- Front/vue-unilife/src/views/ForumHome.vue | 14 ++- Front/vue-unilife/src/views/LogPage.vue | 8 -- .../vue-unilife/src/views/PostDetailPage.vue | 42 ++++++- 10 files changed, 200 insertions(+), 43 deletions(-) create mode 100644 Front/vue-unilife/src/components/MarkdownRender.vue diff --git a/Front/vue-unilife/package.json b/Front/vue-unilife/package.json index f469a79..1c78b1a 100644 --- a/Front/vue-unilife/package.json +++ b/Front/vue-unilife/package.json @@ -15,6 +15,7 @@ "element-plus": "^2.9.7", "highlight.js": "^11.11.1", "marked": "^15.0.12", + "marked-highlight": "^2.2.1", "vee-validate": "^4.15.0", "vue": "^3.5.13", "vue-router": "^4.5.0", diff --git a/Front/vue-unilife/pnpm-lock.yaml b/Front/vue-unilife/pnpm-lock.yaml index 0480a9c..4c58f02 100644 --- a/Front/vue-unilife/pnpm-lock.yaml +++ b/Front/vue-unilife/pnpm-lock.yaml @@ -26,6 +26,9 @@ importers: marked: specifier: ^15.0.12 version: 15.0.12 + marked-highlight: + specifier: ^2.2.1 + version: 2.2.1(marked@15.0.12) vee-validate: specifier: ^4.15.0 version: 4.15.0(vue@3.5.13(typescript@5.7.3)) @@ -624,6 +627,11 @@ packages: magic-string@0.30.17: resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} + marked-highlight@2.2.1: + resolution: {integrity: sha512-SiCIeEiQbs9TxGwle9/OwbOejHCZsohQRaNTY2u8euEXYt2rYUFoiImUirThU3Gd/o6Q1gHGtH9qloHlbJpNIA==} + peerDependencies: + marked: '>=4 <16' + marked@15.0.12: resolution: {integrity: sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==} engines: {node: '>= 18'} @@ -1453,6 +1461,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + marked-highlight@2.2.1(marked@15.0.12): + dependencies: + marked: 15.0.12 + marked@15.0.12: {} math-intrinsics@1.1.0: {} diff --git a/Front/vue-unilife/src/App.vue b/Front/vue-unilife/src/App.vue index eb698a9..8e61555 100644 --- a/Front/vue-unilife/src/App.vue +++ b/Front/vue-unilife/src/App.vue @@ -10,14 +10,14 @@ import HeaderBar from './components/HeaderBar.vue' diff --git a/Front/vue-unilife/src/assets/style/style.css b/Front/vue-unilife/src/assets/style/style.css index 3579fd1..61e6f7d 100644 --- a/Front/vue-unilife/src/assets/style/style.css +++ b/Front/vue-unilife/src/assets/style/style.css @@ -15,14 +15,6 @@ -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - h1 { font-size: 3.2em; line-height: 1.1; @@ -90,6 +82,16 @@ button { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); } +.flow-container{ + padding:4%; + margin:0; + display: flex; + flex-direction: column; + width: 92%; + height: 100%; + overflow:auto; +} + #app { width: 100vw; height: 100vh; diff --git a/Front/vue-unilife/src/components/MarkdownRender.vue b/Front/vue-unilife/src/components/MarkdownRender.vue new file mode 100644 index 0000000..ee69758 --- /dev/null +++ b/Front/vue-unilife/src/components/MarkdownRender.vue @@ -0,0 +1,113 @@ + + + + + + + diff --git a/Front/vue-unilife/src/components/PostDetailPage/PostContent/MarkdownContent.vue b/Front/vue-unilife/src/components/PostDetailPage/PostContent/MarkdownContent.vue index 066203b..56b98d9 100644 --- a/Front/vue-unilife/src/components/PostDetailPage/PostContent/MarkdownContent.vue +++ b/Front/vue-unilife/src/components/PostDetailPage/PostContent/MarkdownContent.vue @@ -1,11 +1,16 @@ - 这是 Markdown 标题 - 这是一段内容,这里是模拟 Markdown 的渲染文本。 - + + +
这是一段内容,这里是模拟 Markdown 的渲染文本。