postxml-custom-tags

0.1.1 • Public • Published

postxml-custom-tags

npm version

PostXML plugin anable using custom tags in html. It replace them with div elements.

Installation

npm i postxml-custom-tags --save-dev

Usage

var fs = require(fs),
   postxml = require(postxml),
   plugin = require(postxml-custom-tags);
 
var html = fs.readFileSync(input.html, utf8);
 
var output = postxml(
      html,
      [
         plugin()
      ]
   );

Example

Input

<custom class="b-block" ng-click="init = 2">Text</custom>

Output

<div class="b-block" ng-click="init = 2">Text</div>

options

src

Type: string
Default: undefined
Description: set tag for replacement of tags with "src" (except audio, frame, iframe, img, input, layer, script, textarea, video)
Example:

var fs = require(fs),
   postxml = require(postxml),
   plugin = require(postxml-custom-tags);
 
var html = fs.readFileSync(input.html, utf8);
 
var output = postxml(
      html,
      [
         plugin({
             src: 'img'
         })
      ]
   );
/*Input*/
<image src="image.png"></image>
 
/*Output*/
<img src="image.png">

href

Type: string
Default: undefined
Description: set tag for replacement of tags with "href" (except a, area, base, link)
Example:

var fs = require(fs),
   postxml = require(postxml),
   plugin = require(postxml-custom-tags);
 
var html = fs.readFileSync(input.html, utf8);
 
var output = postxml(
      html,
      [
         plugin({
             href: 'a'
         })
      ]
   );
/*Input*/
<div href="#"></div>
 
/*Output*/
<a href="#"></a>

Licence

MIT

Package Sidebar

Install

npm i postxml-custom-tags

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • yepninja