Skip to content

Commit

Permalink
Updating the markdown fieldtype docs to include the new sanitizer opt…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
molomby committed Oct 16, 2017
1 parent 5cb6405 commit bf71e71
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fields/types/markdown/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Stores a nested structure in the model with the properties:
}
```

The `html` path is updated when the `md` path is set by [Marked](https://github.com/chjj/marked)
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).
(Options for both these packages can be provided in the field definition, see below.)
The resultant HTML is persisted as `html`.

## Options

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

`markedOptions` `Object`

Supplied as options to the [`marked`](https://github.com/chjj/marked) package.
If not supplied the field will inherit the [package defaults](https://github.com/chjj/marked#options-1).

`sanitizeOptions` `Object`

Supplied as options to the [`sanitize-html`](https://github.com/punkave/sanitize-html) package.
If not supplied the field will inherit the [package defaults](https://github.com/punkave/sanitize-html#what-are-the-default-options).

## Schema

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

0 comments on commit bf71e71

Please sign in to comment.