Comparing version 0.9.0 to 0.9.1
@@ -0,1 +1,6 @@ | ||
<a name="0.9.1"></a> | ||
## [0.9.1](https://github.com/posthtml/posthtml/compare/v0.9.0...v0.9.1) (2016-09-29) | ||
<a name="0.9.0"></a> | ||
@@ -2,0 +7,0 @@ # [0.9.0](https://github.com/posthtml/posthtml/compare/v0.8.7...v0.9.0) (2016-07-06) |
221
lib/api.js
@@ -1,107 +0,136 @@ | ||
'use strict'; | ||
'use strict' | ||
/** | ||
* # API | ||
* @author Ivan Voischev (@voischev), | ||
* Anton Winogradov (@awinogradov), | ||
* Alexej Yaroshevich (@zxqfox), | ||
* Vasiliy (@Yeti-or) | ||
* @module API | ||
* @namespace tree | ||
*/ | ||
module.exports = { | ||
/** | ||
* walk the tree and pass all nodes to callback | ||
* @param {Function} cb Callback function | ||
* @return {Function} Node in callback | ||
* | ||
* Example usage: | ||
* module.exports = function(tree) { | ||
* tree.walk(function(node) { | ||
* var classes = node.attrs && node.attrs.class.split(' ') || []; | ||
* if (classes.includes(className)) return cb(node); | ||
* return node; | ||
* }); | ||
* }; | ||
*/ | ||
walk: function(cb) { | ||
return traverse(this, cb); | ||
}, | ||
/** | ||
* match expression to search nodes in the tree | ||
* @param {String|RegExp|Object|Array.<String|RegExp|Object>} expression - | ||
* Matcher(s) to search | ||
* @param {Function} cb Callback function | ||
* @return {Function} Node in callback | ||
* | ||
* Example usage: | ||
* module.exports = function(tree) { | ||
* tree.match({ tag: 'custom-tag' }, function(node) { | ||
* var tag = node.tag; | ||
* Object.assign(node, { tag: 'div', attrs: {class: tag} }); | ||
* return node; | ||
* }); | ||
* | ||
* // Array matchers | ||
* tree.match([{ tag: 'b' }, { tag: 'strong' }], function(node) { | ||
* var style = 'font-weight: bold;'; | ||
* node.tag = 'span'; | ||
* node.attrs ? ( | ||
* node.attrs.style ? ( | ||
* node.attrs.style += style | ||
* ) : node.attrs.style = style | ||
* ) : node.attrs = { style: style }; | ||
* return node; | ||
* }); | ||
* }; | ||
*/ | ||
match: function(expression, cb) { | ||
return Array.isArray(expression) ? traverse(this, function(node) { | ||
for (var i = 0; i < expression.length; i++) { | ||
if (compare(expression[i], node)) return cb(node); | ||
} | ||
return node; | ||
}) : traverse(this, function(node) { | ||
if (compare(expression, node)) return cb(node); | ||
return node; | ||
}); | ||
} | ||
}; | ||
/** | ||
* walk the tree and pass all nodes to callback | ||
* | ||
* @memberof tree | ||
* @param {Function} cb - Callback | ||
* @return {Function} - Node in callback | ||
* | ||
***Usage** | ||
* ```js | ||
* export const walk = (tree) => { | ||
* tree.walk((node) => { | ||
* let classes = node.attrs && node.attrs.class.split(' ') || [] | ||
* | ||
* if (classes.includes(className)) return cb(node) | ||
* return node | ||
* }) | ||
* } | ||
* ``` | ||
*/ | ||
walk: function (cb) { | ||
return traverse(this, cb) | ||
}, | ||
/** | ||
* match expression to search nodes in the tree | ||
* | ||
* @memberof tree | ||
* @param {String|RegExp|Object|Array} expression - Matcher(s) to search | ||
* @param {Function} cb - Callback | ||
* @return {Function} - Node in callback | ||
* | ||
***Usage** | ||
* ```js | ||
* export const match = (tree) => { | ||
* // Single matcher | ||
* tree.match({ tag: 'custom-tag' }, (node) => { | ||
* let tag = node.tag | ||
* | ||
* Object.assign(node, { tag: 'div', attrs: {class: tag} }) | ||
* | ||
* return node | ||
* }) | ||
* // Multiple matchers | ||
* tree.match([{ tag: 'b' }, { tag: 'strong' }], (node) => { | ||
* let style = 'font-weight: bold;' | ||
* | ||
* node.tag = 'span' | ||
* | ||
* node.attrs | ||
* ? ( node.attrs.style | ||
* ? ( node.attrs.style += style ) | ||
* : node.attrs.style = style | ||
* ) | ||
* : node.attrs = { style: style } | ||
* | ||
* return node | ||
* }) | ||
* } | ||
* ``` | ||
*/ | ||
match: function (expression, cb) { | ||
return Array.isArray(expression) | ||
? traverse(this, function (node) { | ||
for (var i = 0; i < expression.length; i++) { | ||
if (compare(expression[i], node)) return cb(node) | ||
} | ||
/** @private */ | ||
function traverse(tree, cb) { | ||
if (Array.isArray(tree)) { | ||
for (var i = 0; i < tree.length; i++) { | ||
tree[i] = traverse(cb(tree[i]), cb); | ||
} | ||
} else if ( | ||
tree && | ||
typeof tree === 'object' && | ||
tree.hasOwnProperty('content') | ||
) traverse(tree.content, cb); | ||
return tree; | ||
return node | ||
}) | ||
: traverse(this, function (node) { | ||
if (compare(expression, node)) return cb(node) | ||
return node | ||
}) | ||
} | ||
} | ||
/** @private */ | ||
function compare(expected, actual) { | ||
if (expected instanceof RegExp) { | ||
if (typeof actual === 'object') | ||
return false; | ||
if (typeof actual === 'string') | ||
return expected.test(actual); | ||
function traverse (tree, cb) { | ||
if (Array.isArray(tree)) { | ||
for (var i = 0; i < tree.length; i++) { | ||
tree[i] = traverse(cb(tree[i]), cb) | ||
} | ||
} else if ( | ||
tree && | ||
typeof tree === 'object' && | ||
tree.hasOwnProperty('content') | ||
) traverse(tree.content, cb) | ||
if (typeof expected !== typeof actual) | ||
return false; | ||
if (typeof expected !== 'object' || expected === null) | ||
return expected === actual; | ||
return tree | ||
} | ||
if (Array.isArray(expected)) { | ||
return expected.every(function(exp) { | ||
return [].some.call(actual, function(act) { | ||
return compare(exp, act); | ||
}); | ||
}); | ||
/** @private */ | ||
function compare (expected, actual) { | ||
if (expected instanceof RegExp) { | ||
if (typeof actual === 'object') return false | ||
if (typeof actual === 'string') return expected.test(actual) | ||
} | ||
if (typeof expected !== typeof actual) return false | ||
if (typeof expected !== 'object' || expected === null) { | ||
return expected === actual | ||
} | ||
if (Array.isArray(expected)) { | ||
return expected.every(function (exp) { | ||
return [].some.call(actual, function (act) { | ||
return compare(exp, act) | ||
}) | ||
}) | ||
} | ||
return Object.keys(expected).every(function (key) { | ||
var ao = actual[key] | ||
var eo = expected[key] | ||
if (typeof eo === 'object' && eo !== null && ao !== null) { | ||
return compare(eo, ao) | ||
} | ||
if (typeof eo === 'boolean') { | ||
return eo !== (ao == null) | ||
} | ||
return Object.keys(expected).every(function(key) { | ||
var eo = expected[key]; | ||
var ao = actual[key]; | ||
if (typeof eo === 'object' && eo !== null && ao !== null) | ||
return compare(eo, ao); | ||
if (typeof eo === 'boolean') | ||
return eo !== (ao == null); | ||
return ao === eo; | ||
}); | ||
return ao === eo | ||
}) | ||
} |
{ | ||
"name": "posthtml", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "HTML/XML processor", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
], | ||
"main": "lib/posthtml.js", | ||
"main": "lib", | ||
"engines": { | ||
@@ -22,3 +22,3 @@ "node": ">=0.10.0" | ||
"dependencies": { | ||
"posthtml-parser": "^0.1.3", | ||
"posthtml-parser": "^0.2.0", | ||
"posthtml-render": "^1.0.5" | ||
@@ -33,16 +33,18 @@ }, | ||
"istanbul": "^0.4.2", | ||
"jscs": "^3.0.3", | ||
"jshint": "^2.8.0", | ||
"jsdoc-to-markdown": "^1.3.7", | ||
"mocha": "^2.2.5", | ||
"mversion": "^1.10.0", | ||
"object.assign": "^4.0.3" | ||
"object.assign": "^4.0.3", | ||
"standard": "^7.1.2" | ||
}, | ||
"scripts": { | ||
"test": "npm run lint && mocha -R dot && npm run coverage", | ||
"clean": "rm -rf coverage", | ||
"coverage": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha -- -R tap", | ||
"lint": "jshint . && jscs .", | ||
"release-patch": "mversion patch", | ||
"release-minor": "mversion minor", | ||
"release-major": "mversion major" | ||
"lint": "standard", | ||
"test": "npm run lint && mocha -R dot && npm run cover", | ||
"clean": "rm -rf coverage jsdoc-api", | ||
"cover": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha -- -R tap", | ||
"docs:api": "jsdoc2md lib/api.js > docs/api.md", | ||
"docs:core": "jsdoc2md lib/index.js > docs/core.md", | ||
"release:patch": "mversion patch", | ||
"release:minor": "mversion minor", | ||
"release:major": "mversion major" | ||
}, | ||
@@ -49,0 +51,0 @@ "author": "Anton Winogradov <winogradovaa@gmail.com>", |
816
README.md
@@ -1,7 +0,9 @@ | ||
[![npm][npm]][npm-badge] | ||
[![Build][build]][build-badge] | ||
[![Coverage][cover]][cover-badge] | ||
[![Chat][chat]][chat-badge] | ||
[![NPM][npm]][npm-url] | ||
[![Deps][deps]][deps-url] | ||
[![Tests][build]][build-url] | ||
[![Coverage][cover]][cover-url] | ||
[![Standard Code Style][style]][style-url] | ||
[![Chat][chat]][chat-url] | ||
# PostHTML <img align="right" width="220" height="200" title="PostHTML logo" src="http://posthtml.github.io/posthtml/logo.svg"> | ||
# PostHTML <img align="right" width="220" height="200" title="PostHTML" src="http://posthtml.github.io/posthtml/logo.svg"> | ||
@@ -14,75 +16,103 @@ PostHTML is a tool for transforming HTML/XML with JS plugins. PostHTML itself is very small. It includes only a HTML parser, a HTML node tree API and a node tree stringifier. | ||
## Dependencies | ||
- [posthtml-parser][parser] — Parser HTML/XML to PostHTMLTree | ||
- [posthtml-render][render] — Render PostHTMLTree to HTML/XML | ||
### Dependencies | ||
## Usage | ||
| Name | Status | Description | | ||
|:----:|:------:|:-----------:| | ||
|[posthtml-parser][parser]|[![npm][parser-badge]][parser-npm]| Parser HTML/XML to PostHTMLTree | | ||
|[posthtml-render][render]|[![npm][render-badge]][render-npm]| Render PostHTMLTree to HTML/XML | | ||
``` | ||
[docs]: https://github.com/posthtml/posthtml/blob/master/docs | ||
[parser]: https://github.com/posthtml/posthtml-parser | ||
[parser-badge]: https://img.shields.io/npm/v/posthtml-parser.svg | ||
[parser-npm]: https://npmjs.com/package/posthtml-parser | ||
[render]: https://github.com/posthtml/posthtml-render | ||
[render-badge]: https://img.shields.io/npm/v/posthtml-render.svg | ||
[render-npm]: https://npmjs.com/package/posthtml-render | ||
## Install | ||
```bash | ||
npm i -D posthtml | ||
``` | ||
<img align="right" width="91" height="80" title="NodeJS" src="https://worldvectorlogo.com/logos/nodejs-icon.svg"> | ||
## Usage | ||
### API | ||
**Simple example** | ||
**Sync** | ||
```js | ||
const posthtml = require('posthtml'); | ||
import posthtml from 'posthtml' | ||
let html = ` | ||
<myComponent> | ||
<myTitle>Super Title</myTitle> | ||
<myText>Awesome Text</myText> | ||
</myComponent>`; | ||
const html = ` | ||
<component> | ||
<title>Super Title</title> | ||
<text>Awesome Text</text> | ||
</component> | ||
` | ||
posthtml() | ||
.use(require('posthtml-custom-elements')()) | ||
.process(html/*, options */) | ||
.then(function(result) { | ||
console.log(result.html); | ||
// <div class="myComponent"> | ||
// <div class="myTitle">Super Title</div> | ||
// <div class="myText">Awesome Text</div> | ||
// </div> | ||
}); | ||
const result = posthtml() | ||
.use(require('posthtml-custom-elements')()) | ||
.process(html, { sync: true }) | ||
.html | ||
console.log(result) | ||
``` | ||
**Сomplex example** | ||
```html | ||
<div class="component"> | ||
<div class="title">Super Title</div> | ||
<div class="text">Awesome Text</div> | ||
</div> | ||
``` | ||
> :warning: Async Plugins can't be used in sync mode and will throw an Error. It's recommended to use PostHTML asynchronously whenever possible. | ||
**Async** | ||
```js | ||
const posthtml = require('posthtml'); | ||
import posthtml from 'posthtml' | ||
let html = '<html><body><p class="wow">OMG</p></body></html>'; | ||
const html = ` | ||
<html> | ||
<body> | ||
<p class="wow">OMG</p> | ||
</body> | ||
</html> | ||
` | ||
posthtml([ | ||
require('posthtml-to-svg-tags')(), | ||
require('posthtml-extend-attrs')({ | ||
attrsTree: { | ||
'.wow' : { | ||
id: 'wow_id', | ||
fill: '#4A83B4', | ||
'fill-rule': 'evenodd', | ||
'font-family': 'Verdana' | ||
} | ||
} | ||
}) | ||
]) | ||
.process(html/*, options */) | ||
.then(function(result) { | ||
console.log(result.html); | ||
// <svg xmlns="http://www.w3.org/2000/svg"> | ||
// <text | ||
// class="wow" | ||
// id="wow_id" fill="#4A83B4" | ||
// fill-rule="evenodd" font-family="Verdana"> | ||
// OMG | ||
// </text> | ||
// </svg> | ||
}); | ||
posthtml( | ||
[ | ||
require('posthtml-to-svg-tags')(), | ||
require('posthtml-extend-attrs')({ | ||
attrsTree: { | ||
'.wow' : { | ||
id: 'wow_id', | ||
fill: '#4A83B4', | ||
'fill-rule': 'evenodd', | ||
'font-family': 'Verdana' | ||
} | ||
} | ||
}) | ||
]) | ||
.process(html/*, options */) | ||
.then((result) => console.log(result.html)) | ||
``` | ||
<img align="right" width="100" height="90" title="npm" src="https://worldvectorlogo.com/logos/npm.svg" /> | ||
## CLI | ||
```html | ||
<svg xmlns="http://www.w3.org/2000/svg"> | ||
<text | ||
class="wow" | ||
id="wow_id" | ||
fill="#4A83B4" | ||
fill-rule="evenodd" font-family="Verdana"> | ||
OMG | ||
</text> | ||
</svg> | ||
``` | ||
### Install [posthtml-cli](https://github.com/GitScrum/posthtml-cli) | ||
### [CLI](https://npmjs.com/package/posthtml-cli) | ||
@@ -93,10 +123,5 @@ ```bash | ||
```bash | ||
posthtml -o output.html -i input.html -c config.json | ||
``` | ||
or | ||
```json | ||
"scripts": { | ||
"html": "echo '=> Building HTML' && posthtml -o output.html -i input.html -c config.json" | ||
"posthtml": "posthtml -o output.html -i input.html -c config.json" | ||
} | ||
@@ -106,8 +131,6 @@ ``` | ||
```bash | ||
npm run html | ||
npm run posthtml | ||
``` | ||
<img align="right" width="80" height="80" title="GulpJS" src="https://worldvectorlogo.com/logos/gulp.svg" /> | ||
## Gulp | ||
### Install [gulp-posthtml](https://www.npmjs.com/package/gulp-posthtml) | ||
### [Gulp](https://gulpjs.com) | ||
@@ -119,17 +142,23 @@ ```bash | ||
```js | ||
gulp.task('html', function() { | ||
let posthtml = require('gulp-posthtml'); | ||
return gulp.src('src/**/*.html') | ||
.pipe(posthtml([ require('posthtml-custom-elements')() ]/*, options */)) | ||
.pipe(gulp.dest('build/')); | ||
}); | ||
import tap from 'gulp-tap' | ||
import posthtml from 'gulp-posthtml' | ||
import { task, src, dest } from 'gulp' | ||
task('html', () => { | ||
let path | ||
const plugins = [ require('posthtml-include')({ root: `${path}` }) ] | ||
const options = {} | ||
src('src/**/*.html') | ||
.pipe(tap((file) => path = file.path)) | ||
.pipe(posthtml(plugins, options)) | ||
.pipe(dest('build/')) | ||
}) | ||
``` | ||
Check [project-stub](https://github.com/posthtml/project-stub) example with Gulp | ||
Check [project-stub](https://github.com/posthtml/project-stub) for an example with Gulp | ||
<img align="right" width="90" height="80" title="GruntJS" src="https://worldvectorlogo.com/logos/grunt.svg" /> | ||
## Grunt | ||
### [Grunt](https://gruntjs.com) | ||
### Install [grunt-posthtml](https://www.npmjs.com/package/grunt-posthtml) | ||
```bash | ||
@@ -141,40 +170,34 @@ npm i -D grunt-posthtml | ||
posthtml: { | ||
options: { | ||
use: [ | ||
require('posthtml-head-elements')({ | ||
headElements: 'test/config/head.json' | ||
}), | ||
require('posthtml-doctype')({ | ||
doctype: 'HTML 5' | ||
}), | ||
require('posthtml-include')({ | ||
encoding: 'utf-8' | ||
}) | ||
] | ||
}, | ||
build: { | ||
files: [{ | ||
expand: true, | ||
dot: true, | ||
cwd: 'test/html/', | ||
src: ['*.html'], | ||
dest: 'test/tmp/' | ||
}] | ||
} | ||
options: { | ||
use: [ | ||
require('posthtml-doctype')({ doctype: 'HTML 5' }), | ||
require('posthtml-include')({ root: './', encoding: 'utf-8' }) | ||
] | ||
}, | ||
build: { | ||
files: [ | ||
{ | ||
dot: true, | ||
cwd: 'html/', | ||
src: ['*.html'], | ||
dest: 'tmp/', | ||
expand: true, | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
<img align="right" width="90" height="90" title="Webpack" src="https://worldvectorlogo.com/logos/webpack.svg" /> | ||
## Webpack | ||
### Install [posthtml-loader](https://www.npmjs.com/package/posthtml-loader) | ||
### [Webpack](https://webpack.js.org) | ||
```bash | ||
npm i -D posthtml-loader | ||
npm i -D html-loader posthtml-loader | ||
``` | ||
```js | ||
const bem = require('posthtml-bem')() | ||
const each = require('posthtml-each')() | ||
#### v1.x | ||
module.exports = { | ||
**webpack.config.js** | ||
```js | ||
const config = { | ||
module: { | ||
@@ -188,161 +211,190 @@ loaders: [ | ||
} | ||
posthtml: function () { | ||
posthtml: (ctx) => { | ||
return { | ||
defaults: [ bem, each ] | ||
parser: require('posthtml-pug') | ||
plugins: [ | ||
require('posthtml-include')({ root: ctx.resourcePath }) | ||
] | ||
} | ||
} | ||
} | ||
export default config | ||
``` | ||
with custom package | ||
#### v2.x | ||
**webpack.config.js** | ||
```js | ||
const bem = require('posthtml-bem')() | ||
const each = require('posthtml-each')() | ||
const include = require('posthtml-include')() | ||
import { LoaderOptionsPlugin } from 'webpack' | ||
module.exports = { | ||
const config = { | ||
module: { | ||
loaders: [ | ||
rules: [ | ||
{ | ||
test: /\.html$/, | ||
loader: 'html!posthtml?pack=html' | ||
use: [ | ||
{ loader: 'html-loader', options: { minimize: true } } | ||
'posthtml-loader' | ||
] | ||
} | ||
] | ||
} | ||
posthtml: function () { | ||
return { | ||
defaults: [ bem, each ], | ||
html: [ bem, each, include ] | ||
} | ||
} | ||
plugins: [ | ||
new LoaderOptionsPlugin({ | ||
options: { | ||
posthtml (ctx) { | ||
parser: require('posthtml-pug') | ||
plugins: [ | ||
require('posthtml-include')({ root: ctx.resourcePath }) } | ||
] | ||
} | ||
} | ||
}) | ||
] | ||
} | ||
export default config | ||
``` | ||
## PostHTML with Jade engine in Express | ||
Also it's work with other view engine. Callback in `app.engine` is called by `res.render()` to render the template code. | ||
## Parser | ||
```js | ||
app.engine('jade', function (path, options, callback) { | ||
// PostHTML plugins | ||
let plugins = [ | ||
require('posthtml-bem')(), | ||
require('posthtml-textr')({ locale: 'ru'}, [ | ||
require('typographic-ellipses'), | ||
require('typographic-single-spaces'), | ||
require('typographic-quotes') | ||
]) | ||
]; | ||
import pug from 'posthtml-pug' | ||
let html = require('jade').renderFile(path, options); | ||
posthtml(plugins) | ||
.process(html) | ||
.then(function (result) { | ||
if (typeof callback === 'function') { | ||
var res; | ||
try { | ||
res = result.html; | ||
} catch (ex) { | ||
return callback(ex); | ||
} | ||
return callback(null, res); | ||
} | ||
}); | ||
}) | ||
app.set('view engine', 'jade'); | ||
posthtml().process(html, { parser: pug(options) }).then((result) => result.html) | ||
``` | ||
## Middleware | ||
| Name |Status|Description| | ||
|:-----|:-----|:----------| | ||
|[posthtml-pug][pug]|[![npm][pug-badge]][pug-npm]|Pug Parser| | ||
|[posthtml-hbs][hbs]|[![npm][hbs-badge]][hbs-npm]|Handlebars Parser| | ||
|[sugarml][sugar]|[![npm][sugar-badge]][sugar-npm]|SugarML Parser| | ||
<img align="right" height="56" title="KoaJS" src="http://t2.gstatic.com/images?q=tbn:ANd9GcRfnGHcTYGyMNcicU4N3nzV-5Rta9s_e5LzSI2HBjKMsLHundtmqAlQ" /> | ||
### [Koa](http://koajs.com/) | ||
[pug]: https://github.com/posthtml/posthtml-pug | ||
[pug-badge]: https://img.shields.io/npm/v/posthtml-pug.svg | ||
[pug-npm]: https://npmjs.com/package/posthtml-pug | ||
##### [koa-posthtml](https://github.com/michael-ciniawsky/koa-posthtml) | ||
[hbs]: https://github.com/posthtml/posthtml-hbs | ||
[hbs-badge]: https://img.shields.io/npm/v/posthtml-hbs.svg | ||
[hbs-npm]: https://npmjs.com/package/posthtml-hbs | ||
<img align="right" height="56" title="HapiJS" src="https://worldvectorlogo.com/logos/hapi.svg" /> | ||
[sugar]: https://github.com/posthtml/sugarml | ||
[sugar-badge]: https://img.shields.io/npm/v/sugarml.svg | ||
[sugar-npm]: https://npmjs.com/package/sugarml | ||
### [Hapi](https://hapijs.com) | ||
## [Plugins](http://maltsev.github.io/posthtml-plugins) | ||
##### [hapi-posthtml](https://github.com/michael-ciniawsky/hapi-posthtml) | ||
In case you want to develop your own plugin, we recommend using [posthtml-plugin-boilerplate][plugin] for getting started. | ||
<img align="right" height="28" title="ExpressJS" src="https://worldvectorlogo.com/logos/express-109.svg" /> | ||
[plugin]: https://github.com/posthtml/posthtml-plugin-boilerplate | ||
### [Express](https://expressjs.com) | ||
#### TEXT | ||
##### [express-posthtml](https://github.com/michael-ciniawsky/express-posthtml) | ||
| Name |Status|Description| | ||
|:-----|:-----|:----------| | ||
|[posthtml-md][md]|[![npm][md-badge]][md-npm]|Easily use context-sensitive markdown within HTML| | ||
|[posthtml-lorem][lorem]|[![npm][lorem-badge]][lorem-npm]|Add lorem ipsum placeholder text to any document| | ||
|[posthtml-retext][text]|[![npm][text-badge]][text-npm]|Extensible system for analysing and manipulating natural language| | ||
<img align="right" height="28" title="ElectronJS" src="https://worldvectorlogo.com/logos/electron-4.svg" /> | ||
[md]: https://github.com/jonathantneal/posthtml-md | ||
[md-badge]: https://img.shields.io/npm/v/posthtml-md.svg | ||
[md-npm]: https://npmjs.com/package/posthtml-md | ||
### [Electron](https://electron.atom.io) | ||
[text]: https://github.com/voischev/posthtml-retext | ||
[text-badge]: https://img.shields.io/npm/v/posthtml-retext.svg | ||
[text-npm]: https://npmjs.com/package/posthtml-retext | ||
##### [electron-posthtml](https://github.com/michael-ciniawsky/electron-posthtml) | ||
[lorem]: https://github.com/jonathantneal/posthtml-lorem | ||
[lorem-badge]: https://img.shields.io/npm/v/posthtml-lorem.svg | ||
[lorem-npm]: https://npmjs.com/package/posthtml-lorem | ||
## Plugins | ||
Take a look at the searchable [Plugins Catalog](http://maltsev.github.io/posthtml-plugins/) for PostHTML plugins. | ||
#### HTML | ||
|Plugin|Status |Description| | ||
|:-----|:-----|:----------| | ||
|[posthtml-bem][bem]| [![npm][bem-badge]][bem-npm] |Support BEM naming in html structure| | ||
|[posthtml-postcss][css]|[![npm][css-badge]][css-npm]|Use [PostCSS][css-gh] in HTML document| | ||
|[posthtml-retext][text]|[![npm][text-badge]][text-npm]|Extensible system for analysing and manipulating natural language| | ||
|[posthtml-custom-elements][elem]|[![npm][elem-badge]][elem-npm]| Use custom elements now | | ||
|[posthtml-web-component][web]|[![npm][web-badge]][web-npm]|Web Component ServerSide Rending, Component as Service in Server| | ||
|[posthtml-inline-css][in]|[![npm][in-badge]][in-npm]|CSS Inliner| | ||
|[posthtml-style-to-file][style]|[![npm][style-badge]][style-npm]| Save HTML style nodes and attributes to CSS file| | ||
|[posthtml-px2rem][px2rem]|[![npm][px2rem-badge]][px2rem-npm]|Change px to rem in HTML inline CSS| | ||
|[posthtml-classes][classes]|[![npm][classes-badge]][classes-npm]|Get a list of classes from HTML| | ||
|[posthtml-doctype][doctype]|[![npm][doctype-badge]][doctype-npm]|Extend html tags doctype| | ||
|[posthtml-include][include]|[![npm][include-badge]][include-npm]|Include html file| | ||
|[posthtml-to-svg-tags][svg]|[![npm][svg-badge]][svg-npm]|Convert html tags to svg equals| | ||
|[posthtml-extend-attrs][attrs]|[![npm][attrs-badge]][attrs-npm]| Extend html tags attributes with custom data and attributes| | ||
|[posthtml-modular-css][modular]|[![npm][modular-badge]][modular-npm]|Makes css modular| | ||
|[posthtml-static-react][react]|[![npm][react-badge]][react-npm]| Render custom elements as static React components | | ||
|[posthtml-head-elements][head]|[![npm][head-badge]][head-npm]|Store head elements (title, script, link, base and meta) in a JSON file and render them into the document during the build process| | ||
|[posthtml-prefix-class][prefix]|[![npm][prefix-badge]][prefix-npm]|Prefix class names | ||
|[posthtml-collect-inline-styles][collect]|[![npm][collect-badge]][collect-npm]|Collect inline styles and insert to head tag| | ||
|[posthtml-transformer][transform]|[![npm][transform-badge]][transform-npm]|process HTML by directives in node attrs, such as inline scripts and styles, remove useless tags, concat scripts and styles etc.| | ||
|[posthtml-inline-assets][assets]|[![npm][assets-badge]][assets-npm]|Inline external scripts, styles, and images in HTML| | ||
|[posthtml-schemas][schemas]|[![npm][schemas-badge]][schemas-npm]|Add schema.org microdata to your markup super easy| | ||
|[posthtml-extend][extend] |[![npm][extend-badge]][extend-npm]|Templates extending (Jade-like) | | ||
|[posthtml-img-autosize][img]|[![npm][img-badge]][img-npm]|Auto setting the width and height of \<img\>| | ||
|[posthtml-aria-tabs][aria]|[![npm][aria-badge]][aria-npm]|Write accessible tabs with minimal markup| | ||
|[posthtml-lorem][lorem]|[![npm][lorem-badge]][lorem-npm]|Add lorem ipsum placeholder text to any document| | ||
|[posthtml-md][md]|[![npm][md-badge]][md-npm]|Easily use context-sensitive markdown within HTML| | ||
|[posthtml-alt-always][alt]|[![npm][alt-badge]][alt-npm]|Always add alt attribute for images that don't have it (accessibility reasons)| | ||
|[posthtml-css-modules][css-modules]|[![npm][css-modules-badge]][css-modules-npm]|Use CSS modules in HTML| | ||
|[posthtml-jade][jade]|[![npm][jade-badge]][jade-npm]|Jade templates/syntax support| | ||
|[posthtml-exp][exp]|[![npm][exp-badge]][exp-npm]|Add template expressions to your HTML| | ||
|[posthtml-tidy][tidy]|[![npm][tidy-badge]][tidy-npm]|Sanitize HTML with HTML Tidy on the fly| | ||
|[posthtml-hint][hint]|[![npm][hint-badge]][hint-npm]|Lint HTML with HTML Hint| | ||
|[posthtml-w3c][w3c]|[![npm][w3c-badge]][w3c-npm]|Validate HTML with W3C Validation| | ||
|[posthtml-load-plugins][load]|[![npm][load-badge]][load-npm]|Auto-load Plugins for PostHTML| | ||
|[posthtml-remove-attributes][remove]|[![npm][remove-badge]][remove-npm]|Remove attributes unconditionally or with content match| | ||
|[posthtml-minifier][minifier]|[![npm][minifier-badge]][minifier-npm]|Minify HTML| | ||
|[posthtml-shorten][shorten]|[![npm][shorten-badge]][shorten-npm]|Shorten URLs in HTML elements| | ||
|[posthtml-uglify][uglify]|[![npm][uglify-badge]][uglify-npm]|Rewrite CSS identifiers in HTML to be shortened| | ||
|[posthtml-modules][modules]|[![npm][modules-badge]][modules-npm]|Posthtml modules processing| | ||
|[posthtml-postcss-modules][postcss-modules]|[![npm][postcss-modules-badge]][postcss-modules-npm]|CSS Modules in html| | ||
|[posthtml-collect-styles][collect-styles]|[![npm][collect-styles-badge]][collect-styles-npm]|Collect styles from html and put it in the head| | ||
|[posthtml-remove-duplicates][remove-duplicates]|[![npm][remove-duplicates-badge]][remove-duplicates-npm]|Remove duplicate elements from your html| | ||
|Name|Status|Description| | ||
|:---|:----:|:----------| | ||
|[posthtml-doctype][doctype]|[![npm][doctype-badge]][doctype-npm]|Set !DOCTYPE| | ||
|[posthtml-head-elements][head]|[![npm][head-badge]][head-npm]|Include head elements from JSON file| | ||
|[posthtml-include][include]|[![npm][include-badge]][include-npm]|Include HTML| | ||
|[posthtml-modules][modules]|[![npm][modules-badge]][modules-npm]|Include and process HTML| | ||
|[posthtml-extend][extend]|[![npm][extend-badge]][extend-npm]|Extend Layout (Pug-like)| | ||
|[posthtml-extend-attrs][attrs]|[![npm][attrs-badge]][attrs-npm]|Extend Attrs| | ||
|[posthtml-expressions][exp]|[![npm][exp-badge]][exp-npm]|Template Expressions| | ||
|[posthtml-inline-assets][assets]|[![npm][assets-badge]][assets-npm]|Inline external scripts, styles, and images| | ||
|[posthtml-static-react][react]|[![npm][react-badge]][react-npm]| Render custom elements as static React components| | ||
|[posthtml-custom-elements][elem]|[![npm][elem-badge]][elem-npm]|Use custom elements| | ||
|[posthtml-web-component][web]|[![npm][web-badge]][web-npm]|Web Component server-side rendering, Component as a Service (CaaS)| | ||
## License | ||
MIT | ||
[doctype]: https://github.com/posthtml/posthtml-doctype | ||
[doctype-badge]: https://img.shields.io/npm/v/posthtml-doctype.svg | ||
[doctype-npm]: https://npmjs.com/package/posthtml-doctype | ||
[npm]: https://img.shields.io/npm/v/posthtml.svg | ||
[npm-badge]: https://npmjs.com/package/posthtml | ||
[head]: https://github.com/TCotton/posthtml-head-elements | ||
[head-badge]: https://img.shields.io/npm/v/posthtml-head-elements.svg | ||
[head-npm]: https://npmjs.com/package/posthtml-head-elements | ||
[chat]: https://badges.gitter.im/posthtml/posthtml.svg | ||
[chat-badge]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" | ||
[include]: https://github.com/posthtml/posthtml-include | ||
[include-badge]: https://img.shields.io/npm/v/posthtml-include.svg | ||
[include-npm]: https://npmjs.com/package/posthtml-include | ||
[build]: https://travis-ci.org/posthtml/posthtml.svg?branch=master | ||
[build-badge]: https://travis-ci.org/posthtml/posthtml?branch=master | ||
[modules]: https://github.com/posthtml/posthtml-modules | ||
[modules-badge]: https://img.shields.io/npm/v/posthtml-modules.svg | ||
[modules-npm]: https://npmjs.com/package/posthtml-modules | ||
[cover]: https://coveralls.io/repos/posthtml/posthtml/badge.svg?branch=master | ||
[cover-badge]: https://coveralls.io/r/posthtml/posthtml?branch=master | ||
[content]: https://github.com/posthtml/posthtml-content | ||
[content-badge]: https://img.shields.io/npm/v/posthtml-content.svg | ||
[content-npm]: https://npmjs.com/package/posthtml-content | ||
[parser]: https://github.com/posthtml/posthtml-parser | ||
[render]: https://github.com/posthtml/posthtml-render | ||
[exp]: https://github.com/posthtml/posthtml-exp | ||
[exp-badge]: https://img.shields.io/npm/v/posthtml-exp.svg | ||
[exp-npm]: https://npmjs.com/package/posthtml-exp | ||
[docs]: https://github.com/posthtml/posthtml/blob/master/docs | ||
[extend]: https://github.com/posthtml/posthtml-extend | ||
[extend-badge]: https://img.shields.io/npm/v/posthtml-extend.svg | ||
[extend-npm]: https://npmjs.com/package/posthtml-extend | ||
[attrs]: https://github.com/theprotein/posthtml-extend-attrs | ||
[attrs-badge]: https://img.shields.io/npm/v/posthtml-extend-attrs.svg | ||
[attrs-npm]: https://npmjs.com/package/posthtml-extend-attrs | ||
[assets]: https://github.com/jonathantneal/posthtml-inline-assets | ||
[assets-badge]: https://img.shields.io/npm/v/posthtml-inline-assets.svg | ||
[assets-npm]: https://npmjs.com/package/posthtml-inline-assets | ||
[elem]: https://github.com/posthtml/posthtml-custom-elements | ||
[elem-badge]: https://img.shields.io/npm/v/posthtml-custom-elements.svg | ||
[elem-npm]: https://npmjs.com/package/posthtml-custom-elements | ||
[web]: https://github.com/island205/posthtml-web-component | ||
[web-badge]: https://img.shields.io/npm/v/posthtml-web-component.svg | ||
[web-npm]: https://npmjs.com/package/posthtml-web-components | ||
[prefix]: https://github.com/stevenbenisek/posthtml-prefix-class | ||
[prefix-badge]: https://img.shields.io/npm/v/posthtml-prefix-class.svg | ||
[prefix-npm]: https://npmjs.com/package/posthtml-prefix-class | ||
[react]: https://github.com/rasmusfl0e/posthtml-static-react | ||
[react-badge]: https://img.shields.io/npm/v/posthtml-static-react.svg | ||
[react-npm]: https://npmjs.com/package/posthtml-static-react | ||
#### CSS | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-bem][bem]|[![npm][bem-badge]][bem-npm]|Support BEM naming in html structure| | ||
|[posthtml-postcss][css]|[![npm][css-badge]][css-npm]|Use [PostCSS][css-gh] in HTML document| | ||
|[posthtml-px2rem][px2rem]|[![npm][px2rem-badge]][px2rem-npm]|Change px to rem in Inline CSS| | ||
|[posthtml-css-modules][css-modules]|[![npm][css-modules-badge]][css-modules-npm]|Use CSS modules in HTML| | ||
|[posthtml-postcss-modules][postcss-modules]|[![npm][postcss-modules-badge]][postcss-modules-npm]|CSS Modules in html| | ||
|[posthtml-classes][classes]|[![npm][classes-badge]][classes-npm]|Get a list of classes from HTML| | ||
|[posthtml-prefix-class][prefix]|[![npm][prefix-badge]][prefix-npm]|Prefix class names | ||
|[posthtml-modular-css][modular]|[![npm][modular-badge]][modular-npm]|Make CSS modular| | ||
|[posthtml-inline-css][in]|[![npm][in-badge]][in-npm]|CSS Inliner| | ||
|[posthtml-collect-styles][collect-styles]|[![npm][collect-styles-badge]][collect-styles-npm]|Collect styles from html and put it in the head| | ||
|[posthtml-collect-inline-styles][collect]|[![npm][collect-badge]][collect-npm]|Collect inline styles and insert to head tag| | ||
|[posthtml-style-to-file][style]|[![npm][style-badge]][style-npm]| Save HTML style nodes and attributes to CSS file| | ||
[bem]: https://github.com/rajdee/posthtml-bem | ||
@@ -357,22 +409,18 @@ [bem-badge]: https://img.shields.io/npm/v/posthtml-bem.svg | ||
[text]: https://github.com/voischev/posthtml-retext | ||
[text-badge]: https://img.shields.io/npm/v/posthtml-retext.svg | ||
[text-npm]: https://npmjs.com/package/posthtml-retext | ||
[postcss-modules]: https://github.com/posthtml/posthtml-postcss-modules | ||
[postcss-modules-badge]: https://img.shields.io/npm/v/posthtml-postcss-modules.svg | ||
[postcss-modules-npm]: https://npmjs.com/package/posthtml-postcss-modules | ||
[elem]: https://github.com/posthtml/posthtml-custom-elements | ||
[elem-badge]: https://img.shields.io/npm/v/posthtml-custom-elements.svg | ||
[elem-npm]: https://npmjs.com/package/posthtml-custom-elements | ||
[css-modules]: https://github.com/posthtml/posthtml-css-modules | ||
[css-modules-badge]: https://img.shields.io/npm/v/posthtml-css-modules.svg | ||
[css-modules-npm]: https://npmjs.com/package/posthtml-css-modules | ||
[web]: https://github.com/island205/posthtml-web-component | ||
[web-badge]: https://img.shields.io/npm/v/posthtml-web-component.svg | ||
[web-npm]: https://npmjs.com/package/posthtml-web-components | ||
[collect-styles]: https://github.com/posthtml/posthtml-collect-styles | ||
[collect-styles-badge]: https://img.shields.io/npm/v/posthtml-collect-styles.svg | ||
[collect-styles-npm]: https://npmjs.com/package/posthtml-collect-styles | ||
[in]: https://github.com/maltsev/posthtml-inline-css | ||
[in-badge]: https://img.shields.io/npm/v/posthtml-inline-css.svg | ||
[in-npm]: https://npmjs.com/package/posthtml-inline-css | ||
[collect]: https://github.com/totora0155/posthtml-collect-inline-styles | ||
[collect-badge]: https://img.shields.io/npm/v/posthtml-collect-inline-styles.svg | ||
[collect-npm]: https://npmjs.com/package/posthtml-collect-inline-styles | ||
[style]: https://github.com/posthtml/posthtml-style-to-file | ||
[style-badge]: https://img.shields.io/npm/v/posthtml-style-to-file.svg | ||
[style-npm]: https://npmjs.com/package/posthtml-style-to-file | ||
[px2rem]: https://github.com/weixin/posthtml-px2rem | ||
@@ -386,18 +434,6 @@ [px2rem-badge]: https://img.shields.io/npm/v/posthtml-px2rem.svg | ||
[doctype]: https://github.com/posthtml/posthtml-doctype | ||
[doctype-badge]: https://img.shields.io/npm/v/posthtml-doctype.svg | ||
[doctype-npm]: https://npmjs.com/package/posthtml-doctype | ||
[prefix]: https://github.com/stevenbenisek/posthtml-prefix-class | ||
[prefix-badge]: https://img.shields.io/npm/v/posthtml-prefix-class.svg | ||
[prefix-npm]: https://npmjs.com/package/posthtml-prefix-class | ||
[include]: https://github.com/posthtml/posthtml-include | ||
[include-badge]: https://img.shields.io/npm/v/posthtml-include.svg | ||
[include-npm]: https://npmjs.com/package/posthtml-include | ||
[svg]: https://github.com/theprotein/posthtml-to-svg-tags | ||
[svg-badge]: https://img.shields.io/npm/v/posthtml-to-svg-tags.svg | ||
[svg-npm]: https://npmjs.com/package/posthtml-to-svg-tags | ||
[attrs]: https://github.com/theprotein/posthtml-extend-attrs | ||
[attrs-badge]: https://img.shields.io/npm/v/posthtml-extend-attrs.svg | ||
[attrs-npm]: https://npmjs.com/package/posthtml-extend-attrs | ||
[modular]: https://github.com/admdh/posthtml-modular-css | ||
@@ -407,50 +443,35 @@ [modular-badge]: https://img.shields.io/npm/v/posthtml-modular-css.svg | ||
[react]: https://github.com/rasmusfl0e/posthtml-static-react | ||
[react-badge]: https://img.shields.io/npm/v/posthtml-static-react.svg | ||
[react-npm]: https://npmjs.com/package/posthtml-static-react | ||
[in]: https://github.com/posthtml/posthtml-inline-css | ||
[in-badge]: https://img.shields.io/npm/v/posthtml-inline-css.svg | ||
[in-npm]: https://npmjs.com/package/posthtml-inline-css | ||
[head]: https://github.com/TCotton/posthtml-head-elements | ||
[head-badge]: https://img.shields.io/npm/v/posthtml-head-elements.svg | ||
[head-npm]: https://npmjs.com/package/posthtml-head-elements | ||
[style]: https://github.com/posthtml/posthtml-style-to-file | ||
[style-badge]: https://img.shields.io/npm/v/posthtml-style-to-file.svg | ||
[style-npm]: https://npmjs.com/package/posthtml-style-to-file | ||
[prefix]: https://github.com/stevenbenisek/posthtml-prefix-class | ||
[prefix-badge]: https://img.shields.io/npm/v/posthtml-prefix-class.svg | ||
[prefix-npm]: https://npmjs.com/package/posthtml-prefix-class | ||
#### IMG && SVG | ||
[collect]: https://github.com/totora0155/posthtml-collect-inline-styles | ||
[collect-badge]: https://img.shields.io/npm/v/posthtml-collect-inline-styles.svg | ||
[collect-npm]: https://npmjs.com/package/posthtml-collect-inline-styles | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-img-autosize][img]|[![npm][img-badge]][img-npm]|Auto setting the width and height of \<img\>| | ||
|[posthtml-to-svg-tags][svg]|[![npm][svg-badge]][svg-npm]|Convert html tags to svg equals| | ||
[transform]: https://github.com/flashlizi/posthtml-transformer | ||
[transform-badge]: https://img.shields.io/npm/v/posthtml-transformer.svg | ||
[transform-npm]: https://npmjs.com/package/posthtml-transformer | ||
[assets]: https://github.com/jonathantneal/posthtml-inline-assets | ||
[assets-badge]: https://img.shields.io/npm/v/posthtml-inline-assets.svg | ||
[assets-npm]: https://npmjs.com/package/posthtml-inline-assets | ||
[schemas]: https://github.com/jonathantneal/posthtml-schemas | ||
[schemas-badge]: https://img.shields.io/npm/v/posthtml-schemas.svg | ||
[schemas-npm]: https://npmjs.com/package/posthtml-schemas | ||
[extend]: https://github.com/maltsev/posthtml-extend | ||
[extend-badge]: https://img.shields.io/npm/v/posthtml-extend.svg | ||
[extend-npm]: https://npmjs.com/package/posthtml-extend | ||
[img]: https://github.com/maltsev/posthtml-img-autosize | ||
[img]: https://github.com/posthtml/posthtml-img-autosize | ||
[img-badge]: https://img.shields.io/npm/v/posthtml-img-autosize.svg | ||
[img-npm]: https://npmjs.com/package/posthtml-img-autosize | ||
[aria]: https://github.com/jonathantneal/posthtml-aria-tabs | ||
[aria-badge]: https://img.shields.io/npm/v/posthtml-aria-tabs.svg | ||
[aria-npm]: https://npmjs.com/package/posthtml-aria-tabs | ||
[svg]: https://github.com/theprotein/posthtml-to-svg-tags | ||
[svg-badge]: https://img.shields.io/npm/v/posthtml-to-svg-tags.svg | ||
[svg-npm]: https://npmjs.com/package/posthtml-to-svg-tags | ||
[lorem]: https://github.com/jonathantneal/posthtml-lorem | ||
[lorem-badge]: https://img.shields.io/npm/v/posthtml-lorem.svg | ||
[lorem-npm]: https://npmjs.com/package/posthtml-lorem | ||
#### Accessibility | ||
[md]: https://github.com/jonathantneal/posthtml-md | ||
[md-badge]: https://img.shields.io/npm/v/posthtml-md.svg | ||
[md-npm]: https://npmjs.com/package/posthtml-md | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-aria-tabs][aria]|[![npm][aria-badge]][aria-npm]|Write accessible tabs with minimal markup| | ||
|[posthtml-alt-always][alt]|[![npm][alt-badge]][alt-npm]|Always add alt attribute for images that don't have it| | ||
|[posthtml-schemas][schemas]|[![npm][schemas-badge]][schemas-npm]| Add microdata to your HTML| | ||
[alt]: https://github.com/ismamz/posthtml-alt-always | ||
@@ -460,30 +481,23 @@ [alt-badge]: https://img.shields.io/npm/v/posthtml-alt-always.svg | ||
[css-modules]: https://github.com/maltsev/posthtml-css-modules | ||
[css-modules-badge]: https://img.shields.io/npm/v/posthtml-css-modules.svg | ||
[css-modules-npm]: https://npmjs.com/package/posthtml-css-modules | ||
[aria]: https://github.com/jonathantneal/posthtml-aria-tabs | ||
[aria-badge]: https://img.shields.io/npm/v/posthtml-aria-tabs.svg | ||
[aria-npm]: https://npmjs.com/package/posthtml-aria-tabs | ||
[jade]: https://github.com/michael-ciniawsky/posthtml-jade | ||
[jade-badge]: https://img.shields.io/npm/v/posthtml-jade.svg | ||
[jade-npm]: https://npmjs.com/package/posthtml-jade | ||
[schemas]: https://github.com/jonathantneal/posthtml-schemas | ||
[schemas-badge]: https://img.shields.io/npm/v/posthtml-schemas.svg | ||
[schemas-npm]: https://npmjs.com/package/posthtml-schemas | ||
[tidy]: https://github.com/michael-ciniawsky/posthtml-tidy | ||
[tidy-badge]: https://img.shields.io/npm/v/posthtml-tidy.svg | ||
[tidy-npm]: https://npmjs.com/package/posthtml-tidy | ||
#### Optimization | ||
[hint]: https://github.com//michael-ciniawsky/posthtml-hint | ||
[hint-badge]: https://img.shields.io/npm/v/posthtml-hint.svg | ||
[hint-npm]: https://npmjs.com/package/posthtml-hint | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-shorten][shorten]|[![npm][shorten-badge]][shorten-npm]|Shorten URLs in HTML| | ||
|[posthtml-uglify][uglify]|[![npm][uglify-badge]][uglify-npm]|Shorten CSS in HTML| | ||
|[posthtml-minifier][minifier]|[![npm][minifier-badge]][minifier-npm]|Minify HTML| | ||
|[posthtml-remove-attributes][remove]|[![npm][remove-badge]][remove-npm]|Remove attributes unconditionally or with content match| | ||
|[posthtml-remove-duplicates][remove-duplicates]|[![npm][remove-duplicates-badge]][remove-duplicates-npm]|Remove duplicate elements from your html| | ||
|[posthtml-transformer][transform]|[![npm][transform-badge]][transform-npm]|Process HTML by directives in node attrs, such as inline scripts and styles, remove useless tags, concat scripts and styles etc.| | ||
|[htmlnano][nano]|[![npm][nano-badge]][nano-npm]|HTML Minifier| | ||
[w3c]: https://github.com/michael-ciniawsky/posthtml-w3c | ||
[w3c-badge]: https://img.shields.io/npm/v/posthtml-w3c.svg | ||
[w3c-npm]: https://npmjs.com/package/posthtml-w3c | ||
[exp]: https://github.com/michael-ciniawsky/posthtml-exp | ||
[exp-badge]: https://img.shields.io/npm/v/posthtml-exp.svg | ||
[exp-npm]: https://npmjs.com/package/posthtml-exp | ||
[load]: https://github.com/michael-ciniawsky/posthtml-load-plugins | ||
[load-badge]: https://img.shields.io/npm/v/posthtml-load-plugins.svg | ||
[load-npm]: https://npmjs.com/package/posthtml-load-plugins | ||
[remove]: https://github.com/princed/posthtml-remove-attributes | ||
@@ -493,2 +507,6 @@ [remove-badge]: https://img.shields.io/npm/v/posthtml-remove-attributes.svg | ||
[remove-duplicates]: https://github.com/canvaskisa/posthtml-remove-duplicates | ||
[remove-duplicates-badge]: https://img.shields.io/npm/v/posthtml-remove-duplicates.svg | ||
[remove-duplicates-npm]: https://npmjs.com/package/posthtml-remove-duplicates | ||
[minifier]: https://github.com/Rebelmail/posthtml-minifier | ||
@@ -506,16 +524,156 @@ [minifier-badge]: https://img.shields.io/npm/v/posthtml-minifier.svg | ||
[modules]: https://github.com/canvaskisa/posthtml-modules | ||
[modules-badge]: https://img.shields.io/npm/v/posthtml-modules.svg | ||
[modules-npm]: https://npmjs.com/package/posthtml-modules | ||
[nano]: https://github.com/maltsev/htmlnano | ||
[nano-badge]: https://img.shields.io/npm/v/htmlnano.svg | ||
[nano-npm]: https://npmjs.com/package/htmlnano | ||
[postcss-modules]: https://github.com/canvaskisa/posthtml-postcss-modules | ||
[postcss-modules-badge]: https://img.shields.io/npm/v/posthtml-postcss-modules.svg | ||
[postcss-modules-npm]: https://npmjs.com/package/posthtml-postcss-modules | ||
[transform]: https://github.com/flashlizi/posthtml-transformer | ||
[transform-badge]: https://img.shields.io/npm/v/posthtml-transformer.svg | ||
[transform-npm]: https://npmjs.com/package/posthtml-transformer | ||
[collect-styles]: https://github.com/canvaskisa/posthtml-collect-styles | ||
[collect-styles-badge]: https://img.shields.io/npm/v/posthtml-collect-styles.svg | ||
[collect-styles-npm]: https://npmjs.com/package/posthtml-collect-styles | ||
#### Workflow | ||
[remove-duplicates]: https://github.com/canvaskisa/posthtml-remove-duplicates | ||
[remove-duplicates-badge]: https://img.shields.io/npm/v/posthtml-remove-duplicates.svg | ||
[remove-duplicates-npm]: https://npmjs.com/package/posthtml-remove-duplicates | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-load-plugins][plugins]|[![npm][plugins-badge]][plugins-npm]|Autoload Plugins | ||
|[posthtml-load-options][options]|[![npm][options-badge]][options-npm]|Autoload Options (Parser && Render)| | ||
|[posthtml-load-config][config]|[![npm][config-badge]][config-npm]|Autoload Config (Plugins && Options)| | ||
|[posthtml-w3c][w3c]|[![npm][w3c-badge]][w3c-npm]|Validate HTML with W3C Validation| | ||
|[posthtml-hint][hint]|[![npm][hint-badge]][hint-npm]|Lint HTML with HTML Hint| | ||
|[posthtml-tidy][tidy]|[![npm][tidy-badge]][tidy-npm]|Sanitize HTML with HTML Tidy| | ||
[options]: https://github.com/posthtml/posthtml-load-options | ||
[options-badge]: https://img.shields.io/npm/v/posthtml-load-options.svg | ||
[options-npm]: https://npmjs.com/package/posthtml-load-options | ||
[plugins]: https://github.com/posthtml/posthtml-load-plugins | ||
[plugins-badge]: https://img.shields.io/npm/v/posthtml-load-plugins.svg | ||
[plugins-npm]: https://npmjs.com/package/posthtml-load-plugins | ||
[config]: https://github.com/posthtml/posthtml-load-config | ||
[config-badge]: https://img.shields.io/npm/v/posthtml-load-config.svg | ||
[config-npm]: https://npmjs.com/package/posthtml-load-config | ||
[tidy]: https://github.com/michael-ciniawsky/posthtml-tidy | ||
[tidy-badge]: https://img.shields.io/npm/v/posthtml-tidy.svg | ||
[tidy-npm]: https://npmjs.com/package/posthtml-tidy | ||
[hint]: https://github.com/posthtml/posthtml-hint | ||
[hint-badge]: https://img.shields.io/npm/v/posthtml-hint.svg | ||
[hint-npm]: https://npmjs.com/package/posthtml-hint | ||
[w3c]: https://github.com/posthtml/posthtml-w3c | ||
[w3c-badge]: https://img.shields.io/npm/v/posthtml-w3c.svg | ||
[w3c-npm]: https://npmjs.com/package/posthtml-w3c | ||
## Render | ||
```js | ||
import jsx from 'posthtml-jsx' | ||
posthtml().process(html, { render: jsx(options) }).then((result) => result.html) | ||
``` | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[posthtml-js][js]|[![npm][js-badge]][js-npm]|Render HTML to JS| | ||
|[posthtml-jsx][jsx]|[![npm][jsx-badge]][jsx-npm]|Render HTML to JSX| | ||
[js]: https://github.com/posthtml/posthtml-js | ||
[js-badge]: https://img.shields.io/npm/v/posthtml-js.svg | ||
[js-npm]: https://npmjs.com/package/posthtml-js | ||
[jsx]: https://github.com/posthtml/posthtml-jsx | ||
[jsx-badge]: https://img.shields.io/npm/v/posthtml-jsx.svg | ||
[jsx-npm]: https://npmjs.com/package/posthtml-jsx | ||
## Middleware | ||
|Name|Status|Description| | ||
|:---|:-----|:----------| | ||
|[koa-posthtml][koa]|[![npm][koa-badge]][koa-npm]|Koa Middleware| | ||
|[hapi-posthtml][hapi]|[![npm][hapi-badge]][hapi-npm]|Hapi Plugin| | ||
|[express-posthtml][express]|[![npm][express-badge]][express-npm]|Express Middleware| | ||
|[electron-posthtml][electron]|[![npm][electron-badge]][electron-npm]|Electron Plugin| | ||
|[metalsmith-posthtml][metalsmith]|[![npm][metalsmith-badge]][metalsmith-npm]|Metalsmith Plugin| | ||
[koa]: https://github.com/posthtml/koa-posthtml | ||
[koa-badge]: https://img.shields.io/npm/v/koa-posthtml.svg | ||
[koa-npm]: https://npmjs.com/package/koa-posthtml | ||
[hapi]: https://github.com/posthtml/hapi-posthtml | ||
[hapi-badge]: https://img.shields.io/npm/v/hapi-posthtml.svg | ||
[hapi-npm]: https://npmjs.com/package/hapi-posthtml | ||
[express]: https://github.com/posthtml/express-posthtml | ||
[express-badge]: https://img.shields.io/npm/v/express-posthtml.svg | ||
[express-npm]: https://npmjs.com/package/express-posthtml | ||
[electron]: https://github.com/posthtml/electron-posthtml | ||
[electron-badge]: https://img.shields.io/npm/v/electron-posthtml.svg | ||
[electron-npm]: https://npmjs.com/package/electron-posthtml | ||
[metalsmith]: https://github.com/posthtml/metalsmith-posthtml | ||
[metalsmith-badge]: https://img.shields.io/npm/v/metalsmith-posthtml.svg | ||
[metalsmith-npm]: https://npmjs.com/package/metalsmith-posthtml | ||
## Maintainers | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/u/1510217?v=3&s=150"> | ||
<br /> | ||
<a href="https://github.com/voischev">Ivan Voischev</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/u/982072?v=3&s=150"> | ||
<br /> | ||
<a href="https://github.com/awinogradov">Anton Winogradov</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/u/677518?v=3&s=150"> | ||
<br /> | ||
<a href="https://github.com/zxqfox">Alexej Yaroshevich</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150 height="150" | ||
src="https://avatars.githubusercontent.com/u/1813468?v=3&s=150"> | ||
<br /> | ||
<a href="https://github.com/Yeti-or">Vasiliy</a> | ||
</td> | ||
</tr> | ||
<tbody> | ||
</table> | ||
## Contributing | ||
See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs) and [CONTRIBUTING](CONTRIBUTING.md). | ||
## LICENSE | ||
[MIT](LICENSE) | ||
[npm]: https://img.shields.io/npm/v/posthtml.svg | ||
[npm-url]: https://npmjs.com/package/posthtml | ||
[deps]: https://david-dm.org/posthtml/posthtml.svg | ||
[deps-url]: https://david-dm.org/posthtml/posthtml | ||
[build]: https://travis-ci.org/posthtml/posthtml.svg?branch=master | ||
[build-url]: https://travis-ci.org/posthtml/posthtml?branch=master | ||
[cover]: https://coveralls.io/repos/posthtml/posthtml/badge.svg?branch=master | ||
[cover-url]: https://coveralls.io/r/posthtml/posthtml?branch=master | ||
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg | ||
[style-url]: http://standardjs.com/ | ||
[chat]: https://badges.gitter.im/posthtml/posthtml.svg | ||
[chat-url]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" |
Sorry, the diff of this file is not supported yet
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
50228
344
668
7
1
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.0(transitive)
+ Addedposthtml-parser@0.2.1(transitive)
- Removedposthtml-parser@0.1.3(transitive)
Updatedposthtml-parser@^0.2.0