File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import remarkParse from "remark-parse";
44import remarkGfm from "remark-gfm" ;
55import remarkRehype from "remark-rehype" ;
66import rehypeRaw from "rehype-raw" ;
7- import rehypeSanitize from "rehype-sanitize" ;
7+ import rehypeSanitize , { defaultSchema } from "rehype-sanitize" ;
88import rehypeStringify from "rehype-stringify" ;
99import * as truncateHtml from "truncate-html" ;
1010
@@ -48,7 +48,12 @@ ko.bindingHandlers["markdown"] = {
4848 . use ( remarkGfm )
4949 . use ( remarkRehype , { allowDangerousHtml : true } )
5050 . use ( rehypeRaw )
51- . use ( rehypeSanitize )
51+ . use ( rehypeSanitize , {
52+ ...defaultSchema ,
53+ attributes : {
54+ '*' : [ 'className' , 'role' ]
55+ }
56+ } )
5257 . use ( rehypeStringify )
5358 . process ( markdown , ( err : any , html : any ) => {
5459 html = truncateHtml . default ( html , { length : length , reserveLastWord : true } ) ;
You can’t perform that action at this time.
0 commit comments