Skip to content

Commit 5c575ae

Browse files
committed
Add simpler example of merging schemas
1 parent 24fc81f commit 5c575ae

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

readme.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ To extend the standard schema with a few changes, clone `github.json`
9999
like so:
100100

101101
```js
102-
var clone = require('clone');
103-
var base = require('hast-util-sanitize/lib/github.json');
104-
var schema = clone(base);
105-
schema.attributes['*'].push('className');
102+
var h = require('hastscript');
103+
var merge = require('deepmerge');
104+
var gh = require('hast-util-sanitize/lib/github');
105+
106+
var schema = merge(gh, {attributes: {'*': ['className']}});
107+
108+
var tree = sanitize(h('div', {className: ['foo']}));
109+
// `tree` still has `className`.
106110
```
107111

108112
###### `attributes`

0 commit comments

Comments
 (0)