Skip to content

Commit

Permalink
Add section on extending default schema
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 14, 2016
1 parent 3bcbe29 commit ef0c9ef
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion readme.md
Expand Up @@ -91,10 +91,20 @@ Sanitize the given [HAST][] tree.
### `Schema`

Configuration. If not given, defaults to [GitHub][] style sanitation.
If any key isn’t given, it defaults to GH’s style too.
If any top-level key isn’t given, it defaults to GH’s style too.

For a thorough sample, see the packages [`github.json`][schema-github].

To extend the the standard schema with a few changes, clone `github.json`
like so:

```js
var clone = require('clone');
var base = require('hast-util-sanitize/lib/github.json');
var schema = clone(base);
schema.attributes['*'].push('className');
```

###### `attributes`

Map of tag-names to allowed attributes (`Object.<Array.<string>>`).
Expand Down

0 comments on commit ef0c9ef

Please sign in to comment.