Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-md

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-md - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

6

CHANGES.md
# Change Log
## 2012.12.11, Version 2.2.0
## 2012.12.12, Version 2.0.1
* [#8](https://github.com/neocotic/html.md/issues/8): Fix incorrect version
## 2012.12.11, Version 2.0.0
* [#1](https://github.com/neocotic/html.md/issues/1): Check inline style attribute to see if elements are hidden

@@ -6,0 +10,0 @@ * [#2](https://github.com/neocotic/html.md/issues/2): Add command line interface

4

dist/md.min.js

@@ -1,2 +0,2 @@

// [html.md](http://neocotic.com/html.md) 2.0.0
// [html.md](http://neocotic.com/html.md) 2.0.1
// (c) 2012 Alasdair Mercer

@@ -9,2 +9,2 @@ // Freely distributable under the MIT license.

// <http://neocotic.com/html.md>
(function(){var t,e,i,s,n,o,r,h,a,u,p,l,c,d,f,E,N,g,y,m,L={}.hasOwnProperty,T=this;t={absolute:!1,debug:!1},s=this.md,o={"\\\\":"\\\\","\\[":"\\[","\\]":"\\]",">":"\\>",_:"\\_","\\*":"\\*","`":"\\`","#":"\\#","([0-9])\\.(\\s|$)":"$1\\.$2","©":"(c)","®":"(r)","™":"(tm)"," ":" ","·":"\\*"," ":" "," ":" "," ":" ","‘":"'","’":"'","“":'"',"”":'"',"…":"...","–":"--","—":"---"},r=/(display|visibility)\s*:\s*[a-z]+/gi,h=/(none|hidden)\s*$/i,a=/^(APPLET|AREA|AUDIO|BUTTON|CANVAS|COMMAND|DATALIST|EMBED|HEAD|INPUT|KEYGEN|MAP|MENU|METER|NOFRAMES|NOSCRIPT|OBJECT|OPTGROUP|OPTION|PARAM|PROGRESS|RP|RT|RUBY|SCRIPT|SELECT|SOURCE|STYLE|TEXTAREA|TITLE|TRACK|VIDEO)$/,u=/^(ADDRESS|ARTICLE|ASIDE|DIV|FIELDSET|FOOTER|HEADER|NAV|P|SECTION)$/,n=function(){f={};for(c in o)L.call(o,c)&&(E=o[c],f[c]=RegExp(c,"g"));return f}(),N="undefined"!=typeof window&&null!==window?window:null,("undefined"==typeof window||null===window)&&(l=require("jsdom"),p=l.jsdom(null,null,{features:{FetchExternalResources:!1}}),N=p.createWindow()),i=null!=(g=N.Node)?g:{},null==(y=i.ELEMENT_NODE)&&(i.ELEMENT_NODE=1),null==(m=i.TEXT_NODE)&&(i.TEXT_NODE=3),e=function(){function e(e,i){var s;this.html=null!=e?e:"",this.options=null!=i?i:{},this.atLeft=this.atNoWS=this.atP=!0,this.buffer="",this.exceptions=[],this.inCode=this.inPre=this.inOrderedList=this.parsed=!1,this.last=null,this.left="\n",this.links=[],this.linkMap={},this.unhandled={},"object"!=typeof this.options&&(this.options={});for(c in t)L.call(t,c)&&(s=t[c],this.options.hasOwnProperty(c)||(this.options[c]=s))}return e.prototype.append=function(t){return null!=this.last&&(this.buffer+=this.last),this.last=t},e.prototype.attr=function(t,e,i){return null==i&&(i=!0),i?t[e]:"function"==typeof t.getAttribute?t.getAttribute(e):void 0},e.prototype.br=function(){return this.append(" "+this.left),this.atLeft=this.atNoWS=!0},e.prototype.code=function(){var t,e=this;return t=this.inCode,this.inCode=!0,function(){return e.inCode=t}},e.prototype.inCodeProcess=function(t){return t.replace(/`/g,"\\`")},e.prototype.isVisible=function(t){var e,i,s,n,o,a,u,p;if(n=this.attr(t,"style",!1),i=null!=n?n.match(r):void 0,a=!0,null!=i)for(u=0,p=i.length;p>u;u++)s=i[u],a=!h.test(s);if(a&&null!=N.getComputedStyle)try{n=N.getComputedStyle(t,null),"function"==typeof(null!=n?n.getPropertyValue:void 0)&&(e=n.getPropertyValue("display"),o=n.getPropertyValue("visibility"),a="none"!==e&&"hidden"!==o)}catch(l){this.thrown(l,"getComputedStyle")}return a},e.prototype.nonPreProcess=function(t){t=t.replace(/\n([ \t]*\n)+/g,"\n"),t=t.replace(/\n[ \t]+/g,"\n"),t=t.replace(/[ \t]+/g," ");for(c in o)L.call(o,c)&&(E=o[c],t=t.replace(n[c],E));return t},e.prototype.ol=function(){var t,e=this;return t=this.inOrderedList,this.inOrderedList=!0,function(){return e.inOrderedList=t}},e.prototype.output=function(t){return t&&(this.inPre||(t=this.atNoWS?t.replace(/^[ \t\n]+/,""):/^[ \t]*\n/.test(t)?t.replace(/^[ \t\n]+/,"\n"):t.replace(/^[ \t]+/," ")),""!==t)?(this.atP=/\n\n$/.test(t),this.atLeft=/\n$/.test(t),this.atNoWS=/[ \t\n]$/.test(t),this.append(t.replace(/\n/g,this.left))):void 0},e.prototype.outputLater=function(t){var e=this;return function(){return e.output(t)}},e.prototype.p=function(){return this.atP?void 0:(this.atLeft||(this.append(this.left),this.atLeft=!0),this.append(this.left),this.atNoWS=this.atP=!0)},e.prototype.parse=function(){var t,e,i,s,n,o,r,h;if(!this.html)return"";if(this.parsed)return this.buffer;if(t=N.document.createElement("div"),"string"==typeof this.html?t.innerHTML=this.html:t.appendChild(this.html),this.process(t),this.links.length)for(this.append("\n\n"),h=this.links,e=o=0,r=h.length;r>o;e=++o)i=h[e],i&&this.append("["+e+"]: "+i+"\n");return this.options.debug&&(n=function(){var t,e;t=this.unhandled,e=[];for(s in t)L.call(t,s)&&e.push(s);return e}.call(this).sort(),n.length?console.log("Ignored tags;\n"+n.join(", ")):console.log("No tags were ignored"),this.exceptions.length?console.log("Exceptions;\n"+this.exceptions.join("\n")):console.log("No exceptions were thrown")),this.append(""),this.parsed=!0,this.buffer=this.buffer.trim()},e.prototype.pre=function(){var t,e=this;return t=this.inPre,this.inPre=!0,function(){return e.inPre=t}},e.prototype.process=function(t){var e,s,n,o,r,h,p,l,c,d,f,E,N,g,y,m;if(this.isVisible(t)){if(t.nodeType===i.ELEMENT_NODE){c=!1;try{if(a.test(t.tagName))c=!0;else if(/^H[1-6]$/.test(t.tagName))l=parseInt(t.tagName.match(/([1-6])$/)[1]),this.p(),this.output(""+function(){var t,e;for(e=[],h=t=1;l>=1?l>=t:t>=l;h=l>=1?++t:--t)e.push("#");return e}().join("")+" ");else if(u.test(t.tagName))this.p();else switch(t.tagName){case"BODY":case"FORM":break;case"DETAILS":this.p(),this.attr(t,"open",!1)||(c=!0,f=t.getElementsByTagName("summary")[0],f&&this.process(f));break;case"BR":this.br();break;case"HR":this.p(),this.output("---"),this.p();break;case"CITE":case"DFN":case"EM":case"I":case"U":case"VAR":this.output("_"),this.atNoWS=!0,e=this.outputLater("_");break;case"DT":case"B":case"STRONG":"DT"===t.tagName&&this.p(),this.output("**"),this.atNoWS=!0,e=this.outputLater("**");break;case"Q":this.output('"'),this.atNoWS=!0,e=this.outputLater('"');break;case"OL":case"PRE":case"UL":s=this.pushLeft(" "),n=function(){switch(t.tagName){case"OL":return this.ol();case"PRE":return this.pre();case"UL":return this.ul()}}.call(this),e=function(){return s(),n()};break;case"LI":this.replaceLeft(this.inOrderedList?"1. ":"* ");break;case"CODE":case"KBD":case"SAMP":this.inPre||(this.output("`"),s=this.code(),n=this.outputLater("`"),e=function(){return s(),n()});break;case"BLOCKQUOTE":case"DD":e=this.pushLeft("> ");break;case"A":if(r=this.attr(t,"href",this.options.absolute),!r)break;E=this.attr(t,"title"),E&&(r+=' "'+E+'"'),null!=this.linkMap[r]?p=this.linkMap[r]:(p=this.links.push(r)-1,this.linkMap[r]=p),this.output("["),this.atNoWS=!0,e=this.outputLater("]["+p+"]");break;case"IMG":if(c=!0,d=this.attr(t,"src",this.options.absolute),!d)break;this.output("!["+this.attr(t,"alt")+"]("+d+")");break;case"FRAME":case"IFRAME":c=!0;try{(null!=(y=t.contentDocument)?y.documentElement:void 0)&&this.process(t.contentDocument.documentElement)}catch(L){this.thrown(L,"contentDocument")}break;case"TR":e=this.p;break;default:this.options.debug&&(this.unhandled[t.tagName]=null)}}catch(L){this.thrown(L,t.tagName)}if(!c)for(m=t.childNodes,N=0,g=m.length;g>N;N++)o=m[N],this.process(o);return null!=e?e.call(this):void 0}return t.nodeType===i.TEXT_NODE?this.inPre?this.output(t.nodeValue):this.inCode?this.output(this.inCodeProcess(t.nodeValue)):this.output(this.nonPreProcess(t.nodeValue)):void 0}},e.prototype.pushLeft=function(t){var e,i=this;return e=this.left,this.left+=t,this.atP?this.append(t):this.p(),function(){return i.left=e,i.atLeft=i.atP=!1,i.p()}},e.prototype.replaceLeft=function(t){return this.atLeft?this.last?this.last=this.last.replace(/[ ]{4}$/,t):void 0:(this.append(this.left.replace(/[ ]{4}$/,t)),this.atLeft=this.atNoWS=this.atP=!0)},e.prototype.thrown=function(t,e){return this.options.debug?this.exceptions.push(""+e+": "+t):void 0},e.prototype.ul=function(){var t,e=this;return t=this.inOrderedList,this.inOrderedList=!1,function(){return e.inOrderedList=t}},e}(),this.md=d=function(t,i){return new e(t,i).parse()},("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=d:"function"==typeof define&&define.amd&&define("md",function(){return d}),d.VERSION="1.0.0",d.noConflict=function(){return T.md=s,d}}).call(this);
(function(){var t,e,i,s,n,o,r,h,a,u,p,l,c,d,f,E,N,g,y,m,L={}.hasOwnProperty,T=this;t={absolute:!1,debug:!1},s=this.md,o={"\\\\":"\\\\","\\[":"\\[","\\]":"\\]",">":"\\>",_:"\\_","\\*":"\\*","`":"\\`","#":"\\#","([0-9])\\.(\\s|$)":"$1\\.$2","©":"(c)","®":"(r)","™":"(tm)"," ":" ","·":"\\*"," ":" "," ":" "," ":" ","‘":"'","’":"'","“":'"',"”":'"',"…":"...","–":"--","—":"---"},r=/(display|visibility)\s*:\s*[a-z]+/gi,h=/(none|hidden)\s*$/i,a=/^(APPLET|AREA|AUDIO|BUTTON|CANVAS|COMMAND|DATALIST|EMBED|HEAD|INPUT|KEYGEN|MAP|MENU|METER|NOFRAMES|NOSCRIPT|OBJECT|OPTGROUP|OPTION|PARAM|PROGRESS|RP|RT|RUBY|SCRIPT|SELECT|SOURCE|STYLE|TEXTAREA|TITLE|TRACK|VIDEO)$/,u=/^(ADDRESS|ARTICLE|ASIDE|DIV|FIELDSET|FOOTER|HEADER|NAV|P|SECTION)$/,n=function(){f={};for(c in o)L.call(o,c)&&(E=o[c],f[c]=RegExp(c,"g"));return f}(),N="undefined"!=typeof window&&null!==window?window:null,("undefined"==typeof window||null===window)&&(l=require("jsdom"),p=l.jsdom(null,null,{features:{FetchExternalResources:!1}}),N=p.createWindow()),i=null!=(g=N.Node)?g:{},null==(y=i.ELEMENT_NODE)&&(i.ELEMENT_NODE=1),null==(m=i.TEXT_NODE)&&(i.TEXT_NODE=3),e=function(){function e(e,i){var s;this.html=null!=e?e:"",this.options=null!=i?i:{},this.atLeft=this.atNoWS=this.atP=!0,this.buffer="",this.exceptions=[],this.inCode=this.inPre=this.inOrderedList=this.parsed=!1,this.last=null,this.left="\n",this.links=[],this.linkMap={},this.unhandled={},"object"!=typeof this.options&&(this.options={});for(c in t)L.call(t,c)&&(s=t[c],this.options.hasOwnProperty(c)||(this.options[c]=s))}return e.prototype.append=function(t){return null!=this.last&&(this.buffer+=this.last),this.last=t},e.prototype.attr=function(t,e,i){return null==i&&(i=!0),i?t[e]:"function"==typeof t.getAttribute?t.getAttribute(e):void 0},e.prototype.br=function(){return this.append(" "+this.left),this.atLeft=this.atNoWS=!0},e.prototype.code=function(){var t,e=this;return t=this.inCode,this.inCode=!0,function(){return e.inCode=t}},e.prototype.inCodeProcess=function(t){return t.replace(/`/g,"\\`")},e.prototype.isVisible=function(t){var e,i,s,n,o,a,u,p;if(n=this.attr(t,"style",!1),i=null!=n?n.match(r):void 0,a=!0,null!=i)for(u=0,p=i.length;p>u;u++)s=i[u],a=!h.test(s);if(a&&null!=N.getComputedStyle)try{n=N.getComputedStyle(t,null),"function"==typeof(null!=n?n.getPropertyValue:void 0)&&(e=n.getPropertyValue("display"),o=n.getPropertyValue("visibility"),a="none"!==e&&"hidden"!==o)}catch(l){this.thrown(l,"getComputedStyle")}return a},e.prototype.nonPreProcess=function(t){t=t.replace(/\n([ \t]*\n)+/g,"\n"),t=t.replace(/\n[ \t]+/g,"\n"),t=t.replace(/[ \t]+/g," ");for(c in o)L.call(o,c)&&(E=o[c],t=t.replace(n[c],E));return t},e.prototype.ol=function(){var t,e=this;return t=this.inOrderedList,this.inOrderedList=!0,function(){return e.inOrderedList=t}},e.prototype.output=function(t){return t&&(this.inPre||(t=this.atNoWS?t.replace(/^[ \t\n]+/,""):/^[ \t]*\n/.test(t)?t.replace(/^[ \t\n]+/,"\n"):t.replace(/^[ \t]+/," ")),""!==t)?(this.atP=/\n\n$/.test(t),this.atLeft=/\n$/.test(t),this.atNoWS=/[ \t\n]$/.test(t),this.append(t.replace(/\n/g,this.left))):void 0},e.prototype.outputLater=function(t){var e=this;return function(){return e.output(t)}},e.prototype.p=function(){return this.atP?void 0:(this.atLeft||(this.append(this.left),this.atLeft=!0),this.append(this.left),this.atNoWS=this.atP=!0)},e.prototype.parse=function(){var t,e,i,s,n,o,r,h;if(!this.html)return"";if(this.parsed)return this.buffer;if(t=N.document.createElement("div"),"string"==typeof this.html?t.innerHTML=this.html:t.appendChild(this.html),this.process(t),this.links.length)for(this.append("\n\n"),h=this.links,e=o=0,r=h.length;r>o;e=++o)i=h[e],i&&this.append("["+e+"]: "+i+"\n");return this.options.debug&&(n=function(){var t,e;t=this.unhandled,e=[];for(s in t)L.call(t,s)&&e.push(s);return e}.call(this).sort(),n.length?console.log("Ignored tags;\n"+n.join(", ")):console.log("No tags were ignored"),this.exceptions.length?console.log("Exceptions;\n"+this.exceptions.join("\n")):console.log("No exceptions were thrown")),this.append(""),this.parsed=!0,this.buffer=this.buffer.trim()},e.prototype.pre=function(){var t,e=this;return t=this.inPre,this.inPre=!0,function(){return e.inPre=t}},e.prototype.process=function(t){var e,s,n,o,r,h,p,l,c,d,f,E,N,g,y,m;if(this.isVisible(t)){if(t.nodeType===i.ELEMENT_NODE){c=!1;try{if(a.test(t.tagName))c=!0;else if(/^H[1-6]$/.test(t.tagName))l=parseInt(t.tagName.match(/([1-6])$/)[1]),this.p(),this.output(""+function(){var t,e;for(e=[],h=t=1;l>=1?l>=t:t>=l;h=l>=1?++t:--t)e.push("#");return e}().join("")+" ");else if(u.test(t.tagName))this.p();else switch(t.tagName){case"BODY":case"FORM":break;case"DETAILS":this.p(),this.attr(t,"open",!1)||(c=!0,f=t.getElementsByTagName("summary")[0],f&&this.process(f));break;case"BR":this.br();break;case"HR":this.p(),this.output("---"),this.p();break;case"CITE":case"DFN":case"EM":case"I":case"U":case"VAR":this.output("_"),this.atNoWS=!0,e=this.outputLater("_");break;case"DT":case"B":case"STRONG":"DT"===t.tagName&&this.p(),this.output("**"),this.atNoWS=!0,e=this.outputLater("**");break;case"Q":this.output('"'),this.atNoWS=!0,e=this.outputLater('"');break;case"OL":case"PRE":case"UL":s=this.pushLeft(" "),n=function(){switch(t.tagName){case"OL":return this.ol();case"PRE":return this.pre();case"UL":return this.ul()}}.call(this),e=function(){return s(),n()};break;case"LI":this.replaceLeft(this.inOrderedList?"1. ":"* ");break;case"CODE":case"KBD":case"SAMP":this.inPre||(this.output("`"),s=this.code(),n=this.outputLater("`"),e=function(){return s(),n()});break;case"BLOCKQUOTE":case"DD":e=this.pushLeft("> ");break;case"A":if(r=this.attr(t,"href",this.options.absolute),!r)break;E=this.attr(t,"title"),E&&(r+=' "'+E+'"'),null!=this.linkMap[r]?p=this.linkMap[r]:(p=this.links.push(r)-1,this.linkMap[r]=p),this.output("["),this.atNoWS=!0,e=this.outputLater("]["+p+"]");break;case"IMG":if(c=!0,d=this.attr(t,"src",this.options.absolute),!d)break;this.output("!["+this.attr(t,"alt")+"]("+d+")");break;case"FRAME":case"IFRAME":c=!0;try{(null!=(y=t.contentDocument)?y.documentElement:void 0)&&this.process(t.contentDocument.documentElement)}catch(L){this.thrown(L,"contentDocument")}break;case"TR":e=this.p;break;default:this.options.debug&&(this.unhandled[t.tagName]=null)}}catch(L){this.thrown(L,t.tagName)}if(!c)for(m=t.childNodes,N=0,g=m.length;g>N;N++)o=m[N],this.process(o);return null!=e?e.call(this):void 0}return t.nodeType===i.TEXT_NODE?this.inPre?this.output(t.nodeValue):this.inCode?this.output(this.inCodeProcess(t.nodeValue)):this.output(this.nonPreProcess(t.nodeValue)):void 0}},e.prototype.pushLeft=function(t){var e,i=this;return e=this.left,this.left+=t,this.atP?this.append(t):this.p(),function(){return i.left=e,i.atLeft=i.atP=!1,i.p()}},e.prototype.replaceLeft=function(t){return this.atLeft?this.last?this.last=this.last.replace(/[ ]{4}$/,t):void 0:(this.append(this.left.replace(/[ ]{4}$/,t)),this.atLeft=this.atNoWS=this.atP=!0)},e.prototype.thrown=function(t,e){return this.options.debug?this.exceptions.push(""+e+": "+t):void 0},e.prototype.ul=function(){var t,e=this;return t=this.inOrderedList,this.inOrderedList=!1,function(){return e.inOrderedList=t}},e}(),this.md=d=function(t,i){return new e(t,i).parse()},("undefined"!=typeof module&&null!==module?module.exports:void 0)?module.exports=d:"function"==typeof define&&define.amd&&define("md",function(){return d}),d.VERSION="2.0.1",d.noConflict=function(){return T.md=s,d}}).call(this);

@@ -1,2 +0,2 @@

// [html.md](http://neocotic.com/html.md) 2.0.0
// [html.md](http://neocotic.com/html.md) 2.0.1
// (c) 2012 Alasdair Mercer

@@ -540,3 +540,3 @@ // Freely distributable under the MIT license.

md.VERSION = '1.0.0';
md.VERSION = '2.0.1';

@@ -543,0 +543,0 @@ md.noConflict = function() {

{
"name": "html-md"
, "description": "JavaScript library for converting HTML in to valid Markdown"
, "version": "2.0.0"
, "version": "2.0.1"
, "homepage": "http://neocotic.com/html.md"

@@ -6,0 +6,0 @@ , "bugs": {

Sorry, the diff of this file is not supported yet

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