From c8541b37e41877eff91b48213c4f07904dbee7e2 Mon Sep 17 00:00:00 2001 From: Elihuso Quigley Date: Sat, 29 Jun 2024 10:35:03 +0800 Subject: [PATCH] [+] Top markdown --- package.json | 2 + src/assets/top.md | 7 + src/components/ContentCard.vue | 6 +- src/global.d.ts | 2 + src/shims.d.ts | 14 + src/style/markdown.scss | 41 ++ src/style/mocha.sass | 29 +- src/views/ContentField.vue | 14 +- vite.config.ts | 6 +- vite/markdown.ts | 15 + yarn.lock | 733 ++++++++++++++++++++++++++++++++- 11 files changed, 852 insertions(+), 17 deletions(-) create mode 100644 src/assets/top.md create mode 100644 src/global.d.ts create mode 100644 src/shims.d.ts create mode 100644 src/style/markdown.scss create mode 100644 vite/markdown.ts diff --git a/package.json b/package.json index dbddd01..eedb08b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "fs-extra": "^11.2.0", "katex": "^0.16.10", "less": "^4.2.0", + "markd": "^1.2.0", + "marked": "^13.0.1", "moment": "^2.30.1", "pinia": "^2.1.7", "sass": "^1.77.6", diff --git a/src/assets/top.md b/src/assets/top.md new file mode 100644 index 0000000..877b5b3 --- /dev/null +++ b/src/assets/top.md @@ -0,0 +1,7 @@ +## TDP-FT + +本页面内容不保证时效性, 请自行斟酌. + +部分链接为推测而得或无法访问, 已在页面中作出标记. + +请勿将此项目用于迫害目的. diff --git a/src/components/ContentCard.vue b/src/components/ContentCard.vue index afd6fba..17545b6 100644 --- a/src/components/ContentCard.vue +++ b/src/components/ContentCard.vue @@ -16,12 +16,12 @@ export default class ContentCard extends Vue { 点击查看网络站点 - - + + {{ s.replaceAll('(无法正常访问)', '').replaceAll('(推测而得)', '') }} -
+
点击查看地址

diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 0000000..777782c --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,2 @@ +declare module '*.md'; +declare module '*.vue'; \ No newline at end of file diff --git a/src/shims.d.ts b/src/shims.d.ts new file mode 100644 index 0000000..192fecb --- /dev/null +++ b/src/shims.d.ts @@ -0,0 +1,14 @@ +/// + +/* eslint-disable */ + +declare module '*.vue' { + import type { DefineComponent } from 'vue'; + const component: DefineComponent<{}, {}, any>; + export default component; +} + +declare module '*.md' { + const html: string; + export default html; +} \ No newline at end of file diff --git a/src/style/markdown.scss b/src/style/markdown.scss new file mode 100644 index 0000000..412330b --- /dev/null +++ b/src/style/markdown.scss @@ -0,0 +1,41 @@ +@import "./mocha.sass"; + +.markdown { + color: $text; + + .head { + color: $rosewater; + border-bottom: 1px solid $rosewater; + } + + h1 { + @extend .head; + + font-size: 2.5rem; + } + + h2 { + @extend .head; + + font-size: 2rem; + } + + h3, h4, h5, h6 { + color: $rosewater; + font-size: 1.5rem; + } + + a { + color: $teal; + + &:active { + color: $lavender; + } + } + + blockquote { + background-color: $yellow-opacity; + border-left: 2px solid $yellow; + border-radius: 1em; + } +} \ No newline at end of file diff --git a/src/style/mocha.sass b/src/style/mocha.sass index c7e9496..b807328 100644 --- a/src/style/mocha.sass +++ b/src/style/mocha.sass @@ -23,4 +23,31 @@ $surface1: #45475a $surface2: #585b70 $base: #1e1e2e $mantle: #181825 -$crust: #11111b \ No newline at end of file +$crust: #11111b + +$rosewater-opacity: #f5e0dc4e +$flamingo-opacity: #f2cdcd4e +$pink-opacity: #f5c2e74e +$mauve-opacity: #cba6f74e +$red-opacity: #f38ba84e +$maroon-opacity: #eba0ac4e +$peach-opacity: #fab3874e +$yellow-opacity: #f9e2af4e +$green-opacity: #a6e3a14e +$teal-opacity: #94e2d54e +$sky-opacity: #89dceb4e +$sapphire-opacity: #74c7ec4e +$blue-opacity: #89b4fa4e +$lavender-opacity: #b4befe4e +$text-opacity: #cdd6f44e +$subtext0-opacity: #a6adc84e +$subtext1-opacity: #bac2de4e +$overlay0-opacity: #6c70864e +$overlay1-opacity: #7f849c4e +$overlay2-opacity: #9399b24e +$surface0-opacity: #3132444e +$surface1-opacity: #45475a4e +$surface2-opacity: #585b704e +$base-opacity: #1e1e2e4e +$mantle-opacity: #1818254e +$crust-opacity: #11111b4e \ No newline at end of file diff --git a/src/views/ContentField.vue b/src/views/ContentField.vue index 6f374dd..d29c730 100644 --- a/src/views/ContentField.vue +++ b/src/views/ContentField.vue @@ -3,10 +3,12 @@ import {Content, Data} from "@/logic/data"; import {fetchWithParams, gShuffle} from "@/logic/helper"; import {Vue, Component} from 'vue-facing-decorator'; import ContentCard from "@/components/ContentCard.vue"; +import topHtml from '@/assets/top.md'; @Component({components: {ContentCard}}) export default class ContentField extends Vue { contents = [] as Content[] + topHtml = topHtml; created() { fetchWithParams('https://raw.githubusercontent.com/FunctionSir/TransDefenseProject/master/institute_list.json') @@ -20,12 +22,15 @@ export default class ContentField extends Vue { -