1- <!DOCTYPE html>
1+ <!DOCTYPE html>
22<html lang =" en" >
33
44<head >
55 <meta charset =" utf-8" />
66 <meta name =" viewport" content =" width=device-width, initial-scale=1.0" />
77 <base href =" /" />
8- <link rel =" stylesheet" href =" @Assets[" lib /bootstrap /dist /css /bootstrap.min.css " ]" />
98 <link rel =" stylesheet" href =" @Assets[" app.css " ]" />
109 <link rel =" stylesheet" href =" @Assets[" AStar.Dev.Web.styles.css " ]" />
1110 <ImportMap />
12- <link rel =" icon" type =" image/png" href =" favicon.png" />
13- <HeadOutlet />
11+ <link rel =" icon" type =" image/x-icon" href =" favicon.ico" />
12+ <HeadOutlet @rendermode =" InteractiveServer" />
13+ <script src =" _content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type =" text/javascript" ></script >
14+ <loading-theme storage-name =" theme" ></loading-theme >
15+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" >
16+ <script src =" https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" ></script >
17+ <script >
18+ window .highlightMarkdown = () => {
19+ if (window .hljs ) {
20+ window .hljs .highlightAll ();
21+ }
22+ };
23+ </script >
24+ <!-- Add marked (Markdown parser) and DOMPurify (sanitizer) -->
25+ <script src =" https://cdn.jsdelivr.net/npm/marked/marked.min.js" ></script >
26+ <
script src =
" https://cdn.jsdelivr.net/npm/[email protected] /dist/purify.min.js" ></
script >
27+ <script >
28+ // md: markdown text
29+ // allowHtml: when true, bypass sanitizer (only do this if you trust the source)
30+ window .renderMarkdown = (md , allowHtml ) => {
31+ const html = window .marked ? .parse (md ?? " " ) ?? " " ;
32+ if (allowHtml) {
33+ return html;
34+ }
35+ // Sanitize, but allow common code/formatting tags and classes used by highlight.js
36+ const cfg = {
37+ ALLOWED_TAGS : [
38+ ' pre' , ' code' , ' span' , ' p' , ' h1' , ' h2' , ' h3' , ' h4' , ' h5' , ' h6' ,
39+ ' ul' , ' ol' , ' li' , ' a' , ' strong' , ' em' , ' table' , ' thead' , ' tbody' ,
40+ ' tr' , ' th' , ' td' , ' blockquote' , ' hr' , ' br' , ' img'
41+ ],
42+ ALLOWED_ATTR : [' href' , ' title' , ' alt' , ' class' , ' rel' , ' target' , ' src' ]
43+ };
44+ return window .DOMPurify ? window .DOMPurify .sanitize (html, cfg) : html;
45+ };
46+ < / script>
1447< / head>
1548
1649< body>
17- <Routes />
18- <script src =" @Assets[ " _framework /blazor.web.js " ] " ></script >
50+ < Routes @rendermode = " InteractiveServer " / >
51+ < script src= " _framework/blazor.web.js" >< / script>
1952< / body>
2053
21- </html >
54+ < / html>
0 commit comments