posthtml-render
Advanced tools
Comparing version 0.0.0 to 1.0.0
{ | ||
"name": "posthtml-render", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"description": "Render PostHTMLTree to HTML/XML", | ||
"main": "index.js", | ||
"main": "lib/posthtml-render.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "npm run build && npm run lint && npm run coverage", | ||
"lint": "jshint lib/ && jscs lib/ -v", | ||
"coverage": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha", | ||
"build": "uglifyjs lib/posthtml-render.js -c \"evaluate=false\" -o posthtml-render.min.js" | ||
}, | ||
@@ -25,3 +28,11 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/voischev/posthtml-render#readme" | ||
"homepage": "https://github.com/voischev/posthtml-render#readme", | ||
"devDependencies": { | ||
"chai": "^3.3.0", | ||
"istanbul": "^0.4.0", | ||
"jscs": "^2.3.4", | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.3.3", | ||
"uglifyjs": "^2.4.10" | ||
} | ||
} |
# posthtml-render | ||
[![npm version](https://badge.fury.io/js/posthtml-render.svg)](http://badge.fury.io/js/posthtml-render) | ||
[![Build Status](https://travis-ci.org/voischev/posthtml-render.svg?branch=master)](https://travis-ci.org/voischev/posthtml-render?branch=master) | ||
[![Coverage Status](https://coveralls.io/repos/voischev/posthtml-render/badge.svg?branch=master)](https://coveralls.io/r/voischev/posthtml-render?branch=master) | ||
Render [PostHTML](http://github.com/posthtml/posthtml) Tree to HTML/XML. | ||
More info for [PostHTMLTree](https://github.com/posthtml/posthtml#posthtml-json-tree-example) | ||
## Install | ||
[NPM](http://npmjs.com) install | ||
``` | ||
$ npm install posthtml-render | ||
``` | ||
is also available for [bower](http://bower.io) and as an AMD, CommonJS, and globals module, uncompressed and compressed. | ||
## Usage | ||
__In NodeJS__ | ||
```js | ||
var render = require('posthtml-render'); | ||
var titleObj = { tag: 'h1' }; | ||
titleObj.attrs = { class: 'heading' }; | ||
titleObj.content = ['Title']; | ||
clonsole.log(render(titleObj/*, options */)); | ||
// <h1 class="heading">Title</h1> | ||
``` | ||
__In Browser__ | ||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Title</title> | ||
<script type="text/javascript" src="./bower_components/posthtml-render/posthtml-render.min.js"></script> | ||
<script type="text/javascript"> | ||
window.onload = function() { | ||
document.body.innerHTML = postHTMLRender({ tag: 'h1', attrs: { style: 'color: red;' }, content: ['Title'] }); | ||
}; | ||
</script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> | ||
``` | ||
## Options | ||
### singleTags | ||
Array tags for extend default list single tags | ||
__Default__: `[]` | ||
*Options* `{ singleTags: ['rect', 'custom'] }` | ||
```html | ||
... | ||
<div> | ||
... | ||
<rect> | ||
<custom> | ||
</div> | ||
``` | ||
### closingSingleTag | ||
Option to specify version closing single tags. | ||
Accepts values: `default`, `slash`, `tag`. | ||
__Default__: `default` | ||
*Options* `{ closingSingleTag: 'default' }` | ||
```html | ||
<img> | ||
``` | ||
*Options* `{ closingSingleTag: 'slash' }` | ||
```html | ||
<img /> | ||
``` | ||
*Options* `{ closingSingleTag: 'tag' }` | ||
```html | ||
<img></img> | ||
``` | ||
## License | ||
[MIT](LICENSE) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
149318
29
926
0
99
6