valaxy-theme-hairy 1.1.2 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,32 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
|
2
|
+
import { computed } from 'vue'
|
3
|
+
import { useRouter } from 'vue-router'
|
4
|
+
|
5
|
+
const props = defineProps<{
|
3
6
|
type?: 'white' | 'normal'
|
4
7
|
bordered?: boolean
|
8
|
+
href?: string
|
9
|
+
onClick?: ((payload: MouseEvent) => void)
|
5
10
|
}>()
|
11
|
+
|
12
|
+
const router = useRouter()
|
13
|
+
const urlReg = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/
|
14
|
+
const isLink = computed(() => urlReg.test(props.href || ''))
|
15
|
+
|
16
|
+
function onClick(payload: MouseEvent) {
|
17
|
+
!props.onClick
|
18
|
+
? isLink.value ? redirectTo(props.href!) : router.push(props.href!)
|
19
|
+
: props.onClick?.(payload)
|
20
|
+
payload.preventDefault()
|
21
|
+
}
|
22
|
+
|
23
|
+
function redirectTo(url: string, target = '_blank') {
|
24
|
+
const link = document.createElement('a')
|
25
|
+
link.href = url
|
26
|
+
link.target = target
|
27
|
+
link.click()
|
28
|
+
link.remove()
|
29
|
+
}
|
6
30
|
</script>
|
7
31
|
|
8
32
|
<template>
|
@@ -13,6 +37,9 @@ defineProps<{
|
|
13
37
|
: 'text:text-primary-light hover:text-primary-dark',
|
14
38
|
bordered && 'border-b border-dashed hover:border-primary',
|
15
39
|
]"
|
40
|
+
:href="href"
|
41
|
+
onclick="return false"
|
42
|
+
@click="onClick"
|
16
43
|
>
|
17
44
|
<slot />
|
18
45
|
</a>
|
@@ -16,9 +16,9 @@ const router = useRouter()
|
|
16
16
|
const post = computed(() => {
|
17
17
|
const clone = [...props.posts].map(v => ({
|
18
18
|
...v,
|
19
|
-
date: v.
|
20
|
-
? v.
|
21
|
-
: new Date(v.
|
19
|
+
date: v.date instanceof Date
|
20
|
+
? v.date.valueOf()
|
21
|
+
: new Date(v.date || Date.now()).valueOf(),
|
22
22
|
}))
|
23
23
|
clone.sort((b, a) => a.date - b.date)
|
24
24
|
return clone[0]
|
@@ -64,7 +64,7 @@ function displayCategory(keys: string | string[] = []) {
|
|
64
64
|
<div class="lt-md:hidden flex items-center gap-2">
|
65
65
|
<div class="i-material-symbols-folder-open-rounded text-14px" />
|
66
66
|
<ElTag size="small" class="dark:bg-dark-50 cursor-pointer border-none!" @click="displayCategory(post.categories)">
|
67
|
-
{{ post.categories }}
|
67
|
+
{{ toArray(post.categories).map($t).join('/') }}
|
68
68
|
</ElTag>
|
69
69
|
</div>
|
70
70
|
</template>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-hairy",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.4",
|
4
4
|
"packageManager": "pnpm@8.15.8",
|
5
5
|
"author": {
|
6
6
|
"email": "wwu710632@gmail.com",
|
@@ -27,6 +27,7 @@
|
|
27
27
|
"@iconify-json/simple-icons": "^1.1.109",
|
28
28
|
"@overlastic/vue": "^0.4.7",
|
29
29
|
"element-plus": "^2.7.7",
|
30
|
+
"furigana-markdown-it": "^1.0.3",
|
30
31
|
"pinia": "^2.1.7",
|
31
32
|
"swiper": "^11.1.5"
|
32
33
|
},
|
@@ -0,0 +1,62 @@
|
|
1
|
+
.markdown-body {
|
2
|
+
--c-toc-link: var(--hy-c-text-light);
|
3
|
+
}
|
4
|
+
|
5
|
+
html.dark {
|
6
|
+
.markdown-body {
|
7
|
+
--c-toc-link: var(--hy-c-text-dark);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
.markdown-body {
|
12
|
+
word-wrap: break-word;
|
13
|
+
|
14
|
+
h2,
|
15
|
+
a {
|
16
|
+
color: var(--hy-c-primary);
|
17
|
+
}
|
18
|
+
|
19
|
+
h1,
|
20
|
+
h2,
|
21
|
+
h3,
|
22
|
+
h4,
|
23
|
+
h5,
|
24
|
+
h6 {
|
25
|
+
font-family: var(--hy-font-serif);
|
26
|
+
font-weight: 900;
|
27
|
+
}
|
28
|
+
|
29
|
+
ul {
|
30
|
+
li>p {
|
31
|
+
margin-bottom: 0;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
.markdown-body :not(pre)>code {
|
38
|
+
padding: 3px 6px;
|
39
|
+
font-size: 0.85rem;
|
40
|
+
color: var(--hy-c-text-code);
|
41
|
+
background: var(--hy-c-bg-mute);
|
42
|
+
border-radius: 3px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.markdown-body div[class*=language-] pre {
|
46
|
+
max-width: calc(100vw - 56px);
|
47
|
+
}
|
48
|
+
|
49
|
+
.markdown-body div[class*=language-] {
|
50
|
+
width: 100%;
|
51
|
+
}
|
52
|
+
|
53
|
+
@media screen and (max-width: 640px) {
|
54
|
+
.markdown-body div[class*=language-] {
|
55
|
+
margin: auto;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
.markdown-body {
|
61
|
+
--un-prose-borders: var(--hy-c-primary);
|
62
|
+
}
|
@@ -1,4 +1,8 @@
|
|
1
|
-
@
|
1
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
2
|
+
|
3
|
+
@use 'valaxy/client/styles/components/code.scss' as *;
|
4
|
+
@use 'valaxy/client/styles/components/code-group.scss' as *;
|
5
|
+
@use 'valaxy/client/styles/components/custom-block.scss' as *;
|
2
6
|
|
3
7
|
.markdown-body {
|
4
8
|
--c-toc-link: var(--hy-c-text-light);
|
@@ -11,20 +15,16 @@ html.dark {
|
|
11
15
|
}
|
12
16
|
|
13
17
|
.markdown-body {
|
18
|
+
--un-prose-borders: var(--hy-c-primary);
|
14
19
|
word-wrap: break-word;
|
15
20
|
|
16
|
-
h2,
|
17
|
-
a {
|
18
|
-
color: var(--hy-c-primary);
|
19
|
-
}
|
20
|
-
|
21
21
|
h1,
|
22
22
|
h2,
|
23
23
|
h3,
|
24
24
|
h4,
|
25
25
|
h5,
|
26
26
|
h6 {
|
27
|
-
font-family: var(--
|
27
|
+
font-family: var(--va-font-family-base);
|
28
28
|
font-weight: 900;
|
29
29
|
}
|
30
30
|
|
@@ -33,51 +33,46 @@ html.dark {
|
|
33
33
|
margin-bottom: 0;
|
34
34
|
}
|
35
35
|
}
|
36
|
-
}
|
37
36
|
|
37
|
+
blockquote {
|
38
|
+
margin: 16px 0;
|
39
|
+
border-left: 4px solid var(--va-c-divider);
|
40
|
+
padding-left: 12px;
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
}
|
42
|
+
transition: border-color 0.5s p {
|
43
|
+
margin: 0;
|
44
|
+
font-size: 16px;
|
45
|
+
color: var(--vp-c-text-2);
|
46
|
+
transition: color 0.5s;
|
47
|
+
}
|
48
|
+
}
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
code:not(pre > code) {
|
51
|
+
color: var(--va-c-text-code);
|
52
|
+
background-color: var(--va-c-bg-mute);
|
53
|
+
padding: 3px 6px;
|
54
|
+
border-radius: 4px;
|
55
|
+
font-weight: 500;
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
}
|
57
|
+
&::before {
|
58
|
+
content: none;
|
59
|
+
}
|
60
|
+
|
61
|
+
&::after {
|
62
|
+
content: none;
|
63
|
+
}
|
64
|
+
}
|
54
65
|
|
55
|
-
|
56
|
-
|
57
|
-
margin: auto;
|
66
|
+
div[class*=language-] pre {
|
67
|
+
max-width: none;
|
58
68
|
}
|
59
69
|
}
|
60
70
|
|
61
|
-
|
62
71
|
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *))::before,
|
63
72
|
.prose :where(:not(pre) > code):not(:where(.not-prose, .not-prose *))::after {
|
64
73
|
content: none !important;
|
65
74
|
}
|
66
75
|
|
67
|
-
.custom-block.tip {
|
68
|
-
background-color: rgba(200, 200, 200, 0.1);
|
69
|
-
border-color: var(--hy-c-primary);
|
70
|
-
padding: 0.5rem 1rem;
|
71
|
-
}
|
72
|
-
|
73
|
-
.markdown-body {
|
74
|
-
--un-prose-borders: var(--hy-c-primary);
|
75
|
-
}
|
76
|
-
|
77
|
-
.markdown-body div[class*=language-] pre {
|
78
|
-
max-width: none;
|
79
|
-
}
|
80
|
-
|
81
76
|
.prose :where(blockquote):not(:where(.not-prose, .not-prose *)) {
|
82
77
|
background: rgba(200, 200, 200, 0.1);
|
83
78
|
@apply py-1px;
|
@@ -87,4 +82,10 @@ html.dark {
|
|
87
82
|
>p {
|
88
83
|
margin: 0.5rem 0;
|
89
84
|
}
|
85
|
+
}
|
86
|
+
|
87
|
+
.custom-block.tip {
|
88
|
+
background-color: rgba(200, 200, 200, 0.1);
|
89
|
+
border-color: var(--hy-c-primary);
|
90
|
+
padding: 0.5rem 1rem;
|
90
91
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'furigana-markdown-it'
|
package/valaxy.config.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { DefaultTheme, ValaxyTheme } from 'valaxy'
|
2
2
|
import { defineTheme, mergeValaxyConfig } from 'valaxy'
|
3
|
+
import markdownFurigana from 'furigana-markdown-it'
|
3
4
|
import { withImageConfig, withThemeConfig } from './node'
|
4
5
|
import type { ThemeConfig } from './types'
|
5
6
|
|
@@ -16,6 +17,15 @@ export default defineTheme<ThemeConfig>((options) => {
|
|
16
17
|
post: 'image:slice:reverse',
|
17
18
|
},
|
18
19
|
},
|
20
|
+
markdown: {
|
21
|
+
theme: {
|
22
|
+
dark: 'material-theme-darker',
|
23
|
+
light: 'material-theme-lighter',
|
24
|
+
},
|
25
|
+
config(md) {
|
26
|
+
md.use(markdownFurigana())
|
27
|
+
},
|
28
|
+
},
|
19
29
|
vite: {
|
20
30
|
optimizeDeps: { include: ['dayjs', 'element-plus'] },
|
21
31
|
},
|