PostXML plugin anable using custom tags in html. It replace them with div elements.
npm i postxml-custom-tags --save-dev
var fs = require(fs),
postxml = require(postxml),
plugin = require(postxml-custom-tags);
var html = fs.readFileSync(input.html, utf8);
var output = postxml(
html,
[
plugin()
]
);<custom class="b-block" ng-click="init = 2">Text</custom><div class="b-block" ng-click="init = 2">Text</div>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">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>MIT