13
13
<div class =" g-agenda-list-item-detail-title" >
14
14
{{ session.zh.title }}
15
15
</div >
16
- <div class =" g-agenda-list-item-detail-description" >
17
- {{ session.zh.description }}
18
- </div >
16
+ <div
17
+ v-html =" sessionDescription"
18
+ class =" g-agenda-list-item-detail-description"
19
+ ></div >
19
20
<div v-if =" session.note" class =" g-agenda-list-item-detail-link" >
20
21
<a :href =" session.note" >加入此議程的線上共筆</a >
21
22
</div >
28
29
<div class =" name" >
29
30
{{ speaker.zh.name }}
30
31
</div >
31
- <div class =" bio" >
32
- {{ speaker.zh.bio }}
33
- </div >
32
+ <div v-html =" speakerBio" class =" bio" ></div >
34
33
</div >
35
34
</div >
36
35
</div >
44
43
</template >
45
44
46
45
<script lang="ts">
46
+ import { markdown } from ' markdown' ;
47
47
import { Component , Prop , Watch , Vue } from ' vue-property-decorator' ;
48
48
import CloseIcon from ' @/components/icons/Close.vue' ;
49
49
import NextIcon from ' @/components/icons/Next.vue' ;
@@ -73,6 +73,14 @@ export default class AgendaListItemDetail extends Vue {
73
73
};
74
74
}
75
75
76
+ get sessionDescription() {
77
+ return this .parseDescription (this .session .zh .description );
78
+ }
79
+
80
+ get speakerBio() {
81
+ return this .parseDescription (this .speaker .zh .bio );
82
+ }
83
+
76
84
@Watch (' value' )
77
85
private onChangeValue(newValue : boolean ) {
78
86
this .detailValue = newValue ;
@@ -86,6 +94,23 @@ export default class AgendaListItemDetail extends Vue {
86
94
private closeDetail() {
87
95
this .$emit (' input' , false );
88
96
}
97
+
98
+ private parseDescription(text : string ) {
99
+ const styles = Object .entries ({
100
+ ' margin-bottom' : ' 16px' ,
101
+ ' font-family' : ` 'Noto Sans TC', sans-serif ` ,
102
+ ' font-size' : ' 14px' ,
103
+ ' font-weight' : ' normal' ,
104
+ ' line-height' : ' 1.71' ,
105
+ ' letter-spacing' : ' normal' ,
106
+ color: ' #333943' ,
107
+ })
108
+ .map (([k , v ]) => ` ${k }: ${v }; ` )
109
+ .join (' ' );
110
+ return markdown
111
+ .toHTML (text )
112
+ .replace (/ <p>/ gm , ` <p style="${styles }"> ` );
113
+ }
89
114
}
90
115
</script >
91
116
0 commit comments