Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

posthtml

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthtml - npm Package Compare versions

Comparing version 0.11.6 to 0.12.0

14

CHANGELOG.md

@@ -5,2 +5,16 @@ # Changelog

## [0.12.0](https://github.com/posthtml/posthtml/compare/v0.11.6...v0.12.0) (2019-10-11)
### Features
* **index:** tree fromString/toString, close [#242](https://github.com/posthtml/posthtml/issues/242) ([2647d53](https://github.com/posthtml/posthtml/commit/2647d53f07cbb850004b259b9272946b56fa434a))
### Bug Fixes
* **index:** example for parser/render ([d25743f](https://github.com/posthtml/posthtml/commit/d25743fbc383cdd867159703263a8b7ec5943e7b))
* **index:** forgot change methods name ([72a8640](https://github.com/posthtml/posthtml/commit/72a8640ed0e28898601ea196c4908f55e3082fd0))
* **index:** remove static method because not return class constructor ([7825559](https://github.com/posthtml/posthtml/commit/7825559cdec47d50788633031d56c0c6938b10d7))
### [0.11.6](https://github.com/posthtml/posthtml/compare/v0.11.5...v0.11.6) (2019-08-30)

@@ -7,0 +21,0 @@

65

lib/index.js

@@ -9,5 +9,3 @@ var pkg = require('../package.json')

* @author Ivan Voischev (@voischev),
* Anton Winogradov (@awinogradov),
* Alexej Yaroshevich (@zxqfox),
* Vasiliy (@Yeti-or)
* Ivan Demidov (@scrum)
*

@@ -55,2 +53,44 @@ * @requires api

/**
* Tree method parsing string inside plugins.
*
* @memberof tree
* @type {Function} parser
*
* @example
* ```js
* export default function plugin (options = {}) {
* return function (tree) {
* tree.match({ tag: 'include' }, function(node) {
* node.tag = false;
* node.content = tree.parser(fs.readFileSync(node.attr.src))
* return node
* })
*
* return tree
* }
* }
* ```
*/
this.parser = parser
/**
* Tree method rendering tree to string inside plugins.
*
* @memberof tree
* @type {Function} render
*
* @example
* ```js
* export default function plugin (options = {}) {
* return function (tree) {
* var outherTree = ['\n', {tag: 'div', content: ['1']}, '\n\t', {tag: 'div', content: ['2']}, '\n'];
* var htmlWitchoutSpaceless = tree.render(outherTree).replace(/[\n|\t]/g, '');
* return tree.parser(htmlWitchoutSpaceless)
* }
* }
* ```
*/
this.render = render
// extend api methods

@@ -61,17 +101,2 @@ Api.call(this)

/**
* @requires posthtml-parser
*
* @param {String} html - Input (HTML)
* @returns {Array} tree - PostHTMLTree (JSON)
*/
PostHTML.parser = parser
/**
* @requires posthtml-render
*
* @param {Array} tree - PostHTMLTree (JSON)
* @returns {String} html - HTML
*/
PostHTML.render = render
/**
* @this posthtml

@@ -123,4 +148,4 @@ * @param {Function} plugin - A PostHTML plugin

if (options.parser) parser = options.parser
if (options.render) render = options.render
if (options.parser) parser = this.parser = options.parser
if (options.render) render = this.render = options.render

@@ -127,0 +152,0 @@ tree = options.skipParse

{
"name": "posthtml",
"version": "0.11.6",
"version": "0.12.0",
"description": "HTML/XML processor",

@@ -48,3 +48,3 @@ "keywords": [

},
"author": "Anton Winogradov <winogradovaa@gmail.com>",
"author": "Ivan Voischev <voischev.ivan@ya.ru>",
"contributors": [

@@ -56,8 +56,4 @@ {

{
"name": "Anton Winogradov",
"email": "winogradovaa@gmail.com"
},
{
"name": "Alexej Yaroshevich",
"email": "zxqfox@gmail.com"
"name": "Ivan Demidov",
"email": "scrum@list.ru"
}

@@ -68,3 +64,7 @@ ],

"bugs": "https://github.com/posthtml/posthtml/issues",
"license": "MIT"
"license": "MIT",
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/posthtml"
}
}

@@ -725,20 +725,2 @@ [![NPM][npm]][npm-url]

</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>

@@ -752,2 +734,6 @@ <tbody>

## Contributors
<a href="https://github.com/posthtml/posthtml/graphs/contributors"><img src="https://opencollective.com/posthtml/contributors.svg?width=890&button=false" /></a>
## LICENSE

@@ -754,0 +740,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc