2
2
<!-- eslint-disable vue/no-v-html -->
3
3
<div
4
4
class =" markdown-content"
5
+ :class =" `mode-${mode}`"
5
6
v-html =" markdownContent"
6
7
/>
7
8
<!-- eslint-enable vue/no-v-html -->
8
9
</template >
9
10
10
11
<script setup lang="ts">
11
- import { ref , watch } from ' vue'
12
+ import { ref , watch , inject } from ' vue'
13
+ import type { Ref } from ' vue'
14
+ import { MODE_INJECTION_KEY } from ' @/injection-keys'
15
+ import type { MarkdownMode } from ' @/types'
16
+
17
+ const mode: Ref <MarkdownMode > = inject (MODE_INJECTION_KEY , ref (' read' ))
12
18
13
19
const props = defineProps ({
14
20
content: {
@@ -39,11 +45,14 @@ $header-anchor-offset-top: calc(var(--kui-space-50, $kui-space-50) + 2px);
39
45
font-weight : var (--kui-font-weight-regular , $kui-font-weight-regular );
40
46
line-height : var (--kui-line-height-40 , $kui-line-height-40 );
41
47
margin : 0 ;
42
- // max-width: 900px;
43
- padding : 0 var (--kui-space-70 , $kui-space-70 );
44
- width : calc (100% - (#{$kui-space-70 } * 2 )); // 100% width minus 2x padding
48
+ padding : var (--kui-space-40 , $kui-space-40 ) var (--kui-space-70 , $kui-space-70 );
45
49
word-wrap : break-word ;
46
50
51
+ & .mode-read {
52
+ // Remove left and right padding in read mode
53
+ padding : var (--kui-space-0 , $kui-space-0 );
54
+ }
55
+
47
56
:deep () {
48
57
font-size : var (--kui-font-size-40 , $kui-font-size-40 );
49
58
line-height : var (--kui-line-height-40 , $kui-line-height-40 );
@@ -68,9 +77,10 @@ $header-anchor-offset-top: calc(var(--kui-space-50, $kui-space-50) + 2px);
68
77
transition : opacity 0.2s ease-in-out ;
69
78
user-select : none ;
70
79
71
- & :hover {
72
- opacity : 1 ;
73
- }
80
+ // TODO: Re-enable opacity and add left padding to `.markdown-content` if you want to see the header links on hover
81
+ // &:hover {
82
+ // opacity: 1;
83
+ // }
74
84
}
75
85
76
86
& :hover {
@@ -106,7 +116,7 @@ $header-anchor-offset-top: calc(var(--kui-space-50, $kui-space-50) + 2px);
106
116
border-radius : var (--kui-border-radius-40 , $kui-border-radius-40 );
107
117
font-family : var (--kui-font-family-code , $kui-font-family-code );
108
118
font-size : var (--kui-font-size-30 , $kui-font-size-30 );
109
- line-height : var (--kui-line-height-50 , $kui-line-height-50 );
119
+ line-height : var (--kui-line-height-30 , $kui-line-height-30 );
110
120
margin : var (--kui-space-0 , $kui-space-0 );
111
121
overflow-wrap : break-word ;
112
122
overflow-x : auto ;
0 commit comments