
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
html-pipeline
Advanced tools
Pluggable HTML Pipeline
Forked from html-pipe and add some modifies.
$ npm i html-pipeline
<p>this is a <span style="font-size: 18pt">wonderful</span> example of our html <em>pipeline!</em></p>
var p = document.getElementsByTagName('p')[0];
var out = htmlpipeline()
.pipe(sanitize)
.pipe(highlight)
.run(p)
// unwrap spans with inline styles
function sanitize(el) {
if ('SPAN' == el.nodeName && el.getAttribute('style')) {
return false;
}
}
// turn em's into mark's
function highlight(el) {
if ('EM' == el.nodeName) {
var mark = document.createElement('mark');
mark.innerHTML = el.innerHTML;
return mark;
}
}
console.log(out.innerHTML);
// this is a wonderful example of our html <mark>pipeline!</mark>
Initialize the pipeline. If you run in node js env(global.document is not defined env), pass document by yourself.
Add a transform to the pipeline. The pipeline changes it's action
based on the return value of fn
. Here's a list of possible values:
undefined
: skip the transform and move to the next onenull
: remove the node from the transform. skip remaining transforms for the node.false
: unwrap the node, so it's contents are at the same level as the original node. skip remaining transforms on unwrapped node, moving on to the first child.node (self)
: returning the current node will skip over the rest of its children and skip the remaining transforms for the node.node
: replace the current node with a new node. pass the new node through the rest of the transformsstring
or number
: replace the current node with a textnode containing the string or number. pass the textnode through the rest of the transformsCheck out the tests to see each of these transforms in action.
Run the pipeline with el
, returning the transformed el
.
npm install component-test
make test
The MIT License (MIT)
Copyright (c) 2014
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
pluggable html transformer
The npm package html-pipeline receives a total of 3 weekly downloads. As such, html-pipeline popularity was classified as not popular.
We found that html-pipeline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.