SkillAgentSearch skills...

Html2jsonml

Convert HTML to JSONML

Install / Use

/learn @Maqentaer/Html2jsonml
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

#html2jsonml

Convert HTML to JSONML

##Usage

var jsonMl = html2jsonml( <string> html [, <object> options ] [, <func> callback(err, <array> jsonMl)]);

##Options for supporting not JSONML standards and others parser options:

var options = {
  // Add attributes object in any case (false by default):
  requireAttributes: false,
  // Children in separate array (false by default):
  childrenInArray: false,
  // Don't generate processing instructions (false by default):
  noProcessingInstructions: false,
  // HtmlParser2 (false by default):
  lowerCaseAttributeNames: false,
  // HtmlParser2 (false by default):
  lowerCaseTags: false,
  // HtmlParser2:Tokenizer (false by default):
  decodeEntities: false
}

##Examples

var html2jsonml = require('html2jsonml');
html2jsonml("<div id='first'>text</div>", function(err, jsonMl){
  if(err) throw err;
  else console.log(JSON.stringify(jsonMl));
});
var html2jsonml = require('html2jsonml');
var jsonMl = html2jsonml("<div id='first'>text</div>");
if(null === jsonMl) throw new Error("Invalid HTML");
else console.log(JSON.stringify(jsonMl));

##Installation

npm install html2jsonml

Contributors

  • Maqentaer

MIT Licenced

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated4y ago
Forks0

Languages

JavaScript

Security Score

70/100

Audited on Jan 12, 2022

No findings