Socket
Socket
Sign inDemoInstall

brightml

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brightml - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

41

index.js

@@ -224,3 +224,23 @@ var fs = require('fs');

// Process HTML
// Process an HTML string
Brightml.prototype.process = function(html) {
// Convert to DOM using cheerio
console.log('Parsing HTML...');
$ = cheerio.load(html);
// Cleanup elements
console.log('Cleaning up...');
this._cleanElements();
this._setAnchorIds();
this._moveLocalReferences();
// Cleanup tables
this._removeNestedTables();
this._formatTables();
this._cleanTableCells();
console.log('Done.');
return Q($.html());
};
// Process an HTML file
Brightml.prototype.render = function() {

@@ -233,20 +253,5 @@ var d = Q.defer();

console.log('Reading HTML file: '+that.filename);
Q.nfcall(fs.readFile, this.filename)
Q.nfcall(fs.readFile, that.filename)
.then(function(data) {
// Convert to DOM using cheerio
console.log('Parsing HTML...');
$ = cheerio.load(data);
// Cleanup elements
console.log('Cleaning up...');
that._cleanElements();
that._setAnchorIds();
that._moveLocalReferences();
// Cleanup tables
that._removeNestedTables();
that._formatTables();
that._cleanTableCells();
console.log('Done.');
return d.resolve($.html());
return d.resolve(that.process(data));
})

@@ -253,0 +258,0 @@ .fail(function(err) {

{
"name": "brightml",
"version": "1.0.0",
"version": "1.1.0",
"description": "Smart utility rendering markdown-ready HTML",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,2 +15,4 @@ # Brightml

It can be used to render from a file:
```JavaScript

@@ -26,2 +28,30 @@ var Brightml = require('brightml');

Or process an HTML string directly:
```JavaScript
var Brightml = require('brightml');
var converter = new Brightml();
var HTMLString = '<table><tr><td>Title 1</td><td>Title 2</td></tr><tr><td>Data 1</td><td>Data 2</td></tr></table>';
converter.process(HTMLString)
.then(function (cleanHTML) {
// cleanHTML is now
// <table>
// <thead>
// <tr>
// <th>Title 1</th>
// <th>Title 2</th>
// </tr>
// </thead>
// <tbody>
// <tr>
// <td>Data 1</td>
// <td>Data 2</td>
// </tr>
// </tbody>
// </table>
});
```
## What gets done

@@ -28,0 +58,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