Skip to content

Commit bf71e71

Browse files
committed
Updating the markdown fieldtype docs to include the new sanitizer options
1 parent 5cb6405 commit bf71e71

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

fields/types/markdown/Readme.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Stores a nested structure in the model with the properties:
1111
}
1212
```
1313

14-
The `html` path is updated when the `md` path is set by [Marked](https://github.com/chjj/marked)
14+
When the `md` path is set, the value is first sanitized using [`sanitize-html`](https://github.com/punkave/sanitize-html), then rendered into HTML using [`marked`](https://github.com/chjj/marked).
15+
(Options for both these packages can be provided in the field definition, see below.)
16+
The resultant HTML is persisted as `html`.
1517

1618
## Options
1719

@@ -35,6 +37,16 @@ Comma separated list of buttons to hide.
3537
{ type: Types.Markdown, toolbarOptions: { hiddenButtons: 'H1,H6,Code' } }
3638
```
3739

40+
`markedOptions` `Object`
41+
42+
Supplied as options to the [`marked`](https://github.com/chjj/marked) package.
43+
If not supplied the field will inherit the [package defaults](https://github.com/chjj/marked#options-1).
44+
45+
`sanitizeOptions` `Object`
46+
47+
Supplied as options to the [`sanitize-html`](https://github.com/punkave/sanitize-html) package.
48+
If not supplied the field will inherit the [package defaults](https://github.com/punkave/sanitize-html#what-are-the-default-options).
49+
3850
## Schema
3951

4052
The markdown field will automatically convert markdown to html when the `md` property is changed, via a setter on the `md` path.

0 commit comments

Comments
 (0)