Skip to content

Commit

Permalink
updated wording in documentation to be more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmatician committed Apr 11, 2016
1 parent 5ae251c commit f9e8596
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ You may add a second argument when calling the function, as `flow(stream, option
* `preserveMarkup` - One of flow.ALWAYS, flow.SOMETIMES (default), or flow.NEVER. When set to ALWAYS, All subtags and text are stored in the $markup property with their original order preserved. When set to NEVER, all subtags are collected as separate properties. When set to SOMETIMES, markup is preserved only when subtags have non-contiguous repetition.
* `simplifyNodes` - Boolean. Default = true. Whether to drop empty $attrs, pull properties out of the $attrs when there are no subtags, or to only use a String instead of an object when $text is the only property.
* `useArrays` - One of flow.ALWAYS, flow.SOMETIMES (default), or flow.NEVER. When set to ALWAYS, All subtags and text are enclosed in arrays, even if there's only one found. When set to NEVER, only the first instance of a subtag or text node are kept. When set to SOMETIMES, arrays are used only when multiple items are found. *NOTE:* When set to NEVER, `preserveMarkup` is ignored.
* `cdataAsText` - Boolean. Default = false. Appends CDATA text to other nearby text instead of putting it into its own `$cdata` property. NOTE: If you plan to run the `toXml()` function on data that had CDATA in it, don't set this to true or you'll end up with malformed XML output.
* `cdataAsText` - Boolean. Default = false. Appends CDATA text to other nearby text instead of putting it into its own `$cdata` property. NOTE: If you plan to run the `toXml()` function on data that has CDATA in it, you might. Consider a more robust `escape` function than what is provided. See below for more information.

## Events
All events can be listened to via common nodeJS EventEmitter syntax.
Expand All @@ -165,8 +165,8 @@ All events can be listened to via common nodeJS EventEmitter syntax.
## toXml Utility
`toXml(node, options)` - Returns a string, XML-encoding of an object. Encodes $name, $attrs, $text, and $markup as you would expect. the following `options` are available:

* `indent` – How to indent tags for pretty-printing. If you don't provide an indent value, (like ' ' for two-spaces, for example), output will not be pretty-printed.
* `selfClosing` – Whether to self close tags (like `<br/>` for example) whenever possible defaults to true.
* `indent` – How to indent tags for pretty-printing, use `' '` for two-spaces, or `'\t'` for tabs. If no indent value is provided, output will not be pretty-printed.
* `selfClosing` – Whether to self close tags (like `<br/>` instead of `<br></br>`) whenever possible. Defaults to true.
* `escape` – Optionally provide an escape function for all text, to prevent malformed XML. As a default, a very simplistic escape function has been provided. You can provide a more robust escape function that suits your needs. For example, take a look at [he](https://github.com/mathiasbynens/he). To turn escaping off, provide a simple, non-escaping function like this: `function(str) { return str; }`

## Authors
Expand Down

0 comments on commit f9e8596

Please sign in to comment.