File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,12 @@ export interface ViewerProps {
9797 */
9898 plugins ?: BytemdPlugin [ ] ;
9999 /**
100- * An option to change the default sanitize schema.
100+ * Customize the default sanitize schema
101101 *
102- * Defaults to GitHub style sanitation except that the `class` attribute is allowed
102+ * Defaults to GitHub style sanitation except:
103+ *
104+ * 1. `className` is allowed
105+ * 2. `id` is kept as is without clobbering
103106 *
104107 * https://github.com/syntax-tree/hast-util-sanitize/blob/main/lib/github.json
105108 */
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export function getProcessor({
2626
2727 let schema = JSON . parse ( schemaStr ) ;
2828 schema . attributes [ '*' ] . push ( 'className' ) ; // Add className
29+ schema . clobber = schema . clobber . filter ( ( vs : string ) => vs !== 'id' ) ; // Keep id as is
2930 if ( sanitize ) schema = sanitize ( schema ) ;
3031
3132 p = p . use ( rehypeSanitize , schema ) ;
You can’t perform that action at this time.
0 commit comments