Skip to content

Commit

Permalink
Update readme to better call out the default parser being XML (fixes #4
Browse files Browse the repository at this point in the history
…).
  • Loading branch information
developit committed May 25, 2016
1 parent 50e049b commit 96b5d5f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A `<Markup>` component that renders HTML (or XML) using Virtual DOM, mapping a s

### Overview

The `<Markup />` component takes some `markup`, an optional mapping of custom element names to `components`, and an optional `type` of either `xml` (the default) or `html`.
The `<Markup />` component takes some `markup`, an optional mapping of custom element names to `components`, and an optional `type` of either `xml` or `html`.

In it's simplest form, `<Markup />` is just a diffing XML/HTML renderer. It only re-renders when you change the `markup` prop.

Expand All @@ -34,6 +34,8 @@ let html = `<h1>hello</h1> <p>Testing 1 2 3...</p>`;
render(<Markup markup={html} />, document.body);
```

> **Note:** by default, content is parsed as XML, which may be too strict for your content but is the fastest option. Pass `type="html"` to parse as HTML.

### Custom Elements via Components

Expand Down Expand Up @@ -74,6 +76,10 @@ Subsequent `render()`s diff against that DOM just like a normal JSX rendering fl

### Optional properties

`type` - By default, content is parsed as XML. Pass `type="html"` to use an HTML parser.

`onError` - Suppress XML/HTML parse errors and instead pass them to this function.

`allow-scripts` - By default, preact-markup sanitizes the rendered HTML by removing script tags. The `allow-scripts` property re-enables script tags, _executing any JavaScript code within them_.

> ##### Example
Expand Down

0 comments on commit 96b5d5f

Please sign in to comment.