fc65cb6e457c6d6ec3e1fa91ba73d9ae7e8560589bc240e36555327e3e87073bd7fd952af63c6b708a4be68d4aa446cf368c2d92ccb352ef7a784320d856c9 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. [![NPM][npm]][npm-url]
  2. [![Deps][deps]][deps-url]
  3. [![Tests][build]][build-url]
  4. [![Coverage][cover]][cover-url]
  5. [![Standard Code Style][code-style]][code-style-url]
  6. [![Chat][chat]][chat-url]
  7. # PostHTML <img align="right" width="220" height="200" title="PostHTML" src="http://posthtml.github.io/posthtml/logo.svg">
  8. 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.
  9. All HTML transformations are made by plugins. And these plugins are just small plain JS functions, which receive a HTML node tree, transform it, and return a modified tree.
  10. For more detailed information about PostHTML in general take a look at the [docs][docs].
  11. ### Dependencies
  12. | Name | Status | Description |
  13. |:----:|:------:|:-----------:|
  14. |[posthtml-parser][parser]|[![npm][parser-badge]][parser-npm]| Parser HTML/XML to PostHTMLTree |
  15. |[posthtml-render][render]|[![npm][render-badge]][render-npm]| Render PostHTMLTree to HTML/XML |
  16. [docs]: https://github.com/posthtml/posthtml/blob/master/docs
  17. [parser]: https://github.com/posthtml/posthtml-parser
  18. [parser-badge]: https://img.shields.io/npm/v/posthtml-parser.svg
  19. [parser-npm]: https://npmjs.com/package/posthtml-parser
  20. [render]: https://github.com/posthtml/posthtml-render
  21. [render-badge]: https://img.shields.io/npm/v/posthtml-render.svg
  22. [render-npm]: https://npmjs.com/package/posthtml-render
  23. ## Install
  24. ```bash
  25. npm i -D posthtml
  26. ```
  27. ## Usage
  28. ### API
  29. **Sync**
  30. ```js
  31. import posthtml from 'posthtml'
  32. const html = `
  33. <component>
  34. <title>Super Title</title>
  35. <text>Awesome Text</text>
  36. </component>
  37. `
  38. const result = posthtml()
  39. .use(require('posthtml-custom-elements')())
  40. .process(html, { sync: true })
  41. .html
  42. console.log(result)
  43. ```
  44. ```html
  45. <div class="component">
  46. <div class="title">Super Title</div>
  47. <div class="text">Awesome Text</div>
  48. </div>
  49. ```
  50. > :warning: Async Plugins can't be used in sync mode and will throw an Error. It's recommended to use PostHTML asynchronously whenever possible.
  51. **Async**
  52. ```js
  53. import posthtml from 'posthtml'
  54. const html = `
  55. <html>
  56. <body>
  57. <p class="wow">OMG</p>
  58. </body>
  59. </html>
  60. `
  61. posthtml(
  62. [
  63. require('posthtml-to-svg-tags')(),
  64. require('posthtml-extend-attrs')({
  65. attrsTree: {
  66. '.wow' : {
  67. id: 'wow_id',
  68. fill: '#4A83B4',
  69. 'fill-rule': 'evenodd',
  70. 'font-family': 'Verdana'
  71. }
  72. }
  73. })
  74. ])
  75. .process(html/*, options */)
  76. .then((result) => console.log(result.html))
  77. ```
  78. ```html
  79. <svg xmlns="http://www.w3.org/2000/svg">
  80. <text
  81. class="wow"
  82. id="wow_id"
  83. fill="#4A83B4"
  84. fill-rule="evenodd" font-family="Verdana">
  85. OMG
  86. </text>
  87. </svg>
  88. ```
  89. ### [CLI](https://npmjs.com/package/posthtml-cli)
  90. ```bash
  91. npm i posthtml-cli
  92. ```
  93. ```json
  94. "scripts": {
  95. "posthtml": "posthtml -o output.html -i input.html -c config.json"
  96. }
  97. ```
  98. ```bash
  99. npm run posthtml
  100. ```
  101. ### [Gulp](https://gulpjs.com)
  102. ```bash
  103. npm i -D gulp-posthtml
  104. ```
  105. ```js
  106. import tap from 'gulp-tap'
  107. import posthtml from 'gulp-posthtml'
  108. import { task, src, dest } from 'gulp'
  109. task('html', () => {
  110. let path
  111. const plugins = [ require('posthtml-include')({ root: `${path}` }) ]
  112. const options = {}
  113. src('src/**/*.html')
  114. .pipe(tap((file) => path = file.path))
  115. .pipe(posthtml(plugins, options))
  116. .pipe(dest('build/'))
  117. })
  118. ```
  119. Check [project-stub](https://github.com/posthtml/project-stub) for an example with Gulp
  120. ### [Grunt](https://gruntjs.com)
  121. ```bash
  122. npm i -D grunt-posthtml
  123. ```
  124. ```js
  125. posthtml: {
  126. options: {
  127. use: [
  128. require('posthtml-doctype')({ doctype: 'HTML 5' }),
  129. require('posthtml-include')({ root: './', encoding: 'utf-8' })
  130. ]
  131. },
  132. build: {
  133. files: [
  134. {
  135. dot: true,
  136. cwd: 'html/',
  137. src: ['*.html'],
  138. dest: 'tmp/',
  139. expand: true,
  140. }
  141. ]
  142. }
  143. }
  144. ```
  145. ### [Webpack](https://webpack.js.org)
  146. ```bash
  147. npm i -D html-loader posthtml-loader
  148. ```
  149. #### v1.x
  150. **webpack.config.js**
  151. ```js
  152. const config = {
  153. module: {
  154. loaders: [
  155. {
  156. test: /\.html$/,
  157. loader: 'html!posthtml'
  158. }
  159. ]
  160. }
  161. posthtml: (ctx) => {
  162. return {
  163. parser: require('posthtml-pug')
  164. plugins: [
  165. require('posthtml-include')({ root: ctx.resourcePath })
  166. ]
  167. }
  168. }
  169. }
  170. export default config
  171. ```
  172. #### v2.x
  173. **webpack.config.js**
  174. ```js
  175. import { LoaderOptionsPlugin } from 'webpack'
  176. const config = {
  177. module: {
  178. rules: [
  179. {
  180. test: /\.html$/,
  181. use: [
  182. { loader: 'html-loader', options: { minimize: true } }
  183. 'posthtml-loader'
  184. ]
  185. }
  186. ]
  187. }
  188. plugins: [
  189. new LoaderOptionsPlugin({
  190. options: {
  191. posthtml (ctx) {
  192. parser: require('posthtml-pug')
  193. plugins: [
  194. require('posthtml-include')({ root: ctx.resourcePath }) }
  195. ]
  196. }
  197. }
  198. })
  199. ]
  200. }
  201. export default config
  202. ```
  203. ## Parser
  204. ```js
  205. import pug from 'posthtml-pug'
  206. posthtml().process(html, { parser: pug(options) }).then((result) => result.html)
  207. ```
  208. | Name |Status|Description|
  209. |:-----|:-----|:----------|
  210. |[posthtml-pug][pug]|[![npm][pug-badge]][pug-npm]|Pug Parser|
  211. |[sugarml][sugar]|[![npm][sugar-badge]][sugar-npm]|SugarML Parser|
  212. [pug]: https://github.com/posthtml/posthtml-pug
  213. [pug-badge]: https://img.shields.io/npm/v/posthtml-pug.svg
  214. [pug-npm]: https://npmjs.com/package/posthtml-pug
  215. [sugar]: https://github.com/posthtml/sugarml
  216. [sugar-badge]: https://img.shields.io/npm/v/sugarml.svg
  217. [sugar-npm]: https://npmjs.com/package/sugarml
  218. ## [Plugins](http://maltsev.github.io/posthtml-plugins)
  219. In case you want to develop your own plugin, we recommend using [posthtml-plugin-boilerplate][plugin] for getting started.
  220. [plugin]: https://github.com/posthtml/posthtml-plugin-boilerplate
  221. #### TEXT
  222. | Name |Status|Description|
  223. |:-----|:-----|:----------|
  224. |[posthtml-md][md]|[![npm][md-badge]][md-npm]|Easily use context-sensitive markdown within HTML|
  225. |[posthtml-lorem][lorem]|[![npm][lorem-badge]][lorem-npm]|Add lorem ipsum placeholder text to any document|
  226. |[posthtml-retext][text]|[![npm][text-badge]][text-npm]|Extensible system for analysing and manipulating natural language|
  227. [md]: https://github.com/jonathantneal/posthtml-md
  228. [md-badge]: https://img.shields.io/npm/v/posthtml-md.svg
  229. [md-npm]: https://npmjs.com/package/posthtml-md
  230. [text]: https://github.com/voischev/posthtml-retext
  231. [text-badge]: https://img.shields.io/npm/v/posthtml-retext.svg
  232. [text-npm]: https://npmjs.com/package/posthtml-retext
  233. [lorem]: https://github.com/jonathantneal/posthtml-lorem
  234. [lorem-badge]: https://img.shields.io/npm/v/posthtml-lorem.svg
  235. [lorem-npm]: https://npmjs.com/package/posthtml-lorem
  236. #### HTML
  237. |Name|Status|Description|
  238. |:---|:----:|:----------|
  239. |[posthtml-doctype][doctype]|[![npm][doctype-badge]][doctype-npm]|Set !DOCTYPE|
  240. |[posthtml-head-elements][head]|[![npm][head-badge]][head-npm]|Include head elements from JSON file|
  241. |[posthtml-include][include]|[![npm][include-badge]][include-npm]|Include HTML|
  242. |[posthtml-modules][modules]|[![npm][modules-badge]][modules-npm]|Include and process HTML|
  243. |[posthtml-extend][extend]|[![npm][extend-badge]][extend-npm]|Extend Layout (Pug-like)|
  244. |[posthtml-extend-attrs][attrs]|[![npm][attrs-badge]][attrs-npm]|Extend Attrs|
  245. |[posthtml-expressions][exp]|[![npm][exp-badge]][exp-npm]|Template Expressions|
  246. |[posthtml-inline-assets][assets]|[![npm][assets-badge]][assets-npm]|Inline external scripts, styles, and images|
  247. |[posthtml-static-react][react]|[![npm][react-badge]][react-npm]| Render custom elements as static React components|
  248. |[posthtml-custom-elements][elem]|[![npm][elem-badge]][elem-npm]|Use custom elements|
  249. |[posthtml-web-component][web]|[![npm][web-badge]][web-npm]|Web Component server-side rendering, Component as a Service (CaaS)|
  250. [doctype]: https://github.com/posthtml/posthtml-doctype
  251. [doctype-badge]: https://img.shields.io/npm/v/posthtml-doctype.svg
  252. [doctype-npm]: https://npmjs.com/package/posthtml-doctype
  253. [head]: https://github.com/TCotton/posthtml-head-elements
  254. [head-badge]: https://img.shields.io/npm/v/posthtml-head-elements.svg
  255. [head-npm]: https://npmjs.com/package/posthtml-head-elements
  256. [include]: https://github.com/posthtml/posthtml-include
  257. [include-badge]: https://img.shields.io/npm/v/posthtml-include.svg
  258. [include-npm]: https://npmjs.com/package/posthtml-include
  259. [modules]: https://github.com/posthtml/posthtml-modules
  260. [modules-badge]: https://img.shields.io/npm/v/posthtml-modules.svg
  261. [modules-npm]: https://npmjs.com/package/posthtml-modules
  262. [content]: https://github.com/posthtml/posthtml-content
  263. [content-badge]: https://img.shields.io/npm/v/posthtml-content.svg
  264. [content-npm]: https://npmjs.com/package/posthtml-content
  265. [exp]: https://github.com/posthtml/posthtml-exp
  266. [exp-badge]: https://img.shields.io/npm/v/posthtml-exp.svg
  267. [exp-npm]: https://npmjs.com/package/posthtml-exp
  268. [extend]: https://github.com/posthtml/posthtml-extend
  269. [extend-badge]: https://img.shields.io/npm/v/posthtml-extend.svg
  270. [extend-npm]: https://npmjs.com/package/posthtml-extend
  271. [attrs]: https://github.com/theprotein/posthtml-extend-attrs
  272. [attrs-badge]: https://img.shields.io/npm/v/posthtml-extend-attrs.svg
  273. [attrs-npm]: https://npmjs.com/package/posthtml-extend-attrs
  274. [assets]: https://github.com/jonathantneal/posthtml-inline-assets
  275. [assets-badge]: https://img.shields.io/npm/v/posthtml-inline-assets.svg
  276. [assets-npm]: https://npmjs.com/package/posthtml-inline-assets
  277. [elem]: https://github.com/posthtml/posthtml-custom-elements
  278. [elem-badge]: https://img.shields.io/npm/v/posthtml-custom-elements.svg
  279. [elem-npm]: https://npmjs.com/package/posthtml-custom-elements
  280. [web]: https://github.com/island205/posthtml-web-component
  281. [web-badge]: https://img.shields.io/npm/v/posthtml-web-component.svg
  282. [web-npm]: https://npmjs.com/package/posthtml-web-components
  283. [prefix]: https://github.com/stevenbenisek/posthtml-prefix-class
  284. [prefix-badge]: https://img.shields.io/npm/v/posthtml-prefix-class.svg
  285. [prefix-npm]: https://npmjs.com/package/posthtml-prefix-class
  286. [react]: https://github.com/rasmusfl0e/posthtml-static-react
  287. [react-badge]: https://img.shields.io/npm/v/posthtml-static-react.svg
  288. [react-npm]: https://npmjs.com/package/posthtml-static-react
  289. #### CSS
  290. |Name|Status|Description|
  291. |:---|:-----|:----------|
  292. |[posthtml-bem][bem]|[![npm][bem-badge]][bem-npm]|Support BEM naming in html structure|
  293. |[posthtml-postcss][css]|[![npm][css-badge]][css-npm]|Use [PostCSS][css-gh] in HTML document|
  294. |[posthtml-px2rem][px2rem]|[![npm][px2rem-badge]][px2rem-npm]|Change px to rem in Inline CSS|
  295. |[posthtml-css-modules][css-modules]|[![npm][css-modules-badge]][css-modules-npm]|Use CSS modules in HTML|
  296. |[posthtml-postcss-modules][postcss-modules]|[![npm][postcss-modules-badge]][postcss-modules-npm]|CSS Modules in html|
  297. |[posthtml-classes][classes]|[![npm][classes-badge]][classes-npm]|Get a list of classes from HTML|
  298. |[posthtml-prefix-class][prefix]|[![npm][prefix-badge]][prefix-npm]|Prefix class names
  299. |[posthtml-modular-css][modular]|[![npm][modular-badge]][modular-npm]|Make CSS modular|
  300. |[posthtml-inline-css][in]|[![npm][in-badge]][in-npm]|CSS Inliner|
  301. |[posthtml-collect-styles][collect-styles]|[![npm][collect-styles-badge]][collect-styles-npm]|Collect styles from html and put it in the head|
  302. |[posthtml-collect-inline-styles][collect]|[![npm][collect-badge]][collect-npm]|Collect inline styles and insert to head tag|
  303. |[posthtml-style-to-file][style]|[![npm][style-badge]][style-npm]| Save HTML style nodes and attributes to CSS file|
  304. |[posthtml-color-shorthand-hex-to-six-digit][hex]|[![npm][hex-badge]][hex-npm]|Enforce all hex color codes to be 6-char long|
  305. [bem]: https://github.com/rajdee/posthtml-bem
  306. [bem-badge]: https://img.shields.io/npm/v/posthtml-bem.svg
  307. [bem-npm]: https://npmjs.com/package/posthtml-bem
  308. [css]: https://github.com/posthtml/posthtml-postcss
  309. [css-badge]: https://img.shields.io/npm/v/posthtml-postcss.svg
  310. [css-npm]: https://npmjs.com/package/posthtml-postcss
  311. [css-gh]: https://github.com/postcss/postcss
  312. [postcss-modules]: https://github.com/posthtml/posthtml-postcss-modules
  313. [postcss-modules-badge]: https://img.shields.io/npm/v/posthtml-postcss-modules.svg
  314. [postcss-modules-npm]: https://npmjs.com/package/posthtml-postcss-modules
  315. [css-modules]: https://github.com/posthtml/posthtml-css-modules
  316. [css-modules-badge]: https://img.shields.io/npm/v/posthtml-css-modules.svg
  317. [css-modules-npm]: https://npmjs.com/package/posthtml-css-modules
  318. [collect-styles]: https://github.com/posthtml/posthtml-collect-styles
  319. [collect-styles-badge]: https://img.shields.io/npm/v/posthtml-collect-styles.svg
  320. [collect-styles-npm]: https://npmjs.com/package/posthtml-collect-styles
  321. [collect]: https://github.com/totora0155/posthtml-collect-inline-styles
  322. [collect-badge]: https://img.shields.io/npm/v/posthtml-collect-inline-styles.svg
  323. [collect-npm]: https://npmjs.com/package/posthtml-collect-inline-styles
  324. [px2rem]: https://github.com/weixin/posthtml-px2rem
  325. [px2rem-badge]: https://img.shields.io/npm/v/posthtml-px2rem.svg
  326. [px2rem-npm]: https://npmjs.com/package/posthtml-px2rem
  327. [classes]: https://github.com/rajdee/posthtml-classes
  328. [classes-badge]: https://img.shields.io/npm/v/posthtml-classes.svg
  329. [classes-npm]: https://npmjs.com/package/posthtml-classes
  330. [prefix]: https://github.com/stevenbenisek/posthtml-prefix-class
  331. [prefix-badge]: https://img.shields.io/npm/v/posthtml-prefix-class.svg
  332. [prefix-npm]: https://npmjs.com/package/posthtml-prefix-class
  333. [modular]: https://github.com/admdh/posthtml-modular-css
  334. [modular-badge]: https://img.shields.io/npm/v/posthtml-modular-css.svg
  335. [modular-npm]: https://npmjs.com/package/posthtml-modular-css
  336. [in]: https://github.com/posthtml/posthtml-inline-css
  337. [in-badge]: https://img.shields.io/npm/v/posthtml-inline-css.svg
  338. [in-npm]: https://npmjs.com/package/posthtml-inline-css
  339. [style]: https://github.com/posthtml/posthtml-style-to-file
  340. [style-badge]: https://img.shields.io/npm/v/posthtml-style-to-file.svg
  341. [style-npm]: https://npmjs.com/package/posthtml-style-to-file
  342. [hex]: https://github.com/code-and-send/posthtml-color-shorthand-hex-to-six-digit
  343. [hex-badge]: https://img.shields.io/npm/v/posthtml-color-shorthand-hex-to-six-digit.svg
  344. [hex-npm]: https://npmjs.com/package/posthtml-color-shorthand-hex-to-six-digit
  345. #### IMG & SVG
  346. |Name|Status|Description|
  347. |:---|:-----|:----------|
  348. |[posthtml-img-autosize][img]|[![npm][img-badge]][img-npm]|Auto setting the width and height of \<img\>|
  349. |[posthtml-to-svg-tags][svg]|[![npm][svg-badge]][svg-npm]|Convert html tags to svg equals|
  350. |[posthtml-webp][webp]|[![npm][webp-badge]][webp-npm]|Add WebP support for images|
  351. [img]: https://github.com/posthtml/posthtml-img-autosize
  352. [img-badge]: https://img.shields.io/npm/v/posthtml-img-autosize.svg
  353. [img-npm]: https://npmjs.com/package/posthtml-img-autosize
  354. [svg]: https://github.com/theprotein/posthtml-to-svg-tags
  355. [svg-badge]: https://img.shields.io/npm/v/posthtml-to-svg-tags.svg
  356. [svg-npm]: https://npmjs.com/package/posthtml-to-svg-tags
  357. [webp]: https://github.com/seokirill/posthtml-webp
  358. [webp-badge]: https://img.shields.io/npm/v/posthtml-webp.svg
  359. [webp-npm]: https://npmjs.com/package/posthtml-webp
  360. #### Accessibility
  361. |Name|Status|Description|
  362. |:---|:-----|:----------|
  363. |[posthtml-aria-tabs][aria]|[![npm][aria-badge]][aria-npm]|Write accessible tabs with minimal markup|
  364. |[posthtml-alt-always][alt]|[![npm][alt-badge]][alt-npm]|Always add alt attribute for images that don't have it|
  365. |[posthtml-schemas][schemas]|[![npm][schemas-badge]][schemas-npm]| Add microdata to your HTML|
  366. [alt]: https://github.com/ismamz/posthtml-alt-always
  367. [alt-badge]: https://img.shields.io/npm/v/posthtml-alt-always.svg
  368. [alt-npm]: https://npmjs.com/package/posthtml-alt-always
  369. [aria]: https://github.com/jonathantneal/posthtml-aria-tabs
  370. [aria-badge]: https://img.shields.io/npm/v/posthtml-aria-tabs.svg
  371. [aria-npm]: https://npmjs.com/package/posthtml-aria-tabs
  372. [schemas]: https://github.com/jonathantneal/posthtml-schemas
  373. [schemas-badge]: https://img.shields.io/npm/v/posthtml-schemas.svg
  374. [schemas-npm]: https://npmjs.com/package/posthtml-schemas
  375. #### Optimization
  376. |Name|Status|Description|
  377. |:---|:-----|:----------|
  378. |[posthtml-shorten][shorten]|[![npm][shorten-badge]][shorten-npm]|Shorten URLs in HTML|
  379. |[posthtml-uglify][uglify]|[![npm][uglify-badge]][uglify-npm]|Shorten CSS in HTML|
  380. |[posthtml-minifier][minifier]|[![npm][minifier-badge]][minifier-npm]|Minify HTML|
  381. |[posthtml-remove-attributes][remove]|[![npm][remove-badge]][remove-npm]|Remove attributes unconditionally or with content match|
  382. |[posthtml-remove-duplicates][remove-duplicates]|[![npm][remove-duplicates-badge]][remove-duplicates-npm]|Remove duplicate elements from your html|
  383. |[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.|
  384. |[htmlnano][nano]|[![npm][nano-badge]][nano-npm]|HTML Minifier|
  385. |[posthtml-email-remove-unused-css][unused]|[![npm][unused-badge]][unused-npm]|Remove unused CSS from email templates|
  386. [remove]: https://github.com/princed/posthtml-remove-attributes
  387. [remove-badge]: https://img.shields.io/npm/v/posthtml-remove-attributes.svg
  388. [remove-npm]: https://npmjs.com/package/posthtml-remove-attributes
  389. [remove-duplicates]: https://github.com/canvaskisa/posthtml-remove-duplicates
  390. [remove-duplicates-badge]: https://img.shields.io/npm/v/posthtml-remove-duplicates.svg
  391. [remove-duplicates-npm]: https://npmjs.com/package/posthtml-remove-duplicates
  392. [minifier]: https://github.com/Rebelmail/posthtml-minifier
  393. [minifier-badge]: https://img.shields.io/npm/v/posthtml-minifier.svg
  394. [minifier-npm]: https://npmjs.com/package/posthtml-minifier
  395. [shorten]: https://github.com/Rebelmail/posthtml-shorten
  396. [shorten-badge]: https://img.shields.io/npm/v/posthtml-shorten.svg
  397. [shorten-npm]: https://npmjs.com/package/posthtml-shorten
  398. [uglify]: https://github.com/Rebelmail/posthtml-uglify
  399. [uglify-badge]: https://img.shields.io/npm/v/posthtml-uglify.svg
  400. [uglify-npm]: https://npmjs.com/package/posthtml-uglify
  401. [nano]: https://github.com/maltsev/htmlnano
  402. [nano-badge]: https://img.shields.io/npm/v/htmlnano.svg
  403. [nano-npm]: https://npmjs.com/package/htmlnano
  404. [unused]: https://github.com/code-and-send/posthtml-email-remove-unused-css
  405. [unused-badge]: https://img.shields.io/npm/v/posthtml-email-remove-unused-css.svg
  406. [unused-npm]: https://npmjs.com/package/posthtml-email-remove-unused-css
  407. [transform]: https://github.com/flashlizi/posthtml-transformer
  408. [transform-badge]: https://img.shields.io/npm/v/posthtml-transformer.svg
  409. [transform-npm]: https://npmjs.com/package/posthtml-transformer
  410. #### Workflow
  411. |Name|Status|Description|
  412. |:---|:-----|:----------|
  413. |[posthtml-load-plugins][plugins]|[![npm][plugins-badge]][plugins-npm]|Autoload Plugins
  414. |[posthtml-load-options][options]|[![npm][options-badge]][options-npm]|Autoload Options (Parser && Render)|
  415. |[posthtml-load-config][config]|[![npm][config-badge]][config-npm]|Autoload Config (Plugins && Options)|
  416. |[posthtml-w3c][w3c]|[![npm][w3c-badge]][w3c-npm]|Validate HTML with W3C Validation|
  417. |[posthtml-hint][hint]|[![npm][hint-badge]][hint-npm]|Lint HTML with HTML Hint|
  418. |[posthtml-tidy][tidy]|[![npm][tidy-badge]][tidy-npm]|Sanitize HTML with HTML Tidy|
  419. [options]: https://github.com/posthtml/posthtml-load-options
  420. [options-badge]: https://img.shields.io/npm/v/posthtml-load-options.svg
  421. [options-npm]: https://npmjs.com/package/posthtml-load-options
  422. [plugins]: https://github.com/posthtml/posthtml-load-plugins
  423. [plugins-badge]: https://img.shields.io/npm/v/posthtml-load-plugins.svg
  424. [plugins-npm]: https://npmjs.com/package/posthtml-load-plugins
  425. [config]: https://github.com/posthtml/posthtml-load-config
  426. [config-badge]: https://img.shields.io/npm/v/posthtml-load-config.svg
  427. [config-npm]: https://npmjs.com/package/posthtml-load-config
  428. [tidy]: https://github.com/michael-ciniawsky/posthtml-tidy
  429. [tidy-badge]: https://img.shields.io/npm/v/posthtml-tidy.svg
  430. [tidy-npm]: https://npmjs.com/package/posthtml-tidy
  431. [hint]: https://github.com/posthtml/posthtml-hint
  432. [hint-badge]: https://img.shields.io/npm/v/posthtml-hint.svg
  433. [hint-npm]: https://npmjs.com/package/posthtml-hint
  434. [w3c]: https://github.com/posthtml/posthtml-w3c
  435. [w3c-badge]: https://img.shields.io/npm/v/posthtml-w3c.svg
  436. [w3c-npm]: https://npmjs.com/package/posthtml-w3c
  437. ## Middleware
  438. |Name|Status|Description|
  439. |:---|:-----|:----------|
  440. |[koa-posthtml][koa]|[![npm][koa-badge]][koa-npm]|Koa Middleware|
  441. |[hapi-posthtml][hapi]|[![npm][hapi-badge]][hapi-npm]|Hapi Plugin|
  442. |[express-posthtml][express]|[![npm][express-badge]][express-npm]|Express Middleware|
  443. |[electron-posthtml][electron]|[![npm][electron-badge]][electron-npm]|Electron Plugin|
  444. |[metalsmith-posthtml][metalsmith]|[![npm][metalsmith-badge]][metalsmith-npm]|Metalsmith Plugin|
  445. [koa]: https://github.com/posthtml/koa-posthtml
  446. [koa-badge]: https://img.shields.io/npm/v/koa-posthtml.svg
  447. [koa-npm]: https://npmjs.com/package/koa-posthtml
  448. [hapi]: https://github.com/posthtml/hapi-posthtml
  449. [hapi-badge]: https://img.shields.io/npm/v/hapi-posthtml.svg
  450. [hapi-npm]: https://npmjs.com/package/hapi-posthtml
  451. [express]: https://github.com/posthtml/express-posthtml
  452. [express-badge]: https://img.shields.io/npm/v/express-posthtml.svg
  453. [express-npm]: https://npmjs.com/package/express-posthtml
  454. [electron]: https://github.com/posthtml/electron-posthtml
  455. [electron-badge]: https://img.shields.io/npm/v/electron-posthtml.svg
  456. [electron-npm]: https://npmjs.com/package/electron-posthtml
  457. [metalsmith]: https://github.com/posthtml/metalsmith-posthtml
  458. [metalsmith-badge]: https://img.shields.io/npm/v/metalsmith-posthtml.svg
  459. [metalsmith-npm]: https://npmjs.com/package/metalsmith-posthtml
  460. ## Maintainers
  461. <table>
  462. <tbody>
  463. <tr>
  464. <td align="center">
  465. <img width="150 height="150"
  466. src="https://avatars.githubusercontent.com/u/1510217?v=3&s=150">
  467. <br />
  468. <a href="https://github.com/voischev">Ivan Voischev</a>
  469. </td>
  470. <td align="center">
  471. <img width="150 height="150"
  472. src="https://avatars.githubusercontent.com/u/982072?v=3&s=150">
  473. <br />
  474. <a href="https://github.com/awinogradov">Anton Winogradov</a>
  475. </td>
  476. <td align="center">
  477. <img width="150 height="150"
  478. src="https://avatars.githubusercontent.com/u/677518?v=3&s=150">
  479. <br />
  480. <a href="https://github.com/zxqfox">Alexej Yaroshevich</a>
  481. </td>
  482. <td align="center">
  483. <img width="150 height="150"
  484. src="https://avatars.githubusercontent.com/u/1813468?v=3&s=150">
  485. <br />
  486. <a href="https://github.com/Yeti-or">Vasiliy</a>
  487. </td>
  488. </tr>
  489. <tbody>
  490. </table>
  491. ## Contributing
  492. See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs) and [CONTRIBUTING](CONTRIBUTING.md).
  493. ## LICENSE
  494. [MIT](LICENSE)
  495. [npm]: https://img.shields.io/npm/v/posthtml.svg
  496. [npm-url]: https://npmjs.com/package/posthtml
  497. [deps]: https://david-dm.org/posthtml/posthtml.svg
  498. [deps-url]: https://david-dm.org/posthtml/posthtml
  499. [build]: https://travis-ci.org/posthtml/posthtml.svg?branch=master
  500. [build-url]: https://travis-ci.org/posthtml/posthtml?branch=master
  501. [cover]: https://coveralls.io/repos/posthtml/posthtml/badge.svg?branch=master
  502. [cover-url]: https://coveralls.io/r/posthtml/posthtml?branch=master
  503. [code-style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
  504. [code-style-url]: http://standardjs.com/
  505. [chat]: https://badges.gitter.im/posthtml/posthtml.svg
  506. [chat-url]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"