File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { AnnouncementImportance } from ' $lib/generated' ;
3+ import { markdown } from ' $lib/utils/markdown' ;
34
45 const iconNames: { [key in AnnouncementImportance ]: string } = {
56 [AnnouncementImportance .Info ]: ' info' ,
2728 <div class =" striped p-1 text-black" >
2829 <span class ="material-icons align-middle text-2xl" >{iconNames [importance ]}</span >
2930 <div
30- class =" text-l inline-block max-w-full break-words align-middle"
31+ class =" text-l announcement-markdown inline-block max-w-full break-words align-middle"
3132 class:font-mono ={isMonospace }
3233 class:whitespace-pre ={isMonospace }>
33- <b >{importance }: </b >{finalMessage }
34+ <b >{importance }: </b >
35+ {#await markdown (finalMessage , true ) then previewRendered }
36+ <!-- eslint-disable-next-line -->
37+ {@html previewRendered }
38+ {/await }
3439 </div >
3540 </div >
3641</div >
Original file line number Diff line number Diff line change 146146 <div class =" grid grid-flow-row auto-rows-max gap-2" >
147147 <span >{$t (' preview' )}:</span >
148148 {#await markdown (preview ) then previewRendered }
149- <!-- eslint-disable -->
149+ <!-- eslint-disable-next-line -->
150150 <div class ="markdown-content right" >{@html previewRendered }</div >
151151 {/await }
152152 </div >
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ if (!browser) {
2727 resolver ( DOMPurify . sanitize ) ;
2828}
2929
30- export const markdown = ( md : string ) : Promise < string > =>
30+ export const markdown = ( md : string , inline = false ) : Promise < string > =>
3131 sanitizer . then ( ( s ) => {
32- const sanitized = s ( marked ( md ) ) ;
32+ const sanitized = s ( inline ? marked . parseInline ( md ) : marked ( md ) ) ;
3333 const parsed = new DOMParser ( ) . parseFromString ( sanitized , 'text/html' ) ;
3434 Prism . highlightAllUnder ( parsed . body ) ;
3535 return parsed . body . innerHTML ;
Original file line number Diff line number Diff line change @@ -132,6 +132,12 @@ body.accessibility {
132132 }
133133}
134134
135+ .announcement-markdown {
136+ & a {
137+ text-decoration : underline;
138+ }
139+ }
140+
135141@font-face {
136142 font-family : Flow;
137143 font-weight : 400 ;
You can’t perform that action at this time.
0 commit comments