jstransformer-cdata
Version:
A transformer that transforms a string into XML CDATA.
30 lines (19 loc) • 1.05 kB
Markdown
# jstransformer-foo
[JSTransformer](http://github.com/jstransformers) that converts a string to an XML CDATA.
[](https://travis-ci.org/jstransformers/jstransformer-foo)
[](https://coveralls.io/r/jstransformers/jstransformer-foo?branch=master)
[](http://david-dm.org/jstransformers/jstransformer-foo)
[](https://www.npmjs.org/package/jstransformer-foo)
## Installation
npm install jstransformer-cdata
## API
```js
var cdata = require('jstransformer')(require('jstransformer-cdata'))
cdata.render('hello world').body
//=> '<![CDATA[hello world]]>'
// ']]>' is properly escaped:
cdata.render('<[[goodbye world]]>').body
//=> '<![CDATA[<[[goodbye world]]]]><![CDATA[>]]>'
```
## License
MIT