Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
clean-html
Advanced tools
Do you have crappy HTML? I do!
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="31"><b>Currently we have these articles available:</b>
<blockquote>
<!-- List articles -->
<p><a href="foo.html">The History of Foo</a><br />
An <span color="red">informative</span> piece of <FONT FACE="ARIAL">information</FONT>.</p>
<p><a href="bar.html">A Horse Walked Into a Bar</a><br/> The bartender said
"Why the long face?"</p>
</blockquote>
</td>
</tr>
</table>
Just look at those blank lines and random line breaks, trailing spaces, mixed tabs, deprecated tags - it's outrageous!
Let's clean it up...
$ npm install clean-html
var cleaner = require('clean-html'),
fs = require('fs'),
file = process.argv[2];
fs.readFile(file, 'utf-8', function (err, data) {
cleaner.clean(data, function (html) {
console.log(html);
});
});
Sanity restored!
<table>
<tr>
<td>
<b>Currently we have these articles available:</b>
<blockquote>
<!-- List articles -->
<p>
<a href="foo.html">The History of Foo</a><br>
An <span>informative</span> piece of information.
</p>
<p>
<a href="bar.html">A Horse Walked Into a Bar</a><br>
The bartender said "Why the long face?"
</p>
</blockquote>
</td>
</tr>
</table>
Attributes to remove from markup.
Type: Array
Default: ['align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'color', 'disabled', 'height', 'target', 'valign', 'width']
Block level element tags. Line breaks are added before and after, and nested content is indented.
Type: Array
Default: ['blockquote', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'p', 'table', 'td', 'tr']
Adds line breaks before and after comments.
Type: Boolean
Default: true
Adds line breaks after br tags.
Type: Boolean
Default: true
Empty element tags.
Type: Array
Default: ['br', 'hr', 'img']
The string to use for indentation. e.g., a tab character or one or more spaces.
Type: String
Default: ' '
(two spaces)
Removes comments.
Type: Boolean
Default: false
Removes empty paragraph tags.
Type: Boolean
Default: false
Tags to remove from markup.
Type: Array
Default: ['center', 'font']
These options are added for your convenience.
Additional attributes to remove from markup.
Type: Array
Default: null
Additional block level element tags.
Type: Array
Default: null
Additional empty element tags.
Type: Array
Default: null
Additional tags to remove from markup.
Type: Array
Default: null
FAQs
HTML cleaner and beautifier
The npm package clean-html receives a total of 2,146 weekly downloads. As such, clean-html popularity was classified as popular.
We found that clean-html 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.