crossnote 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/cjs/index.cjs CHANGED
@@ -109,7 +109,7 @@ ${new Date().toString()}
109
109
 
110
110
  ---
111
111
 
112
- `+B,Rd.writeFileSync(x,B,{encoding:"utf-8"})}function Z3(p){return new Promise((b,x)=>{let T={Authorization:`Client-ID ${X3}`};rA.post({url:`${K3}image`,encoding:"utf8",formData:{image:Rd.createReadStream(p)},json:!0,headers:T},(O,B,$)=>{if(O)return x(O);if($.success){let F=$.data.link;return xD(p,F),b(F)}else return b($.data.error.message)})})}function J3(p){return new Promise((b,x)=>{let T={authority:"sm.ms","user-agent":"crossnote",referer:""};rA.post({url:"https://sm.ms/api/v2/upload",formData:{smfile:Rd.createReadStream(p)},headers:T},(O,B,$)=>{try{if($=JSON.parse($),O)return x("Failed to upload image");if($.code==="error")return x($.msg);{let F=$.data.url;return xD(p,F),b(F)}}catch{return x("Failed to connect to sm.ms host")}})})}function Q3(p,b,x,T,O){return new Promise((B,$)=>{if(!b)return $("Error: Qiniu AccessKey is missing");if(!x)return $("Error: Qiniu SecretKey is missing");if(!T)return $("Error: Qiniu Bucket is missing");if(!O)return $("Error: Qiniu Domain is missing");import("qiniu").then(F=>{let j=new F.auth.digest.Mac(b,x),V=new F.rs.PutPolicy({scope:T}).uploadToken(j),te=new F.conf.Config,ae=kD.basename(p),he=new F.form_up.FormUploader(te),Q=new F.form_up.PutExtra;return he.putFile(V,ae,p,Q,(ie,se,fe)=>{if(ie)return $(ie.message);if(fe.statusCode===200){let Te=new F.rs.BucketManager(j,te).publicDownloadUrl(O,ae);return B(Te)}else return $(fe.error)})}).catch(F=>$(F))})}function iA(p,{method:b="imgur",qiniu:x={AccessKey:"",SecretKey:"",Bucket:"",Domain:""}}){return b==="imgur"?Z3(p):b==="qiniu"?Q3(p,x.AccessKey,x.SecretKey,x.Bucket,x.Domain):J3(p)}"structuredClone"in globalThis||(globalThis.structuredClone=SD.default);Mw.track();function Xo(p){return new Promise((b,x)=>{Mw.open(p,(T,O)=>T?x(T.toString()):b(O))})}function Nd(p){if(process.platform==="win32")return p.match(/^[a-zA-Z]:\\/)&&(p="file:///"+p),p.startsWith("file:///")?lh.execFile("explorer.exe",[p]):lh.exec(`start ${p}`);process.platform==="darwin"?lh.execFile("open",[p]):lh.execFile("xdg-open",[p])}function Lw(p=""){p.startsWith("---")&&(p=p.trim().replace(/^---\r?\n/,"").replace(/\r?\n---$/,""));try{return CD.parse(p)}catch(b){return{error:b.toString()}}}var RD=(()=>typeof __dirname<"u"?AD.resolve(__dirname,"../"):"")();function ND(p){RD=p}function _t(){return RD}var oA=null;function ID(p){oA=p}function kn(p,b){return oA&&b?oA(p,b):(p.startsWith("file://")||(p="file:///"+p),p=p.replace(/^file:\/+/,"file:///"),p)}function Fs(p){let b=/^(?:(?:file|(vscode)-(?:webview-)?resource|vscode--resource):\/+)(.*)/m;return p.replace(b,(x,T,O)=>(T&&(O=O.replace(/^file\/+/,"")),process.platform!=="win32"&&!O.startsWith("/")?"/"+O:O))}function OD(p){let b=globalThis.eval;try{return globalThis.eval=x=>uh.runInThisContext(x),p()}finally{globalThis.eval=b}}function DD(p){let b=globalThis.Function;try{return globalThis.Function=sA,p()}finally{globalThis.Function=b}}async function MD(p){let b=globalThis.Function,x=globalThis.eval;try{return globalThis.Function=sA,globalThis.eval=T=>uh.runInThisContext(T),await p()}finally{globalThis.eval=x,globalThis.Function=b}}var r0=p=>p.attributes.cmd===!0?p.language:p.attributes.cmd;function sA(...p){let b="",x=[];if(p.length){b=p[p.length-1];for(let O=0;O<p.length-1;O++)x.push(p[O])}let T=[];for(let O=0,B=x.length;O<B;O++){let $=x[O];typeof $=="string"&&($=$.split(/\s*,\s*/)),T.push.apply(T,$)}return uh.runInThisContext(`
112
+ `+B,Rd.writeFileSync(x,B,{encoding:"utf-8"})}function Z3(p){return new Promise((b,x)=>{let T={Authorization:`Client-ID ${X3}`};rA.post({url:`${K3}image`,encoding:"utf8",formData:{image:Rd.createReadStream(p)},json:!0,headers:T},(O,B,$)=>{if(O)return x(O);if($.success){let F=$.data.link;return xD(p,F),b(F)}else return b($.data.error.message)})})}function J3(p){return new Promise((b,x)=>{let T={authority:"sm.ms","user-agent":"crossnote",referer:""};rA.post({url:"https://sm.ms/api/v2/upload",formData:{smfile:Rd.createReadStream(p)},headers:T},(O,B,$)=>{try{if($=JSON.parse($),O)return x("Failed to upload image");if($.code==="error")return x($.msg);{let F=$.data.url;return xD(p,F),b(F)}}catch{return x("Failed to connect to sm.ms host")}})})}function Q3(p,b,x,T,O){return new Promise((B,$)=>{if(!b)return $("Error: Qiniu AccessKey is missing");if(!x)return $("Error: Qiniu SecretKey is missing");if(!T)return $("Error: Qiniu Bucket is missing");if(!O)return $("Error: Qiniu Domain is missing");import("qiniu").then(F=>{let j=new F.auth.digest.Mac(b,x),V=new F.rs.PutPolicy({scope:T}).uploadToken(j),te=new F.conf.Config,ae=kD.basename(p),he=new F.form_up.FormUploader(te),Q=new F.form_up.PutExtra;return he.putFile(V,ae,p,Q,(ie,se,fe)=>{if(ie)return $(ie.message);if(fe.statusCode===200){let Te=new F.rs.BucketManager(j,te).publicDownloadUrl(O,ae);return B(Te)}else return $(fe.error)})}).catch(F=>$(F))})}function iA(p,{method:b="imgur",qiniu:x={AccessKey:"",SecretKey:"",Bucket:"",Domain:""}}){return b==="imgur"?Z3(p):b==="qiniu"?Q3(p,x.AccessKey,x.SecretKey,x.Bucket,x.Domain):J3(p)}"structuredClone"in globalThis||(globalThis.structuredClone=SD.default);Mw.track();function Xo(p){return new Promise((b,x)=>{Mw.open(p,(T,O)=>T?x(T.toString()):b(O))})}function Nd(p){if(process.platform==="win32")return p.match(/^[a-zA-Z]:\\/)&&(p="file:///"+p),p.startsWith("file:///")?lh.execFile("explorer.exe",[p]):lh.exec(`start ${p}`);process.platform==="darwin"?lh.execFile("open",[p]):lh.execFile("xdg-open",[p])}function Lw(p=""){p.startsWith("---")&&(p=p.trim().replace(/^---\r?\n/,"").replace(/\r?\n---$/,""));try{return CD.parse(p)}catch(b){return{error:b.toString()}}}var RD=typeof __dirname<"u"?AD.resolve(__dirname,"../"):"";function ND(p){RD=p}function _t(){return RD}var oA=null;function ID(p){oA=p}function kn(p,b){return oA&&b?oA(p,b):(p.startsWith("file://")||(p="file:///"+p),p=p.replace(/^file:\/+/,"file:///"),p)}function Fs(p){let b=/^(?:(?:file|(vscode)-(?:webview-)?resource|vscode--resource):\/+)(.*)/m;return p.replace(b,(x,T,O)=>(T&&(O=O.replace(/^file\/+/,"")),process.platform!=="win32"&&!O.startsWith("/")?"/"+O:O))}function OD(p){let b=globalThis.eval;try{return globalThis.eval=x=>uh.runInThisContext(x),p()}finally{globalThis.eval=b}}function DD(p){let b=globalThis.Function;try{return globalThis.Function=sA,p()}finally{globalThis.Function=b}}async function MD(p){let b=globalThis.Function,x=globalThis.eval;try{return globalThis.Function=sA,globalThis.eval=T=>uh.runInThisContext(T),await p()}finally{globalThis.eval=x,globalThis.Function=b}}var r0=p=>p.attributes.cmd===!0?p.language:p.attributes.cmd;function sA(...p){let b="",x=[];if(p.length){b=p[p.length-1];for(let O=0;O<p.length-1;O++)x.push(p[O])}let T=[];for(let O=0,B=x.length;O<B;O++){let $=x[O];typeof $=="string"&&($=$.split(/\s*,\s*/)),T.push.apply(T,$)}return uh.runInThisContext(`
113
113
  (function(${T.join(", ")}) {
114
114
  ${b}
115
115
  })
@@ -122,7 +122,7 @@ ${new Date().toString()}
122
122
  ${W(V,fe)}
123
123
  </div>
124
124
  </details>
125
- `:Q+=`<div class="md-toc-link-wrapper" style="${Te};display:list-item;list-style:square;margin-left:${se.level===F?18:24+18}px">
125
+ `:Q+=`<div class="md-toc-link-wrapper" style="${Te};display:list-item;list-style:square;margin-left:${se.level===F?18:42}px">
126
126
  <a
127
127
  href="#${Pe}"
128
128
  class="md-toc-link"
@@ -150,7 +150,7 @@ ${O}`}var fA=null;function uz(p){return new Promise((b,x)=>{if(!p.match(/^https?
150
150
  `;continue}else{be=Ke,Ae=Ae+Lt,_e=_e+(F?`<p${$e()?` data-source-line="${Ae-Lt+1}"`:""}><span>[CROSSNOTESLIDE]</span></p> `:"<span>[CROSSNOTESLIDE]</span> ")+`
151
151
  `.repeat(Lt);continue}}else{let Jt=p.slice(be+4,Ke-3).match(/\n/g),Lt=Jt?Jt.length:0;be=Ke,Ae=Ae+Lt,_e=_e+`
152
152
  `.repeat(Lt);continue}}else{let Et=p.slice(be+4,Ke-3).match(/\n/g),Jt=Et?Et.length:0;be=Ke,Ae=Ae+Jt,_e=_e+`
153
- `.repeat(Jt);continue}}else if(pn=Me.match(/^(#{1,7}).*/)){let Ke=Me.replace(pn[1],"").trim(),et=pn[1],Zt=et.length,Et=Ke.match(/{[^{]+\}\s*$/),Jt="",Lt="",Ct=!1,ht={};if(Et){Ke=Ke.replace(Et[0],"").trim();try{ht=Yr(Et[0]),Jt=ht.class??"",Lt=ht.id??"",Ct=ht.ignore,delete ht.class,delete ht.id,delete ht.ignore}catch{Ke="OptionsError: "+Et[1],Ct=!0}}if(Lt||(Lt=te.generateId(Ke),ae.config.usePandocParser&&(Lt=Lt.replace(/^[\d-]+/,""),Lt||(Lt="section"))),Ct||Ie.push({content:Ke,level:Zt,id:Lt,lineNo:Ae+1}),$){be=yt+1,Ae=Ae+1,_e=_e+Me+`
153
+ `.repeat(Jt);continue}}else if(pn=Me.match(/^(#{1,7})\s.*/)){let Ke=Me.replace(pn[1],"").trim(),et=pn[1],Zt=et.length,Et=Ke.match(/{[^{]+\}\s*$/),Jt="",Lt="",Ct=!1,ht={};if(Et){Ke=Ke.replace(Et[0],"").trim();try{ht=Yr(Et[0]),Jt=ht.class??"",Lt=ht.id??"",Ct=ht.ignore,delete ht.class,delete ht.id,delete ht.ignore}catch{Ke="OptionsError: "+Et[1],Ct=!0}}if(Lt||(Lt=te.generateId(Ke),ae.config.usePandocParser&&(Lt=Lt.replace(/^[\d-]+/,""),Lt||(Lt="section"))),Ct||Ie.push({content:Ke,level:Zt,id:Lt,lineNo:Ae+1}),$){be=yt+1,Ae=Ae+1,_e=_e+Me+`
154
154
  `;continue}else{let Ne="{";if(Lt&&(Ne+=`#${Lt} `),Jt&&(Ne+="."+Jt.replace(/\s+/g," .")+" "),ht)for(let Xe in ht)typeof ht[Xe]=="number"?Ne+=" "+Xe+"="+ht[Xe]:Ne+=" "+Xe+'="'+ht[Xe]+'"';$e()&&(Ne+=` data-source-line="${Ae+1}"`),Ne+="}",Ne==="{}"&&(Ne=""),be=yt+1,Ae=Ae+1,_e=_e+`${et} ${Ke} ${Ne}
155
155
  `;continue}}else if(Me.match(/^\s*\[toc\]\s*$/i)){Pe=!0,be=yt+1,Ae=Ae+1,_e=_e+(F?`<p${$e()?` data-source-line="${Ae}"`:""}><span>[CROSSNOTETOC]</span></p>
156
156
  `:`<span>[CROSSNOTETOC]</span>
@@ -436,7 +436,7 @@ window["initRevealPresentation"] = async function() {
436
436
  window.MathJax = (${JSON.stringify(Ae)});
437
437
  </script>
438
438
  <script type="text/javascript" async src="${this.notebook.config.mathjaxV3ScriptSrc}"></script>
439
- `}else this.notebook.config.mathRenderingOption==="KaTeX"?T.offline?$=`<link rel="stylesheet" href="file:///${qe.resolve(_t(),"./dependencies/katex/katex.min.css")}">`:$=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.9/dist/katex.min.css">`:$="";let F="";b.indexOf('<i class="fa')>=0&&(T.offline?F=`<link rel="stylesheet" href="file:///${qe.resolve(_t(),"./dependencies/font-awesome/css/all.min.css")}">`:F=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css">`);let j="",W="";b.indexOf(' class="mermaid')>=0&&(T.offline?j=`<script type="text/javascript" src="file:///${qe.resolve(_t(),"./dependencies/mermaid/mermaid.min.js")}" charset="UTF-8"></script>`:j=`<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@10.6.0/dist/mermaid.min.js"></script>`,W+=`<script type="module">
439
+ `}else this.notebook.config.mathRenderingOption==="KaTeX"?T.offline?$=`<link rel="stylesheet" href="file:///${qe.resolve(_t(),"./dependencies/katex/katex.min.css")}">`:$=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.9/dist/katex.min.css">`:$="";let F="";b.indexOf('<i class="fa')>=0&&(T.offline?F=`<link rel="stylesheet" href="file:///${qe.resolve(_t(),"./dependencies/font-awesome/css/all.min.css")}">`:F=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css">`);let j="",W="";b.indexOf(' class="mermaid')>=0&&(T.offline?j=`<script type="text/javascript" src="file:///${qe.resolve(_t(),"./dependencies/mermaid/mermaid.min.js")}" charset="UTF-8"></script>`:j=`<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@10.9.0/dist/mermaid.min.js"></script>`,W+=`<script type="module">
440
440
  // TODO: If ZenUML gets integrated into mermaid in the future,
441
441
  // we can remove the following lines.
442
442
  ${b.match(/zenuml/i)?`import zenuml from 'https://${this.notebook.config.jsdelivrCdnHost}/npm/@mermaid-js/mermaid-zenuml@0.1.0/dist/mermaid-zenuml.esm.min.mjs';
@@ -7,7 +7,7 @@ I managed some of the libraries by myself instead of through npm to reduce the o
7
7
  "font-awesome": "6.4.2", // Download from here: https://fontawesome.com/download
8
8
  // Fontawesome cheatsheet is available here: https://kapeli.com/cheat_sheets/Font_Awesome.docset/Contents/Resources/Documents/index
9
9
  "katex": "v0.16.9", // Only keep the css and fonts files.
10
- "mermaid": "10.6.0", // https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
10
+ "mermaid": "10.9.0", // https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
11
11
  "reveal": "4.6.0",
12
12
 
13
13
  // NOTE: Don't forget to update `dependentLibraryMaterials` in `markdown-engine/index.ts`