1
0
wiki/.obsidian/plugins/obsidian-linter/main.js

2918 lines
1.5 MiB
JavaScript
Raw Normal View History

2023-11-09 17:30:33 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
2024-07-08 15:37:38 +08:00
var Bm=Object.create;var Wn=Object.defineProperty;var Dc=Object.getOwnPropertyDescriptor;var Fm=Object.getOwnPropertyNames;var _m=Object.getPrototypeOf,Rm=Object.prototype.hasOwnProperty;var un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kc=(e,t)=>{for(var i in t)Wn(e,i,{get:t[i],enumerable:!0})},Nc=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Fm(t))!Rm.call(e,r)&&r!==i&&Wn(e,r,{get:()=>t[r],enumerable:!(n=Dc(t,r))||n.enumerable});return e};var pn=(e,t,i)=>(i=e!=null?Bm(_m(e)):{},Nc(t||!e||!e.__esModule?Wn(i,"default",{value:e,enumerable:!0}):i,e)),Dm=e=>Nc(Wn({},"__esModule",{value:!0}),e),T=(e,t,i,n)=>{for(var r=n>1?void 0:n?Dc(t,i):t,a=e.length-1,s;a>=0;a--)(s=e[a])&&(r=(n?s(t,i,r):s(r))||r);return n&&r&&Wn(t,i,r),r};var Io=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};var Y=(e,t,i)=>(Io(e,t,"read from private field"),i?i.call(e):t.get(e)),ve=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Be=(e,t,i,n)=>(Io(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i);var Bo=(e,t,i,n)=>({set _(r){Be(e,t,r,i)},get _(){return Y(e,t,n)}}),he=(e,t,i)=>(Io(e,t,"access private method"),i);var Va=un((Cd,Ua)=>{(function(e,t){"use strict";typeof define=="function"&&define.amd?define(t):typeof Ua=="object"&&Ua.exports?Ua.exports=t():e.log=t()})(Cd,function(){"use strict";var e=function(){},t="undefined",i=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],r={},a=null;function s(h,x){var b=h[x];if(typeof b.bind=="function")return b.bind(h);try{return Function.prototype.bind.call(b,h)}catch{return function(){return Function.prototype.apply.apply(b,[h,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(h){return h==="debug"&&(h="log"),typeof console===t?!1:h==="trace"&&i?o:console[h]!==void 0?s(console,h):console.log!==void 0?s(console,"log"):e}function c(){for(var h=this.getLevel(),x=0;x<n.length;x++){var b=n[x];this[b]=x<h?e:this.methodFactory(b,h,this.name)}if(this.log=this.debug,typeof console===t&&h<this.levels.SILENT)return"No console available for logging"}function d(h){return function(){typeof console!==t&&(c.call(this),this[h].apply(this,arguments))}}function u(h,x,b){return l(h)||d.apply(this,arguments)}function g(h,x){var b=this,k,A,L,C="loglevel";typeof h=="string"?C+=":"+h:typeof h=="symbol"&&(C=void 0);function q(K){var U=(n[K]||"silent").toUpperCase();if(!(typeof window===t||!C)){try{window.localStorage[C]=U;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+U+";"}catch{}}}function z(){var K;if(!(typeof window===t||!C)){try{K=window.localStorage[C]}catch{}if(typeof K===t)try{var U=window.document.cookie,Q=encodeURIComponent(C),R=U.indexOf(Q+"=");R!==-1&&(K=/^([^;]+)/.exec(U.slice(R+Q.length+1))[1])}catch{}return b.levels[K]===void 0&&(K=void 0),K}}function F(){if(!(typeof window===t||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function N(K){var U=K;if(typeof U=="string"&&b.levels[U.toUpperCase()]!==void 0&&(U=b.levels[U.toUpperCase()]),typeof U=="number"&&U>=0&&U<=b.levels.SILENT)return U;throw new TypeError("log.setLevel() called with invalid level: "+K)}b.name=h,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=x||u,b.getLevel=function(){return L??A??k},b.setLevel=function(K,U){return L=N(K),U!==!1&&q(L),c.call(b)},b.setDefaultLevel=function(K){A=N(K),z()||b.setLevel(K,!1)},b.resetLevel=function(){L=null,F(),c.call(b)},b.enableAll=function(K){b.setLevel(b.levels.TRACE,K)},b.disableAll=function(K){b.setLevel(b.levels.SILENT,K)},b.rebuild=function(){if(a!==b&&(k=N(a.getLevel())),c.call(b),a===b)for(var K in r)r[K].rebuild()},k=N(a?a.getLevel():"WARN");var _=z();_!=null&&(L=N(_)),c.call(b)}a=new g,a.getLogger=f
`,d),u==-1&&(u=l.length-1);var m=l.substring(d,u+1);(n.hasOwnProperty?n.hasOwnProperty(m):n[m]!==void 0)?c+=String.fromCharCode(n[m]):(g==a&&(m=l.substring(d),u=l.length),c+=String.fromCharCode(g),n[m]=g,i[g++]=m),d=u+1}return c}var a=4e4,s=r(e);a=65535;var o=r(t);return{chars1:s,chars2:o,lineArray:i}};M.prototype.diff_charsToLines_=function(e,t){for(var i=0;i<e.length;i++){for(var n=e[i][1],r=[],a=0;a<n.length;a++)r[a]=t[n.charCodeAt(a)];e[i][1]=r.join("")}};M.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var i=0,n=Math.min(e.length,t.length),r=n,a=0;i<r;)e.substring(a,r)==t.substring(a,r)?(i=r,a=i):n=r,r=Math.floor((n-i)/2+i);return r};M.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var i=0,n=Math.min(e.length,t.length),r=n,a=0;i<r;)e.substring(e.length-r,e.length-a)==t.substring(t.length-r,t.length-a)?(i=r,a=i):n=r,r=Math.floor((n-i)/2+i);return r};M.prototype.diff_commonOverlap_=function(e,t){var i=e.length,n=t.length;if(i==0||n==0)return 0;i>n?e=e.substring(i-n):i<n&&(t=t.substring(0,i));var r=Math.min(i,n);if(e==t)return r;for(var a=0,s=1;;){var o=e.substring(r-s),l=t.indexOf(o);if(l==-1)return a;s+=l,(l==0||e.substring(r-s)==t.substring(0,s))&&(a=s,s++)}};M.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var i=e.length>t.length?e:t,n=e.length>t.length?t:e;if(i.length<4||n.length*2<i.length)return null;var r=this;function a(h,x,b){for(var k=h.substring(b,b+Math.floor(h.length/4)),A=-1,L="",C,q,z,F;(A=x.indexOf(k,A+1))!=-1;){var N=r.diff_commonPrefix(h.substring(b),x.substring(A)),_=r.diff_commonSuffix(h.substring(0,b),x.substring(0,A));L.length<_+N&&(L=x.substring(A-_,A)+x.substring(A,A+N),C=h.substring(0,b-_),q=h.substring(b+N),z=x.substring(0,A-_),F=x.substring(A+N))}return L.length*2>=h.length?[C,q,z,F,L]:null}var s=a(i,n,Math.ceil(i.length/4)),o=a(i,n,Math.ceil(i.length/2)),l;if(!s&&!o)return null;o?s?l=s[4].length>o[4].length?s:o:l=o:l=s;var c,d,u,g;e.length>t.length?(c=l[0],d=l[1],u=l[2],g=l[3]):(u=l[0],g=l[1],c=l[2],d=l[3]);var m=l[4];return[c,d,u,g,m]};M.prototype.diff_cleanupSemantic=function(e){for(var t=!1,i=[],n=0,r=null,a=0,s=0,o=0,l=0,c=0;a<e.length;)e[a][0]==Z?(i[n++]=a,s=l,o=c,l=0,c=0,r=e[a][1]):(e[a][0]==le?l+=e[a][1].length:c+=e[a][1].length,r&&r.length<=Math.max(s,o)&&r.length<=Math.max(l,c)&&(e.splice(i[n-1],0,new M.Diff(ae,r)),e[i[n-1]+1][0]=le,n--,n--,a=n>0?i[n-1]:-1,s=0,o=0,l=0,c=0,r=null,t=!0)),a++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),a=1;a<e.length;){if(e[a-1][0]==ae&&e[a][0]==le){var d=e[a-1][1],u=e[a][1],g=this.diff_commonOverlap_(d,u),m=this.diff_commonOverlap_(u,d);g>=m?(g>=d.length/2||g>=u.length/2)&&(e.splice(a,0,new M.Diff(Z,u.substring(0,g))),e[a-1][1]=d.substring(0,d.length-g),e[a+1][1]=u.substring(g),a++):(m>=d.length/2||m>=u.length/2)&&(e.splice(a,0,new M.Diff(Z,d.substring(0,m))),e[a-1][0]=le,e[a-1][1]=u.substring(0,u.length-m),e[a+1][0]=ae,e[a+1][1]=d.substring(m),a++),a++}a++}};M.prototype.diff_cleanupSemanticLossless=function(e){function t(m,h){if(!m||!h)return 6;var x=m.charAt(m.length-1),b=h.charAt(0),k=x.match(M.nonAlphaNumericRegex_),A=b.match(M.nonAlphaNumericRegex_),L=k&&x.match(M.whitespaceRegex_),C=A&&b.match(M.whitespaceRegex_),q=L&&x.match(M.linebreakRegex_),z=C&&b.match(M.linebreakRegex_),F=q&&m.match(M.blanklineEndRegex_),N=z&&h.match(M.blanklineStartRegex_);return F||N?5:q||z?4:k&&!L&&C?3:L||C?2:k||A?1:0}for(var i=1;i<e.length-1;){if(e[i-1][0]==Z&&e[i+1][0]==Z){var n=e[i-1][1],r=e[i][1],a=e[i+1][1],s=this.diff_commonSuffix(n,r);if(s){var o=r.substring(r.length-s);n=n.substring(0,n.length-s),r=o+r.substring(0,r.length-s),a=o+a}for(var l=n,c=r,d=a,u=t(n,r)+t(r,a);r.charAt(0)===a.charAt(0);){n+=r.charAt(0),r=r.substring(1)+a.charAt(0),a=a.substring(1);var g=t(n,r)+t(r,a);g>=u&&(u=g,l=n,c=r,d=a)}e[i-1][1]!=l&&(l?e[i-1][1]=l:(e.splice(i-1,1),i--),e[i][1]=c,d?e[i+1][1]=d:(e.splice(i+1,1),i--))}i++}};M.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;M.whitespaceRegex_=/\s/;M.linebreakRegex_=/[\r\n]/;M.blanklineEnd
2024-06-12 15:46:38 +08:00
`),n=0,r=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;n<i.length;){var a=i[n].match(r);if(!a)throw new Error("Invalid patch string: "+i[n]);var s=new M.patch_obj;for(t.push(s),s.start1=parseInt(a[1],10),a[2]===""?(s.start1--,s.length1=1):a[2]=="0"?s.length1=0:(s.start1--,s.length1=parseInt(a[2],10)),s.start2=parseInt(a[3],10),a[4]===""?(s.start2--,s.length2=1):a[4]=="0"?s.length2=0:(s.start2--,s.length2=parseInt(a[4],10)),n++;n<i.length;){var o=i[n].charAt(0);try{var l=decodeURI(i[n].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+l)}if(o=="-")s.diffs.push(new M.Diff(ae,l));else if(o=="+")s.diffs.push(new M.Diff(le,l));else if(o==" ")s.diffs.push(new M.Diff(Z,l));else{if(o=="@")break;if(o!=="")throw new Error('Invalid patch mode "'+o+'" in: '+l)}n++}}return t};M.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0};M.patch_obj.prototype.toString=function(){var e,t;this.length1===0?e=this.start1+",0":this.length1==1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2==1?t=this.start2+1:t=this.start2+1+","+this.length2;for(var i=["@@ -"+e+" +"+t+` @@
`],n,r=0;r<this.diffs.length;r++){switch(this.diffs[r][0]){case le:n="+";break;case ae:n="-";break;case Z:n=" ";break}i[r+1]=n+encodeURI(this.diffs[r][1])+`
2024-07-08 15:37:38 +08:00
`}return i.join("").replace(/%20/g," ")};On.exports=M;On.exports.diff_match_patch=M;On.exports.DIFF_DELETE=ae;On.exports.DIFF_INSERT=le;On.exports.DIFF_EQUAL=Z});var jp=un((A2,Yp)=>{Yp.exports=ew;var Qv=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Zv=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Jv=["Su","Mo","Tu","We","Th","Fr","Sa"],lo=["January","February","March","April","May","June","July","August","September","October","November","December"],Xv=["ACDT","ACST","ACWT","ADT","ACT","AEDT","AEST","AFT","AKDT","AKST","ALMT","AMT","AMST","ANAT","ANAST","AQTT","ART","AST","AWDT","AWST","AZOT","AZOST","AZT","AZST","BNT","BDT","BOT","BRT","BRST","BST","BTT","B","CAST","CAT","CCT","CDT","CEDT","CEST","CET","CHADT","CHAST","CHOT","CHOST","CHsT","CHUT","CIT","CKT","CLST","CLT","COT","CST","CVT","CWST","CXT","C","DAVT","DDUT","DST","EASST","EAST","EAT","ECT","EDT","EEDT","EEST","EET","EGT","EGST","EST","E","EIT","FET","FJT","FJST","FKST","FKT","FNT","F","GALT","GAMT","GET","GFT","GILT","GMT","GST","GYT","G","HADT","HAST","HKT","HOVT","HOVST","HST","ICT","IDT","IOT","IRDT","IRKT","IRKST","IRST","IST","JST","KGT","KOST","KRAT","KRAST","KST","KUYT","LHDT","LHST","LINT","L","MAGT","MAGST","MART","MAWT","MDT","MeST","MHT","MIST","MMT","MSD","MSK","MST","MUT","MVT","MYT","NCT","NDT","NFT","N","NOVT","NOVST","NPT","NRT","NST","NT","NUT","NZDT","NZST","OMST","OMSST","ORAT","O","PDT","PET","PETT","PETST","PGT","PHT","PHOT","PKT","PMDT","PMST","PONT","PST","PWT","PYT","PYST","P","QYZT","RET","ROTT","R","SAKT","SAMT","SAST","SBT","SCT","SGT","SRT","SLT","SLST","SRET","SST","SYOT","TAHT","TFT","TJT","TKT","TLT","TMT","TOT","TRUT","TVT","T","ULAT","ULAST","UTC","UYST","UYT","UZT","U","VET","VLAT","VLAST","VOLT","VUT","V","WAKT","WAT","WAST","WDT","WEDT","WEST","WET","WFT","WGT","WGST","WIB","WIT","WITA","WST","WT","YAKT","YAKST","YAP","YEK","YEKS"],co=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ex=new RegExp(Qv.join("|"),"i"),ix=new RegExp(Zv.join("|"),"i"),tx=new RegExp("\\b("+Jv.join("|")+")\\b","i"),nx=new RegExp(lo.join("|"),"i"),rx=new RegExp(co.join("|"),"i"),ax=new RegExp("\\b("+Xv.join("|")+")\\b","i"),sx=/(\d+)(st|nd|rd|th)\b/i,ox=/(\d{1,4})([/.-])(\d{1,2})[/.-](\d{1,4})/,lx=/((\+|-)(12:00|11:00|10:00|09:30|09:00|08:00|07:00|06:00|05:00|04:00|03:30|03:00|02:00|01:00|00:00|01:00|02:00|03:00|03:30|04:00|04:30|05:00|05:30|05:45|06:00|06:30|07:00|08:00|08:45|09:00|09:30|10:00|10:30|11:00|12:00|12:45|13:00|14:00))$/,cx=/((\+|-)(1200|1100|1000|0930|0900|0800|0700|0600|0500|0400|0330|0300|0200|0100|0000|0100|0200|0300|0330|0400|0430|0500|0530|0545|0600|0630|0700|0800|0845|0900|0930|1000|1030|1100|1200|1245|1300|1400))$/,In="("+["AM?","PM?"].join("|")+")",dx=new RegExp("0\\d\\:\\d{1,2}\\:\\d{1,2}(\\s*)"+In,"i"),ux=new RegExp("0\\d\\:\\d{1,2}(\\s*)"+In,"i"),px=new RegExp("0\\d(\\s*)"+In,"i"),mx=new RegExp("\\d{1,2}\\:\\d{1,2}\\:\\d{1,2}(\\s*)"+In,"i"),gx=new RegExp("\\d{1,2}\\:\\d{1,2}(\\s*)"+In,"i"),hx=new RegExp("\\d{1,2}(\\s*)"+In,"i"),fx=new RegExp("\\d{1,2}"),yx=new RegExp(lo.join("|")+"-\\d{2}","i"),bx=new RegExp(co.join("|")+"-\\d{2}","i"),bc=new RegExp("(\\d{1,2})(\\D+)("+lo.join("|")+"|"+co.join("|")+")(\\2)('?\\d{2,4})"),vx=/\d{2}:\d{2}:\d{2}\.\d{3}/,xx=/\d{2}:\d{2}:\d{2}\.\d{2}/,wx=/\d{2}:\d{2}:\d{2}\.\d{1}/,kx=/T\d{2}:\d{2}:\d{2}/,Sx=/0\d:\d{2}:\d{2}/,Ax=/0\d:\d{2}/,Tx=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}/,zx=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{3}/,Lx=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{2}/,Ex=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]:\d{2}\.\d{1}/,Ox=/\b([01]?[0-9]|2[0-3]):[0-5][0-9]/,Cx=/24:00:\d{2}/,Mx=/24:00:\d{2}\.\d{3}/,qx=/24:00:\d{2}\.\d{2}/,Ix=/24:00:\d{2}\.\d{1}/,Bx=/24:00/,Fx=/\d{4}/,_x=/\d{2}/,Rx=/'\d{2}/,_p=/0\d/,Rp=/\d{1,2}/,Dx=/0\d/,Kx=/\d{1,2}/,Nx=/^([1-9])\/([1-9]|0[1-9])$/,Yx=/^([1-9])\/(1[012])$/,jx=/^(0[1-9]|[12][0-9]|3[01])\/([1-9])$/,Px=/^(0[1-9]|[12][0-9]|3[01])\/(1[012]|0[1-9])$/,Hx=/^([1-9])(\D)([1-9][0-9])$/,$x=/^([1-9])(\D)([0][0-9])$/,Wx=/^(0[1-9]|1[012])(\D)([1-9][0-9])$/,Ux=/^(0[1-9]|1[012])(\D)([0][0-9])$/,vc=/([/][M]|[M][/]|[MM]|[M
2023-11-09 17:30:33 +08:00
2024-07-08 15:37:38 +08:00
`+e.mark.snippet),n+" "+i):n}function Vn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=nd(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Vn.prototype=Object.create(Error.prototype);Vn.prototype.constructor=Vn;Vn.prototype.toString=function(t){return this.name+": "+nd(this,t)};var Ge=Vn;function Fo(e,t,i,n,r){var a="",s="",o=Math.floor(r/2)-1;return n-t>o&&(a=" ... ",t=n-o+a.length),i-n>o&&(s=" ...",i=n+o-s.length),{str:a+e.slice(t,i).replace(/\t/g,"\u2192")+s,pos:n-t+a.length}}function _o(e,t){return Le.repeat(" ",t-e.length)+e}function Qm(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var i=/\r?\n|\r|\0/g,n=[0],r=[],a,s=-1;a=i.exec(e.buffer);)r.push(a.index),n.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var o="",l,c,d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Fo(e.buffer,n[s-l],r[s-l],e.position-(n[s]-n[s-l]),u),o=Le.repeat(" ",t.indent)+_o((e.line-l+1).toString(),d)+" | "+c.str+`
`+o;for(c=Fo(e.buffer,n[s],r[s],e.position,u),o+=Le.repeat(" ",t.indent)+_o((e.line+1).toString(),d)+" | "+c.str+`
`,o+=Le.repeat("-",t.indent+d+3+c.pos)+`^
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=Fo(e.buffer,n[s+l],r[s+l],e.position-(n[s]-n[s+l]),u),o+=Le.repeat(" ",t.indent)+_o((e.line+l+1).toString(),d)+" | "+c.str+`
`;return o.replace(/\n$/,"")}var Zm=Qm,Jm=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Xm=["scalar","sequence","mapping"];function eg(e){var t={};return e!==null&&Object.keys(e).forEach(function(i){e[i].forEach(function(n){t[String(n)]=i})}),t}function ig(e,t){if(t=t||{},Object.keys(t).forEach(function(i){if(Jm.indexOf(i)===-1)throw new Ge('Unknown option "'+i+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(i){return i},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=eg(t.styleAliases||null),Xm.indexOf(this.kind)===-1)throw new Ge('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Pe=ig;function Yc(e,t){var i=[];return e[t].forEach(function(n){var r=i.length;i.forEach(function(a,s){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(r=s)}),i[r]=n}),i}function tg(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,i;function n(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(t=0,i=arguments.length;t<i;t+=1)arguments[t].forEach(n);return e}function Do(e){return this.extend(e)}Do.prototype.extend=function(t){var i=[],n=[];if(t instanceof Pe)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(i=i.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new Ge("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");i.forEach(function(a){if(!(a instanceof Pe))throw new Ge("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Ge("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Ge("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof Pe))throw new Ge("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Do.prototype);return r.implicit=(this.implicit||[]).concat(i),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=Yc(r,"implicit"),r.compiledExplicit=Yc(r,"explicit"),r.compiledTypeMap=tg(r.compiledImplicit,r.compiledExplicit),r};var ng=Do,rg=new Pe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ag=new Pe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),sg=new Pe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),og=new ng({explicit:[rg,ag,sg]});function lg(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function cg(){return null}function dg(e){return e===null}var ug=new Pe("tag:yaml.org,2002:null",{kind:"scalar",resolve:lg,construct:cg,predicate:dg,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function pg(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function mg(e){return e==="true"||e==="True"||e==="TRUE"}function gg(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var hg=new Pe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:pg,construct:mg,predicate:gg,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});functio
\r`;function Dg(e){if(e===null)return!1;var t,i,n=0,r=e.length,a=Po;for(i=0;i<r;i++)if(t=a.indexOf(e.charAt(i)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function Kg(e){var t,i,n=e.replace(/[\r\n=]/g,""),r=n.length,a=Po,s=0,o=[];for(t=0;t<r;t++)t%4===0&&t&&(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return i=r%4*6,i===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):i===18?(o.push(s>>10&255),o.push(s>>2&255)):i===12&&o.push(s>>4&255),new Uint8Array(o)}function Ng(e){var t="",i=0,n,r,a=e.length,s=Po;for(n=0;n<a;n++)n%3===0&&n&&(t+=s[i>>18&63],t+=s[i>>12&63],t+=s[i>>6&63],t+=s[i&63]),i=(i<<8)+e[n];return r=a%3,r===0?(t+=s[i>>18&63],t+=s[i>>12&63],t+=s[i>>6&63],t+=s[i&63]):r===2?(t+=s[i>>10&63],t+=s[i>>4&63],t+=s[i<<2&63],t+=s[64]):r===1&&(t+=s[i>>2&63],t+=s[i<<4&63],t+=s[64],t+=s[64]),t}function Yg(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var jg=new Pe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Dg,construct:Kg,predicate:Yg,represent:Ng}),Pg=Object.prototype.hasOwnProperty,Hg=Object.prototype.toString;function $g(e){if(e===null)return!0;var t=[],i,n,r,a,s,o=e;for(i=0,n=o.length;i<n;i+=1){if(r=o[i],s=!1,Hg.call(r)!=="[object Object]")return!1;for(a in r)if(Pg.call(r,a))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function Wg(e){return e!==null?e:[]}var Ug=new Pe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:$g,construct:Wg}),Vg=Object.prototype.toString;function Gg(e){if(e===null)return!0;var t,i,n,r,a,s=e;for(a=new Array(s.length),t=0,i=s.length;t<i;t+=1){if(n=s[t],Vg.call(n)!=="[object Object]"||(r=Object.keys(n),r.length!==1))return!1;a[t]=[r[0],n[r[0]]]}return!0}function Qg(e){if(e===null)return[];var t,i,n,r,a,s=e;for(a=new Array(s.length),t=0,i=s.length;t<i;t+=1)n=s[t],r=Object.keys(n),a[t]=[r[0],n[r[0]]];return a}var Zg=new Pe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Gg,construct:Qg}),Jg=Object.prototype.hasOwnProperty;function Xg(e){if(e===null)return!0;var t,i=e;for(t in i)if(Jg.call(i,t)&&i[t]!==null)return!1;return!0}function eh(e){return e!==null?e:{}}var ih=new Pe("tag:yaml.org,2002:set",{kind:"mapping",resolve:Xg,construct:eh}),sd=Mg.extend({implicit:[Fg,Rg],explicit:[jg,Ug,Zg,ih]}),Zi=Object.prototype.hasOwnProperty,Ya=1,od=2,ld=3,ja=4,Ro=1,th=2,jc=3,nh=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,rh=/[\x85\u2028\u2029]/,ah=/[,\[\]\{\}]/,cd=/^(?:!|!!|![a-z\-]+!)$/i,dd=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pc(e){return Object.prototype.toString.call(e)}function Ei(e){return e===10||e===13}function wt(e){return e===9||e===32}function ti(e){return e===9||e===32||e===10||e===13}function gn(e){return e===44||e===91||e===93||e===123||e===125}function sh(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function oh(e){return e===120?2:e===117?4:e===85?8:0}function lh(e){return 48<=e&&e<=57?e-48:-1}function Hc(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function ch(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var ud=new Array(256),pd=new Array(256);for(xt=0;xt<256;xt++)ud[xt]=Hc(xt)?1:0,pd[xt]=Hc(xt);var xt;function dh(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||sd,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function md(e,t){var i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=Zm(i),new Ge(t,i)}function j(e,t){throw md(e,t)}function Pa(e,t){e.onWarning&&e.onWarning.call(null,md(e,t))}var $c={YAML:function(t,i,n){var r,a,s;t.version!==null&&j(t,"duplication of %YAML directive"),n.length!==1&&j(t,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),r===null&&j(t,"ill-formed argument of the YAML directive"),a=parseInt(r[1],10),s=parseInt(r[2],10),a!==1&&j(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Pa(t,"unsupported YAML version of the document")},TAG:function(t,i,n){var r,a;n.length!==2&&j(t,"TAG directive accepts exactly two arguments"),r=n[0],a=n[1],cd.test(r)||j(t,"ill-formed tag handle (first argument) of the TAG directive"),Zi.call(t.tagMap,r)&&j(t,'there is a previously declared suffix for "'+r+'" tag handle'),dd.test(a)||j(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{j(t,"tag prefix is malformed: "+a)}t.tagMap[r]=a}};function Qi(e,t,i,n){var r,a,s,o;if(t<i){if(o=e.input.slice(t,i),n)for(r=0,a=o.length;r<a;r+=1)s=o.charCodeAt(r),s===9||32<=s&&s<=1114111||j(e,"expected valid JSON character");else nh.test(o)&&j(e,"the stream contains non-printable characters");e.result+=o}}function Wc(e,t,i,n){var r,a,s,o;for(Le.isObject(i)||j(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(i),s=0,o=r.length;s<o;s+=1)a=r[s],Zi.call(t,a)||(t[a]=i[a],n[a]=!0)}function hn(e,t,i,n,r,a,s,o,l){var c,d;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),c=0,d=r.length;c<d;c+=1)Array.isArray(r[c])&&j(e,"nested arrays are not supported inside keys"),typeof r=="object"&&Pc(r[c])==="[object Object]"&&(r[c]="[object Object]");if(typeof r=="object"&&Pc(r)==="[object Object]"&&(r="[object Object]"),r=String(r),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(c=0,d=a.length;c<d;c+=1)Wc(e,t,a[c],i);else Wc(e,t,a,i);else!e.json&&!Zi.call(i,r)&&Zi.call(t,r)&&(e.line=s||e.line,e.lineStart=o||e.lineStart,e.position=l||e.position,j(e,"duplicated mapping key")),r==="__proto__"?Object.defineProperty(t,r,{configurable:!0,enumerable:!0,writable:!0,value:a}):t[r]=a,delete i[r];return t}function Ho(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):j(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Te(e,t,i){for(var n=0,r=e.input.charCodeAt(e.position);r!==0;){for(;wt(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(Ei(r))for(Ho(e),r=e.input.charCodeAt(e.position),n++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return i!==-1&&n!==0&&e.lineIndent<i&&Pa(e,"deficient indentation"),n}function Wa(e){var t=e.position,i;return i=e.input.charCodeAt(t),!!((i===45||i===46)&&i===e.input.charCodeAt(t+1)&&i===e.input.charCodeAt(t+2)&&(t+=3,i=e.input.charCodeAt(t),i===0||ti(i)))}function $o(e,t){t===1?e.result+=" ":t>1&&(e.result+=Le.rep
`,t-1))}function uh(e,t,i){var n,r,a,s,o,l,c,d,u=e.kind,g=e.result,m;if(m=e.input.charCodeAt(e.position),ti(m)||gn(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(r=e.input.charCodeAt(e.position+1),ti(r)||i&&gn(r)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,o=!1;m!==0;){if(m===58){if(r=e.input.charCodeAt(e.position+1),ti(r)||i&&gn(r))break}else if(m===35){if(n=e.input.charCodeAt(e.position-1),ti(n))break}else{if(e.position===e.lineStart&&Wa(e)||i&&gn(m))break;if(Ei(m))if(l=e.line,c=e.lineStart,d=e.lineIndent,Te(e,!1,-1),e.lineIndent>=t){o=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=d;break}}o&&(Qi(e,a,s,!1),$o(e,e.line-l),a=s=e.position,o=!1),wt(m)||(s=e.position+1),m=e.input.charCodeAt(++e.position)}return Qi(e,a,s,!1),e.result?!0:(e.kind=u,e.result=g,!1)}function ph(e,t){var i,n,r;if(i=e.input.charCodeAt(e.position),i!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39)if(Qi(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0;else Ei(i)?(Qi(e,n,r,!0),$o(e,Te(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Wa(e)?j(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);j(e,"unexpected end of the stream within a single quoted scalar")}function mh(e,t){var i,n,r,a,s,o;if(o=e.input.charCodeAt(e.position),o!==34)return!1;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;(o=e.input.charCodeAt(e.position))!==0;){if(o===34)return Qi(e,i,e.position,!0),e.position++,!0;if(o===92){if(Qi(e,i,e.position,!0),o=e.input.charCodeAt(++e.position),Ei(o))Te(e,!1,t);else if(o<256&&ud[o])e.result+=pd[o],e.position++;else if((s=oh(o))>0){for(r=s,a=0;r>0;r--)o=e.input.charCodeAt(++e.position),(s=sh(o))>=0?a=(a<<4)+s:j(e,"expected hexadecimal character");e.result+=ch(a),e.position++}else j(e,"unknown escape sequence");i=n=e.position}else Ei(o)?(Qi(e,i,n,!0),$o(e,Te(e,!1,t)),i=n=e.position):e.position===e.lineStart&&Wa(e)?j(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}j(e,"unexpected end of the stream within a double quoted scalar")}function gh(e,t){var i=!0,n,r,a,s=e.tag,o,l=e.anchor,c,d,u,g,m,h=Object.create(null),x,b,k,A;if(A=e.input.charCodeAt(e.position),A===91)d=93,m=!1,o=[];else if(A===123)d=125,m=!0,o={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),A=e.input.charCodeAt(++e.position);A!==0;){if(Te(e,!0,t),A=e.input.charCodeAt(e.position),A===d)return e.position++,e.tag=s,e.anchor=l,e.kind=m?"mapping":"sequence",e.result=o,!0;i?A===44&&j(e,"expected the node content, but found ','"):j(e,"missed comma between flow collection entries"),b=x=k=null,u=g=!1,A===63&&(c=e.input.charCodeAt(e.position+1),ti(c)&&(u=g=!0,e.position++,Te(e,!0,t))),n=e.line,r=e.lineStart,a=e.position,fn(e,t,Ya,!1,!0),b=e.tag,x=e.result,Te(e,!0,t),A=e.input.charCodeAt(e.position),(g||e.line===n)&&A===58&&(u=!0,A=e.input.charCodeAt(++e.position),Te(e,!0,t),fn(e,t,Ya,!1,!0),k=e.result),m?hn(e,o,h,b,x,k,n,r,a):u?o.push(hn(e,null,h,b,x,k,n,r,a)):o.push(x),Te(e,!0,t),A=e.input.charCodeAt(e.position),A===44?(i=!0,A=e.input.charCodeAt(++e.position)):i=!1}j(e,"unexpected end of the stream within a flow collection")}function hh(e,t){var i,n,r=Ro,a=!1,s=!1,o=t,l=0,c=!1,d,u;if(u=e.input.charCodeAt(e.position),u===124)n=!1;else if(u===62)n=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)Ro===r?r=u===43?jc:th:j(e,"repeat of a chomping mode identifier");else if((d=lh(u))>=0)d===0?j(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?j(e,"repeat of an indentation width identifier"):(o=t+d-1,s=!0);else break;if(wt(u)){do u=e.input.charCodeAt(++e.position);while(wt(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!Ei(u)&&u!==0)}for(;u!==0;){for(Ho(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!s||e.lineIn
`,a?1+l:l):r===Ro&&a&&(e.result+=`
`);break}for(n?wt(u)?(c=!0,e.result+=Le.repeat(`
`,a?1+l:l)):c?(c=!1,e.result+=Le.repeat(`
`,l+1)):l===0?a&&(e.result+=" "):e.result+=Le.repeat(`
`,l):e.result+=Le.repeat(`
`,a?1+l:l),a=!0,s=!0,l=0,i=e.position;!Ei(u)&&u!==0;)u=e.input.charCodeAt(++e.position);Qi(e,i,e.position,!1)}return!0}function Uc(e,t){var i,n=e.tag,r=e.anchor,a=[],s,o=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,j(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!ti(s))));){if(o=!0,e.position++,Te(e,!0,-1)&&e.lineIndent<=t){a.push(null),l=e.input.charCodeAt(e.position);continue}if(i=e.line,fn(e,t,ld,!1,!0),a.push(e.result),Te(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>t)&&l!==0)j(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return o?(e.tag=n,e.anchor=r,e.kind="sequence",e.result=a,!0):!1}function fh(e,t,i){var n,r,a,s,o,l,c=e.tag,d=e.anchor,u={},g=Object.create(null),m=null,h=null,x=null,b=!1,k=!1,A;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),A=e.input.charCodeAt(e.position);A!==0;){if(!b&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,j(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),a=e.line,(A===63||A===58)&&ti(n))A===63?(b&&(hn(e,u,g,m,h,null,s,o,l),m=h=x=null),k=!0,b=!0,r=!0):b?(b=!1,r=!0):j(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,A=n;else{if(s=e.line,o=e.lineStart,l=e.position,!fn(e,i,od,!1,!0))break;if(e.line===a){for(A=e.input.charCodeAt(e.position);wt(A);)A=e.input.charCodeAt(++e.position);if(A===58)A=e.input.charCodeAt(++e.position),ti(A)||j(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(hn(e,u,g,m,h,null,s,o,l),m=h=x=null),k=!0,b=!1,r=!1,m=e.tag,h=e.result;else if(k)j(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=d,!0}else if(k)j(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=d,!0}if((e.line===a||e.lineIndent>t)&&(b&&(s=e.line,o=e.lineStart,l=e.position),fn(e,t,ja,!0,r)&&(b?h=e.result:x=e.result),b||(hn(e,u,g,m,h,x,s,o,l),m=h=x=null),Te(e,!0,-1),A=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&A!==0)j(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return b&&hn(e,u,g,m,h,null,s,o,l),k&&(e.tag=c,e.anchor=d,e.kind="mapping",e.result=u),k}function yh(e){var t,i=!1,n=!1,r,a,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&j(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(i=!0,s=e.input.charCodeAt(++e.position)):s===33?(n=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,i){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):j(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!ti(s);)s===33&&(n?j(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),cd.test(r)||j(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),ah.test(a)&&j(e,"tag suffix cannot contain flow indicator characters")}a&&!dd.test(a)&&j(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{j(e,"tag name is malformed: "+a)}return i?e.tag=a:Zi.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:r==="!"?e.tag="!"+a:r==="!!"?e.tag="tag:yaml.org,2002:"+a:j(e,'undeclared tag handle "'+r+'"'),!0}function bh(e){var t,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&j(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!ti(i)&&!gn(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&j(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function vh(e){var t,i,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new dh(e,t),n=e.indexOf("\0");for(n!==-1&&(i.position=n,j(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)xh(i);return i.documents}function wh(e,t,i){t!==null&&typeof t=="object"&&typeof i>"u"&&(i=t,t=null);var n=gd(e,i);if(typeof t!="function")return n;for(var r=0,a=n.length;r<a;r+=1)t(n[r])}function kh(e,t){var i=gd(e,t);if(i.length!==0){if(i.length===1)return i[0];throw new Ge("expected a single document in the stream, but found more")}}var Sh=wh,Ah=kh,hd={loadAll:Sh,load:Ah},fd=Object.prototype.toString,yd=Object.prototype.hasOwnProperty,Wo=65279,Th=9,Gn=10,zh=13,Lh=32,Eh=33,Oh=34,Ko=35,Ch=37,Mh=38,qh=39,Ih=42,bd=44,Bh=45,Ha=58,Fh=61,_h=62,Rh=63,Dh=64,vd=91,xd=93,Kh=96,wd=123,Nh=124,kd=125,He={};He[0]="\\0";He[7]="\\a";He[8]="\\b";He[9]="\\t";He[10]="\\n";He[11]="\\v";He[12]="\\f";He[13]="\\r";He[27]="\\e";He[34]='\\"';He[92]="\\\\";He[133]="\\N";He[160]="\\_";He[8232]="\\L";He[8233]="\\P";var Yh=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],jh=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ph(e,t){var i,n,r,a,s,o,l;if(t===null)return{};for(i={},n=Object.keys(t),r=0,a=n.length;r<a;r+=1)s=n[r],o=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&yd.call(l.styleAliases,o)&&(o=l.styleAliases[o]),i[s]=o;return i}function Hh(e){var t,i,n;if(t=e.toString(16).toUpperCase(),e<=255)i="x",n=2;else if(e<=65535)i="u",n=4;else if(e<=4294967295)i="U",n=8;else throw new Ge("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+i+Le.repeat("0",n-t.length)+t}var $h=1,Qn=2;function Wh(e){this.schema=e.schema||sd,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Le.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=Ph(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Qn:$h,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Vc(e,t){for(var i=Le.repeat(" ",t),n=0,r=-1,a="",s,o=e.length;n<o;)r=e.indexOf(`
2023-11-09 17:30:33 +08:00
`,n),r===-1?(s=e.slice(n),n=o):(s=e.slice(n,r+1),n=r+1),s.length&&s!==`
2024-07-08 15:37:38 +08:00
`&&(a+=i),a+=s;return a}function No(e,t){return`
`+Le.repeat(" ",e.indent*t)}function Uh(e,t){var i,n,r;for(i=0,n=e.implicitTypes.length;i<n;i+=1)if(r=e.implicitTypes[i],r.resolve(t))return!0;return!1}function $a(e){return e===Lh||e===Th}function Zn(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Wo||65536<=e&&e<=1114111}function Gc(e){return Zn(e)&&e!==Wo&&e!==zh&&e!==Gn}function Qc(e,t,i){var n=Gc(e),r=n&&!$a(e);return(i?n:n&&e!==bd&&e!==vd&&e!==xd&&e!==wd&&e!==kd)&&e!==Ko&&!(t===Ha&&!r)||Gc(t)&&!$a(t)&&e===Ko||t===Ha&&r}function Vh(e){return Zn(e)&&e!==Wo&&!$a(e)&&e!==Bh&&e!==Rh&&e!==Ha&&e!==bd&&e!==vd&&e!==xd&&e!==wd&&e!==kd&&e!==Ko&&e!==Mh&&e!==Ih&&e!==Eh&&e!==Nh&&e!==Fh&&e!==_h&&e!==qh&&e!==Oh&&e!==Ch&&e!==Dh&&e!==Kh}function Gh(e){return!$a(e)&&e!==Ha}function Un(e,t){var i=e.charCodeAt(t),n;return i>=55296&&i<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(i-55296)*1024+n-56320+65536:i}function Sd(e){var t=/^\n* /;return t.test(e)}var Ad=1,Yo=2,Td=3,zd=4,mn=5;function Qh(e,t,i,n,r,a,s,o){var l,c=0,d=null,u=!1,g=!1,m=n!==-1,h=-1,x=Vh(Un(e,0))&&Gh(Un(e,e.length-1));if(t||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Un(e,l),!Zn(c))return mn;x=x&&Qc(c,d,o),d=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Un(e,l),c===Gn)u=!0,m&&(g=g||l-h-1>n&&e[h+1]!==" ",h=l);else if(!Zn(c))return mn;x=x&&Qc(c,d,o),d=c}g=g||m&&l-h-1>n&&e[h+1]!==" "}return!u&&!g?x&&!s&&!r(e)?Ad:a===Qn?mn:Yo:i>9&&Sd(e)?mn:s?a===Qn?mn:Yo:g?zd:Td}function Zh(e,t,i,n,r){e.dump=function(){if(t.length===0)return e.quotingType===Qn?'""':"''";if(!e.noCompatMode&&(Yh.indexOf(t)!==-1||jh.test(t)))return e.quotingType===Qn?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,i),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),o=n||e.flowLevel>-1&&i>=e.flowLevel;function l(c){return Uh(e,c)}switch(Qh(t,o,e.indent,s,l,e.quotingType,e.forceQuotes&&!n,r)){case Ad:return t;case Yo:return"'"+t.replace(/'/g,"''")+"'";case Td:return"|"+Zc(t,e.indent)+Jc(Vc(t,a));case zd:return">"+Zc(t,e.indent)+Jc(Vc(Jh(t,s),a));case mn:return'"'+Xh(t)+'"';default:throw new Ge("impossible error: invalid scalar style")}}()}function Zc(e,t){var i=Sd(e)?String(t):"",n=e[e.length-1]===`
2023-11-09 17:30:33 +08:00
`,r=n&&(e[e.length-2]===`
`||e===`
`),a=r?"+":n?"":"-";return i+a+`
2024-07-08 15:37:38 +08:00
`}function Jc(e){return e[e.length-1]===`
`?e.slice(0,-1):e}function Jh(e,t){for(var i=/(\n+)([^\n]*)/g,n=function(){var c=e.indexOf(`
`);return c=c!==-1?c:e.length,i.lastIndex=c,Xc(e.slice(0,c),t)}(),r=e[0]===`
2023-11-09 17:30:33 +08:00
`||e[0]===" ",a,s;s=i.exec(e);){var o=s[1],l=s[2];a=l[0]===" ",n+=o+(!r&&!a&&l!==""?`
2024-07-08 15:37:38 +08:00
`:"")+Xc(l,t),r=a}return n}function Xc(e,t){if(e===""||e[0]===" ")return e;for(var i=/ [^ ]/g,n,r=0,a,s=0,o=0,l="";n=i.exec(e);)o=n.index,o-r>t&&(a=s>r?s:o,l+=`
2023-11-09 17:30:33 +08:00
`+e.slice(r,a),r=a+1),s=o;return l+=`
`,e.length-r>t&&s>r?l+=e.slice(r,s)+`
2024-07-08 15:37:38 +08:00
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function Xh(e){for(var t="",i=0,n,r=0;r<e.length;i>=65536?r+=2:r++)i=Un(e,r),n=He[i],!n&&Zn(i)?(t+=e[r],i>=65536&&(t+=e[r+1])):t+=n||Hh(i);return t}function ef(e,t,i){var n="",r=e.tag,a,s,o;for(a=0,s=i.length;a<s;a+=1)o=i[a],e.replacer&&(o=e.replacer.call(i,String(a),o)),(Pi(e,t,o,!1,!1)||typeof o>"u"&&Pi(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=r,e.dump="["+n+"]"}function ed(e,t,i,n){var r="",a=e.tag,s,o,l;for(s=0,o=i.length;s<o;s+=1)l=i[s],e.replacer&&(l=e.replacer.call(i,String(s),l)),(Pi(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&Pi(e,t+1,null,!0,!0,!1,!0))&&((!n||r!=="")&&(r+=No(e,t)),e.dump&&Gn===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=a,e.dump=r||"[]"}function tf(e,t,i){var n="",r=e.tag,a=Object.keys(i),s,o,l,c,d;for(s=0,o=a.length;s<o;s+=1)d="",n!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=a[s],c=i[l],e.replacer&&(c=e.replacer.call(i,l,c)),Pi(e,t,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Pi(e,t,c,!1,!1)&&(d+=e.dump,n+=d));e.tag=r,e.dump="{"+n+"}"}function nf(e,t,i,n){var r="",a=e.tag,s=Object.keys(i),o,l,c,d,u,g;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Ge("sortKeys must be a boolean or a function");for(o=0,l=s.length;o<l;o+=1)g="",(!n||r!=="")&&(g+=No(e,t)),c=s[o],d=i[c],e.replacer&&(d=e.replacer.call(i,c,d)),Pi(e,t+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&Gn===e.dump.charCodeAt(0)?g+="?":g+="? "),g+=e.dump,u&&(g+=No(e,t)),Pi(e,t+1,d,!0,u)&&(e.dump&&Gn===e.dump.charCodeAt(0)?g+=":":g+=": ",g+=e.dump,r+=g));e.tag=a,e.dump=r||"{}"}function id(e,t,i){var n,r,a,s,o,l;for(r=i?e.explicitTypes:e.implicitTypes,a=0,s=r.length;a<s;a+=1)if(o=r[a],(o.instanceOf||o.predicate)&&(!o.instanceOf||typeof t=="object"&&t instanceof o.instanceOf)&&(!o.predicate||o.predicate(t))){if(i?o.multi&&o.representName?e.tag=o.representName(t):e.tag=o.tag:e.tag="?",o.represent){if(l=e.styleMap[o.tag]||o.defaultStyle,fd.call(o.represent)==="[object Function]")n=o.represent(t,l);else if(yd.call(o.represent,l))n=o.represent[l](t,l);else throw new Ge("!<"+o.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function Pi(e,t,i,n,r,a,s){e.tag=null,e.dump=i,id(e,i,!1)||id(e,i,!0);var o=fd.call(e.dump),l=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var d=o==="[object Object]"||o==="[object Array]",u,g;if(d&&(u=e.duplicates.indexOf(i),g=u!==-1),(e.tag!==null&&e.tag!=="?"||g||e.indent!==2&&t>0)&&(r=!1),g&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&g&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),o==="[object Object]")n&&Object.keys(e.dump).length!==0?(nf(e,t,e.dump,r),g&&(e.dump="&ref_"+u+e.dump)):(tf(e,t,e.dump),g&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?ed(e,t-1,e.dump,r):ed(e,t,e.dump,r),g&&(e.dump="&ref_"+u+e.dump)):(ef(e,t,e.dump),g&&(e.dump="&ref_"+u+" "+e.dump));else if(o==="[object String]")e.tag!=="?"&&Zh(e,e.dump,t,a,l);else{if(o==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Ge("unacceptable kind of an object to dump "+o)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function rf(e,t){var i=[],n=[],r,a;for(jo(e,i,n),r=0,a=n.length;r<a;r+=1)t.duplicates.push(i[n[r]]);t.usedDuplicates=new Array(a)}function jo(e,t,i){var n,r,a;if(e!==null&&typeof e=="object")if(r=t.indexOf(e),r!==-1)i.indexOf(r)===-1&&i.push(r);else if(t.push(e),Array.isArray(e))for(r=0,a=e.length;r<a;r+=1)jo(e[r],t,i);else for(n=Object.keys(e),r=0,a=n.length;r<a;r+=1)jo(e[n[r]],t,i)}function af(e,t){t=t||{};var i=new Wh(t);i.noRefs||rf(e,i);var n=e;return i.replacer&&(n=i.replacer.call({"":n},"",n)),Pi(i,0,n,!0,!0)?i.dump+`
`:""}var sf=af,of={dump:sf};function Uo(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Vo=hd.load,dk=hd.loadAll,Go=of.dump,Ld=Ge;var uk=Uo("safeLoad","load"),pk=Uo("safeLoadAll","loadAll"),mk=Uo("safeDump","dump");function Jn(e,t){if(e==null)return null;let i=Qo(e,t);return typeof i=="string"?i:null}function Ed(e,t){if(e==null)return null;let i=Qo(e,t);return typeof i=="number"?i:null}function Od(e,t){if(e==null)return null;let i=Qo(e,t);return typeof i=="boolean"?i:null}function Qo(e,t){t=t.replace("..",".");let i=t.split(".");i!=null&&i[i.length-1]==""&&(i[i.length-1]=".");let n=e;for(let r of i)if(n=n[r],n==null)return null;return n}var se=pn(Va());var Ga="[Obsidian Linter]",Zo=new Map,Xn=!1;var Qa=[];function Md(e,t){let i=`${Ga} ${e}:
2023-11-09 17:30:33 +08:00
`;i+=`${t.name} ${t.message}`,t.stack&&(i+=`
2024-07-08 15:37:38 +08:00
`+t.stack),se.default.error(i),Xn&&Za(i.substring(i.indexOf("]")+2),se.default.levels.TRACE)}function yn(e){se.default.info(`${Ga} ${e}`),Xn&&Za(e,se.default.levels.INFO)}function ri(e){se.default.debug(`${Ga} ${e}`),Xn&&Za(e,se.default.levels.DEBUG)}function kt(e){se.default.warn(`${Ga} ${e}`),Xn&&Za(e,se.default.levels.WARN)}function St(e){se.default.getLevel()>se.default.levels.DEBUG||Zo.set(e,performance.now())}function Ji(e){if(se.default.getLevel()>se.default.levels.DEBUG)return;Zo.has(e)||kt(E("logs.timing-key-not-found").replace("{TIMING_KEY}",e));let t=performance.now()-Zo.get(e);ri(`${e}: ${t} `+E("logs.milliseconds-abbreviation"))}function Za(e,t){se.default.getLevel()<=t&&Qa.push(e)}function qd(){Qa=[]}function Jo(e){Xn=e}function Ja(e){switch(e){case"INFO":{se.default.setLevel("info");break}case"TRACE":{se.default.setLevel("trace");break}case"DEBUG":{se.default.setLevel("debug");break}case"SILENT":{se.default.setLevel("silent");break}case"ERROR":{se.default.setLevel("error");break}case"WARN":{se.default.setLevel("warn");break}}}function Id(e){switch(e){case se.default.levels.INFO:return"INFO";case se.default.levels.TRACE:return"TRACE";case se.default.levels.DEBUG:return"DEBUG";case se.default.levels.SILENT:return"SILENT";case se.default.levels.ERROR:return"ERROR";case se.default.levels.WARN:return"WARN"}}var Bd={};var Fd={};var _d={};var Rd={commands:{"lint-file":{name:"Linten Sie die aktuelle Datei","error-message":"Lint-Datei-Fehler in der Datei"},"lint-file-unless-ignored":{name:"Linten Sie die aktuelle Datei, es sei denn, sie wird ignoriert"},"lint-all-files":{name:"Linten Sie alle Dateien im Vault","error-message":"Beim Linten aller Dateien Fehler in der Datei","success-message":"Alle Dateien gelinted","errors-message-singular":"Beim Linten aller Dateien gab es einen Fehler.","errors-message-plural":"Beim Linten aller Dateien gab es {NUM} Fehler.","start-message":"Dadurch werden alle Ihre Dateien ver\xE4ndert und es k\xF6nnen Fehler entstehen.","submit-button-text":"Linte alle","submit-button-notice-text":"Linte alle Dateien..."},"lint-all-files-in-folder":{name:"Linte alle Dateien im aktuellen Ordner","start-message":"Dadurch werden alle Ihre Dateien in {FOLDER_NAME} bearbeitet, einschlie\xDFlich der Dateien in den Unterordnern, was zu Fehlern f\xFChren kann.","submit-button-text":"Linte alle Dateien in {FOLDER_NAME}","submit-button-notice-text":"Linten aller Dateien in {FOLDER_NAME}...","error-message":"Beim Linten aller Dateien im Ordner gab es Fehler in der Datei","success-message":"Alle {NUM}-Dateien in {FOLDER_NAME} wurden gelinted.","message-singular":"Alle {NUM}-Dateien in {FOLDER_NAME} wurden gelinted und es trat ein Fehler auf.","message-plural":"Alle {FILE_COUNT}-Dateien in {FOLDER_NAME} wurden gelinted und es gab {ERROR_COUNT} Fehler."},"paste-as-plain-text":{name:"Einf\xFCgen als reiner Text und ohne \xC4nderungen"},"lint-file-pop-up-menu-text":{name:"Linte Datei"},"lint-folder-pop-up-menu-text":{name:"Linte Ordner"}},logs:{"plugin-load":"Plugin wird geladen","plugin-unload":"Plugin entladen","folder-lint":"Linting-Ordner ","linter-run":"Laufender Linter","paste-link-warning":"Abgebrochenes Einf\xFCgen des Lints, da der Inhalt der Zwischenablage ein Link ist, wodurch Konflikte mit anderen Plugins vermieden werden, die das Einf\xFCgen \xE4ndern.","see-console":"Weitere Informationen finden Sie in der Konsole.","unknown-error":"Beim Linten ist ein unbekannter Fehler aufgetreten.","moment-locale-not-found":"Beim Versuch, Moment.js locale auf {MOMENT_LOCALE} umzustellen, wurde {CURRENT_LOCALE} angezeigt","file-change-lint-message-start":"Linted","pre-rules":"Regeln vor regul\xE4ren Regeln","post-rules":"Regeln nach regul\xE4ren Regeln","rule-running":"Laufende Regeln","custom-regex":"Benutzerdefinierte Regex-Regeln","running-custom-regex":"Ausf\xFChren von benutzerdefinierten Regex","running-custom-lint-command":"Ausf\xFChren von benutzerdefinierten Lint-Befehlen","custom-lint-duplicate-warning":'Sie k\xF6nnen denselben Befehl ("{COMMAND_NAME}") nicht zweimal als benutzerdefinierte Lint-Regel
`)break;r.trim()===""||r===">"?i=r+i:i="",n--}return[i,n]}function nl(e=""){let[t]=bn(e,e.length);return`
`+t.trim()}function su(e="",t=!1,i=1){let n=nl(e),r=Xi(n,">");return(t||os.test(e))&&i===r||i<r?n.substring(0,n.lastIndexOf(">")):n}function gf(e,t){if(t===0)return e;let i=t,n=t;for(;i>=0;){let r=e.charAt(i);if(r.trim()!=="")break;r===`
2023-11-09 17:30:33 +08:00
`&&(n=i),i--}return i<0||n===0?e.substring(t+1):e.substring(0,n)+`
2024-07-08 15:37:38 +08:00
`+e.substring(t)}function hf(e,t,i,n=!1,r=!1){if(i===0)return e;let a=t.split(">").length-1,s=i,o=i,l=0,c=!1,d="";for(;s>=0;){let A=e.charAt(s);if(A.trim()!==""&&A!==">")break;if(A===">"){if(c)break;l++}else if(A===`
2023-12-10 12:54:30 +08:00
`)if(l===0||l===a||l+1===a)o=s,l=0,d===`
2024-07-08 15:37:38 +08:00
`&&(c=!0);else break;s--,d=A}if(s<0||o===0)return e.substring(i+1);let u=e.substring(o,i);if(u===`
2023-11-09 17:30:33 +08:00
`||u.startsWith(`
`))return e.substring(0,o)+`
2024-02-26 20:05:21 +08:00
`+e.substring(i);let m=e.lastIndexOf(`
2024-07-08 15:37:38 +08:00
`,o-1),h="";m===-1?h=e.substring(0,o):h=e.substring(m,o);let x,b=e.indexOf(`
`,i+1);b===-1?x=e.substring(i):x=e.substring(i,b);let k;return r?k=su(h,n,a):Xi(h,">")!=0&&!os.test(h)&&(er.test(h)||er.test(x))?k=e.substring(o,i).trimEnd():k=nl(h),e.substring(0,o)+k+e.substring(i)}function ff(e,t){if(t===e.length-1)return e;let i=t,n=t,r=!0;for(;i<e.length;){let a=e.charAt(i);if(a.trim()!=="")break;a===`
2023-11-09 17:30:33 +08:00
`&&(r?r=!1:n=i),i++}return i===e.length||n===e.length-1?e.substring(0,t):e.substring(0,t)+`
2024-07-08 15:37:38 +08:00
`+e.substring(n)}function yf(e,t,i,n=!1,r=!1){if(i===e.length-1)return e;let a=t.split(">").length-1,s=i,o=i,l=!0,c=0,d=!1,u="",g=!0,m=e.charAt(s-1);for(;s<e.length;){let q=e.charAt(s);if(q.trim()!==""&&q!==">")break;if(q===">"){if(d)break;c++}else if(q===`
2023-12-10 12:54:30 +08:00
`)if(c===0||c===a||c+1===a)c=0,l?l=!1:o=s,u===`
2024-07-08 15:37:38 +08:00
`&&(d=!0);else break;if(s++,u=q,g&&q===`
2024-02-26 20:05:21 +08:00
`&&r&&m===`
2024-06-12 15:46:38 +08:00
`){o=s;break}g=!1}if(s===e.length||o===e.length-1)return e.substring(0,i);let h=e.substring(i,o);if(h===`
`||h.endsWith(`
2023-11-09 17:30:33 +08:00
`))return e.substring(0,i)+`
2024-07-08 15:37:38 +08:00
`+e.substring(o);let b=e.indexOf(`
`,o+1),k="";b===-1?k=e.substring(o):k=e.substring(o+1,b);let A,L=e.lastIndexOf(`
`,i-1);L===-1?A=e.substring(0,o):A=e.substring(L+1,i);let C;return r?C=su(k,n,a):er.test(k)||er.test(A)?C=e.substring(i,o).trimEnd():C=nl(k),e.substring(0,i)+C+e.substring(o)}function Tt(e,t,i,n=!1){let[r,a]=bn(e,t);if(r.trim()!==""){let o=os.test(e.substring(t,i)),l=Xi(r,">"),c=vf(e,i,l),d=yf(e,r,c,o,n);return a=bf(d,a,l),hf(d,r,a,o,n)}let s=ff(e,i);return gf(s,a)}function ou(e,t=0){let i=3735928559^t,n=1103547991^t;for(let r=0,a;r<e.length;r++)a=e.charCodeAt(r),i=Math.imul(i^a,2654435761),n=Math.imul(n^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&n)+(i>>>0)}function lu(e){return e=e.replaceAll("\\b","\b"),e=e.replaceAll("\\f","\f"),e=e.replaceAll("\\n",`
`),e=e.replaceAll("\\r","\r"),e=e.replaceAll("\\t"," "),e=e.replaceAll("\\v","\v"),e}function ir(e,t){if(t==0)return t;let i=t;for(;i>0&&e.charAt(i-1)!==`
`;)i--;return i}function cu(e,t,i,n){return n>e.length-1?e:e.slice(0,n)+e.slice(n,e.length).replace(t,i)}function Xi(e,t){let i=0;for(let n=0,r=e.length;n<r;n++){let a=e.indexOf(t,n);a>-1&&(i++,n=a)}return i}function ss(e){let t=typeof e;return t!="string"?t==="number":!isNaN(e)&&!isNaN(parseFloat(e))}function du(e,t){let i=[],n=-1;for(;(n=t.indexOf(e,n+1))>=0;)i.push(n);return i}function bf(e,t,i){let n=t,r=t+1,a="",s=!1,o=0;for(;r<e.length;){if(a=e.charAt(r),a.trim()!==""&&a!==">"){s=!0;break}else if(a===`
`){if(o!==i)break;o=0,n=r}else a===">"&&o++;r++}return s?n:t}function vf(e,t,i){let n=t,r=t-1,a="",s=!1,o=0;for(;r>=0;){if(a=e.charAt(r),a.trim()!==""&&a!==">"){s=!0;break}else if(a===`
`){if(o!==i)break;o=0,n=r}else a===">"&&o++;r--}return s?n:t}function De(e,t,i,n){let r=e.length,a=0,s;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,i=i>0?i:0,n.length<1e4)s=Array.from(n),s.unshift(t,i),e.splice(...s);else for(i&&e.splice(t,i);a<n.length;)s=n.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function Qe(e,t){return e.length>0?(De(e,e.length,0,t),e):t}var xf=et(/\p{P}/u),ai=et(/[A-Za-z]/),Ze=et(/[\dA-Za-z]/),uu=et(/[#-'*+\--9=?A-Z^-~]/);function tr(e){return e!==null&&(e<32||e===127)}var nr=et(/\d/),pu=et(/[\dA-Fa-f]/),rl=et(/[!-/:-@[-`{-~]/);function B(e){return e!==null&&e<-2}function ne(e){return e!==null&&(e<0||e===32)}function G(e){return e===-2||e===-1||e===32}function mu(e){return rl(e)||xf(e)}var gu=et(/\s/);function et(e){return t;function t(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function al(e){if(e===null||ne(e)||gu(e))return 1;if(mu(e))return 2}function vn(e,t,i){let n=[],r=-1;for(;++r<e.length;){let a=e[r].resolveAll;a&&!n.includes(a)&&(t=a(t,i),n.push(a))}return t}var rr={name:"attention",tokenize:kf,resolveAll:wf};function wf(e,t){let i=-1,n,r,a,s,o,l,c,d;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(n=i;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[n][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;let u=Object.assign({},e[n][1].end),g=Object.assign({},e[i][1].start);hu(u,-l),hu(g,l),s={type:l>1?"strongSequence":"emphasisSequence",start:u,end:Object.assign({},e[n][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[i][1].start),end:g},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[i][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[n][1].end=Object.assign({},s.start),e[i][1].start=Object.assign({},o.end),c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=Qe(c,[["enter",e[n][1],t],["exit",e[n][1],t]])),c=Qe(c,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",a,t]]),c=Qe(c,vn(t.parser.constructs.insideSpan.null,e.slice(n+1,i),t)),c=Qe(c,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[i][1].end.offset-e[i][1].start.offset?(d=2,c=Qe(c,[["enter",e[i][1],t],["exit",e[i][1],t]])):d=0,De(e,n-1,i-n+3,c),i=n+c.length-d-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function kf(e,t){let i=this.parser.constructs.attentionMarkers.null,n=this.previous,r=al(n),a;return s;function s(l){return a=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===a)return e.consume(l),o;let c=e.exit("attentionSequence"),d=al(l),u=!d||d===2&&r||i.includes(l),g=!r||r===2&&d||i.includes(n);return c._open=!!(a===42?u:u&&(r||!g)),c._close=!!(a===42?g:g&&(d||!u)),t(l)}}function hu(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var sl={name:"autolink",tokenize:Sf};function Sf(e,t,i){let n=0;return r;function r(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(m){return ai(m)?(e.consume(m),s):c(m)}function s(m){return m===43||m===45||m===46||Ze(m)?(n=1,o(m)):c(m)}function o(m){return m===58?(e.consume(m),n=0,l):(m===43||m===45||m===46||Ze(m))&&n++<32?(e.consume(m),o):(n=0,c(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||tr(m)?i(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),d):uu(m)?(e.consume(m),c):i(m)}function d(m){return Ze(m)?u(m):i(m)}function u(m){return m===46?(e.consume(m),n=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink
2023-11-09 17:30:33 +08:00
`;break}case-3:{s=`\r
2024-07-08 15:37:38 +08:00
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&r)continue;s=" ";break}default:s=String.fromCharCode(a)}r=a===-2,n.push(s)}return n.join("")}var kl={};Kc(kl,{attentionMarkers:()=>nb,contentInitial:()=>Zy,disable:()=>rb,document:()=>Qy,flow:()=>Xy,flowInitial:()=>Jy,insideSpan:()=>tb,string:()=>eb,text:()=>ib});var Qy={42:We,43:We,45:We,48:We,49:We,50:We,51:We,52:We,53:We,54:We,55:We,56:We,57:We,62:ls},Zy={91:cl},Jy={[-2]:ar,[-1]:ar,32:ar},Xy={35:ul,42:Et,45:[fs,Et],60:ml,61:fs,95:Et,96:us,126:us},eb={38:ds,92:cs},ib={[-5]:sr,[-4]:sr,[-3]:sr,33:hl,38:ds,42:rr,60:[sl,gl],91:fl,92:[dl,cs],93:Lt,95:rr,96:ol},tb={null:[rr,Ou]},nb={null:[42,95]},rb={null:[]};function Sl(e){let i=ys([kl,...(e||{}).extensions||[]]),n={defined:[],lazy:{},constructs:i,content:r(Tu),document:r(Lu),flow:r(Eu),string:r(Cu),text:r(Mu)};return n;function r(a){return s;function s(o){return Bu(n,a,o)}}}function Al(e){for(;!ps(e););return e}var Fu=/[\0\t\n\r]/g;function Tl(){let e=1,t="",i=!0,n;return r;function r(a,s,o){let l=[],c,d,u,g,m;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),u=0,t="",i&&(a.charCodeAt(0)===65279&&u++,i=void 0);u<a.length;){if(Fu.lastIndex=u,c=Fu.exec(a),g=c&&c.index!==void 0?c.index:a.length,m=a.charCodeAt(g),!c){t=a.slice(u);break}if(m===10&&u===g&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),u<g&&(l.push(a.slice(u,g)),e+=g-u),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:n=!0,e=1}u=g+1}return o&&(n&&l.push(-5),t&&l.push(t),l.push(null)),l}}var ab=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _u(e){return e.replace(ab,sb)}function sb(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){let r=i.charCodeAt(1),a=r===120||r===88;return bs(i.slice(a?2:1),a?16:10)}return xn(i)||e}function wn(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ru(e.position):"start"in e||"end"in e?Ru(e):"line"in e||"column"in e?zl(e):""}function zl(e){return Du(e&&e.line)+":"+Du(e&&e.column)}function Ru(e){return zl(e&&e.start)+"-"+zl(e&&e.end)}function Du(e){return e&&typeof e=="number"?e:1}var Nu={}.hasOwnProperty;function Ll(e,t,i){return typeof t!="string"&&(i=t,t=void 0),ob(i)(Al(Sl(i).document().write(Tl()(e,t,!0))))}function ob(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ra),autolinkProtocol:_,autolinkEmail:_,atxHeading:a(Ba),blockQuote:a(Ki),characterEscape:_,characterReference:_,codeFenced:a(di),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(di,s),codeText:a(Li,s),codeTextData:_,data:_,codeFlowValue:_,definition:a(Gi),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(ln),hardBreakEscape:a(Fa),hardBreakTrailing:a(Fa),htmlFlow:a(jn,s),htmlFlowData:_,htmlText:a(jn,s),htmlTextData:_,image:a(_a),label:s,link:a(Ra),listItem:a(Ni),listItemValue:g,listOrdered:a(Da,u),listUnordered:a(Da),paragraph:a(cn),reference:S,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(Ba),strong:a(Ka),thematicBreak:a(Pn)},exit:{atxHeading:l(),atxHeadingSequence:q,autolink:l(),autolinkEmail:ce,autolinkProtocol:Di,blockQuote:l(),characterEscapeValue:K,characterReferenceMarkerHexadecimal:je,characterReferenceMarkerNumeric:je,characterReferenceValue:Ri,codeFenced:l(b),codeFencedFence:x,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:K,codeIndented:l(k),codeText:l($),codeTextData:K,data:K,definition:l(),definitionDestinationString:C,definitionLabelString:A,definitionTitleString:L,emphasis:l(),hardBreakEscape:l(Q),hardBreakTrailing:l(Q),htmlFlow:l(R),htmlFlowData:K,htmlText:l(H),htmlTextData:K,image:l(ee),label:Ie,labelText:Ne,lineEnding:U,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:Ae,resourceDestinationString:w,resourceTitleString:Ye,resource:Ve,setextHeading:l(N),setextHeadingLineSequence:F,setextHeadingText:z,strong:l(),thematicBreak:l()}};Yu(t,(e||{}).mdastExtensions||[]);let i={};return n;function
2024-01-10 16:42:54 +08:00
`&&(e=e.substring(0,s.end.offset)+e.substring(s.end.offset+1)),s.end.offset<e.length&&e[s.end.offset]===`
`&&(e=e.substring(0,s.end.offset)+e.substring(s.end.offset+1)),e=e.substring(0,s.start.offset)+e.substring(s.end.offset),a(e,o,s.start.offset)}for(let s of n){let o=s[1],l=o.referencePositions.length-o.footnotesReferencingKey.length;l=l>=0?l:0;let c=0;for(let d of o.footnotesReferencingKey){if(c+l>=o.referencePositions.length)throw new Error(E("logs.missing-footnote-error-message").replace("{FOOTNOTE}",d));r.set(d,o.referencePositions[l+c++])}}i=i.sort((s,o)=>r.get(s)-r.get(o)),i.length>0&&(e=e.trimEnd()+`
2023-11-09 17:30:33 +08:00
`);for(let s of i)e+=`
2024-07-08 15:37:38 +08:00
`+s;return e}function Gu(e){let t=xe("footnoteDefinition",e),i=[],n=new Map,r=new Map,a=[],s=new Set,o=[],l=function(u,g,m){let h=g.match(/\[\^.*?\]/)[0];n.set(g,h);let x=s.has(h);if(x&&i.includes(g)){o.unshift(g);return}else if(x)throw new Error(E("logs.too-many-footnotes-error-message").replace("{FOOTNOTE_KEY}",h));let b;do b=u.lastIndexOf(h,m),b!==-1&&((b+g.length>u.length||u.substring(b,b+g.length)!==g)&&a.push({key:h,position:b}),m=b-1);while(b>0);s.add(h)};for(let u of t){let g=e.substring(u.start.offset,u.end.offset);i.unshift(g),l(e,g,u.start.offset)}let c=1,d=new Set;for(let u of i){if(d.has(u))continue;d.add(u);let g=n.get(u),m=`[^${c++}]`;r.set(g,m)}a.sort((u,g)=>g.position-u.position);for(let u of a){let g=r.get(u.key);e=cu(e,u.key,g,u.position)}for(let u of d){let g=n.get(u),m=r.get(g);e=e.replace(u,u.replace(g,m))}for(let u of o){let g=e.replace(`
2024-01-10 16:42:54 +08:00
${u}
`,`
2024-07-08 15:37:38 +08:00
`);e===g&&(g=e.replace(u,"")),e=g}return e}function ws(e,t,i){let n=xe(i,e);if(n.length===0)return e;let r="";if(t==="underscore")r="_";else if(t==="asterisk")r="*";else{let a=n[n.length-1];r=e.substring(a.start.offset,a.start.offset+1)}i==="strong"&&(r+=r);for(let a of n){let s=r+e.substring(a.start.offset+r.length,a.end.offset-r.length)+r;e=de(e,a.start.offset,a.end.offset,s)}return e}function Qu(e,t){let i=xe("paragraph",e);if(i.length===0)return e;for(let n of i){let r=e.substring(n.start.offset,n.end.offset).split(`
`),a=r.length-1;if(!(a<1)){for(let s=0;s<a;s++){let o=r[s];wb(o,t)||(r[s]=kb(o,t))}e=de(e,n.start.offset,n.end.offset,r.join(`
`))}}return e}function wb(e,t){return!!(e.endsWith("<br>")&&t=="<br>"||e.endsWith("<br/>")&&t=="<br/>"||e.endsWith(" ")&&t==" "||!e.endsWith("\\\\")&&e.endsWith("\\")&&t=="\\")}function kb(e,t){e=e.trimEnd();let i=0;return e.endsWith("<br>")&&(i=4),e.endsWith("<br/>")&&(i=5),!e.endsWith("\\\\")&&e.endsWith("\\")&&(i=1),i&&(e=e.substring(0,e.length-i)),e.trimEnd()+t}function Zu(e){let t=e.endsWith(`
2024-02-26 20:05:21 +08:00
`),i=xe("paragraph",e);if(i.length===0)return e;for(let n of i){let r=n.start.offset;for(r>0&&r--;r>=0&&e.charAt(r)!=`
2023-11-09 17:30:33 +08:00
`;)r--;r++;let a=e.substring(r,n.end.offset).split(`
2024-07-08 15:37:38 +08:00
`),s=a[0].trimStart();if(s.startsWith(">")||s.match(As)||s.match(Ts))continue;let o=a.length,l=[],c=!1;for(let h=0;h<o;h++){let x=a[h];if(c){let b=l.length-1;l[b]+=`
2024-06-12 15:46:38 +08:00
`+x}else l.push(x);c=x.endsWith("<br>")||x.endsWith("<br/>")||x.endsWith(" ")||!x.endsWith("\\\\")&&x.endsWith("\\")}for(;r>0&&e.charAt(r-1)==`
2023-12-10 12:54:30 +08:00
`;)r--;let d=e.length,u=n.end.offset;for(u<d&&u++;u<d&&e.charAt(u)==`
`;)u++;let g=`
2023-11-09 17:30:33 +08:00
2024-02-26 20:05:21 +08:00
`;r==0&&(g="");let m=`
2023-11-09 17:30:33 +08:00
2024-06-12 15:46:38 +08:00
`;u==d&&(m=""),e=de(e,r,u,g+l.join(`
2023-11-09 17:30:33 +08:00
2024-02-26 20:05:21 +08:00
`)+m)}return t&&!e.endsWith(`
2023-11-09 17:30:33 +08:00
`)&&(e+=`
2024-07-08 15:37:38 +08:00
`),e}function Ju(e){let t=xe("link",e);for(let i of t){if(i==null)continue;let n=e.substring(i.start.offset,i.end.offset);if(!n.match(gr))continue;let r=n.indexOf("]"),a=n.substring(0,1)+n.substring(1,r).trim()+n.substring(r);e=de(e,i.start.offset,i.end.offset,a)}return e}function Xu(e,t){let i=xe("emphasis",e);for(let n of i){let r=e.substring(n.start.offset+1,n.end.offset-1);r=t(r),e=de(e,n.start.offset+1,n.end.offset-1,r)}return e}function ep(e,t){let i=xe("strong",e);for(let n of i){let r=e.substring(n.start.offset+2,n.end.offset-2);r=t(r),e=de(e,n.start.offset+2,n.end.offset-2,r)}return e}function ks(e,t){let i=xb(e);for(let n of i){let r=n.start.offset;for(;r>0&&e.charAt(r-1).trim()==="";)r--;(r===0||e.charAt(r-1).trim()!="")&&r++;let a=e.substring(r,n.end.offset);gp.test(a)&&(r+=4,a=a.substring(4)),a=t(a),e=de(e,r,n.end.offset,a)}return e}function ip(e){let t=xe("code",e);for(let i of t){let n=e.substring(i.start.offset,i.end.offset);!n.startsWith("```")&&!n.startsWith("~~~")||(e=Tt(e,i.start.offset,i.end.offset))}return e}function tp(e,t){let i=xe("math",e);for(let n of i)e=Tt(e,n.start.offset,n.end.offset);i=xe("inlineMath",e);for(let n of i)e.substring(n.start.offset,n.end.offset).startsWith("$".repeat(t))&&(e=Tt(e,n.start.offset,n.end.offset));return e}function np(e){let t=xe("blockquote",e);for(let i of t){let n=i.end.offset;for(;n<e.length-1&&e.charAt(n)!==`
`;)n++;e=Tt(e,i.start.offset,n,!0)}return e}function rp(e,t,i){let n=xe("list",e);if(!n)return e;for(let r of n){let a=r.start.offset;for(;a>0&&e.charAt(a-1)!==`
`;)a--;let s=e.substring(a,r.end.offset),o=function(u){let g=u.lastIndexOf("> ");return g!==-1&&(u=u.substring(g+2)),u=u.replaceAll(" "," "),Math.floor((u.split(" ").length-1)/2)+1},l=new Map,c=function(u,g){let m=g;for(;m>u;)l.delete(m--)},d=-1;s=s.replace(/^(( |\t|> )*)((\d+(\.|\)))|[-*+])([^\n]*)$/gm,(u,g="",m,h,x,b,k)=>{let A=1,L=o(g);if(!/^\d/.test(h)){let C=L>d?L:d;return c(L,C),u}return l.has(L)?t==="ascending"&&(A=l.get(L)+1,l.set(L,A)):l.set(L,1),d>L&&c(L,d),d=L,`${g}${A}${i}${k}`}),e=de(e,a,r.end.offset,s)}return e}function ap(e,t){let i=xe("listItem",e);if(!i)return e;let n=/^((\d+[.)])|(- \[[ x]\]))/m,r=t;if(t=="consistent"){let a=i.length-1;for(;a>=0;){let s=e.substring(i[a].start.offset,i[a].end.offset);if(a--,!s.match(n)){r=s.charAt(0);break}}if(a==-1)return e}for(let a of i){let s=e.substring(a.start.offset,a.end.offset);s.match(n)||(s=r+s.substring(1),e=de(e,a.start.offset,a.end.offset,s))}return e}function Dl(e,t){let i=xe("blockquote",e);for(let n of i){let r=n.end.offset;for(;r<e.length-1&&e.charAt(r)!==`
`;)r++;let a=e.substring(n.start.offset,r);a=t(a),e=de(e,n.start.offset,r,a)}return e}function sp(e,t){let i=xe("math",e),n=new RegExp("^(\\${"+t+",})(\\n*)"),r=new RegExp("(\\n*)(\\${"+t+",})([^\\$]*)$");for(let a of i){let s=e.substring(a.start.offset,a.end.offset),o=Sb(s,t,a.start.offset);for(let l of o)e=$u(e,l.startIndex,l.endIndex,n,r)}i=xe("inlineMath",e);for(let a of i)e.substring(a.start.offset,a.end.offset).startsWith("$".repeat(t))&&(e=$u(e,a.start.offset,a.end.offset,n,r));return e}function Sb(e,t,i){let n="$".repeat(t),r=t;for(;e.charAt(r)==="$";)n+="$",r++;let a=[],s=Xi(e,n);if(s<=1)return[];if(s===2)return a.unshift({startIndex:i,endIndex:i+e.length}),a;s===3&&a.unshift({startIndex:i,endIndex:i+e.indexOf(n,n.length)+n.length}),s%2===1&&s--;let o=i,l=n.length;for(;s>2;){let c=e.indexOf(n,l)+n.length;a.unshift({startIndex:o,endIndex:i+c}),o=i+c+1,l=c+1,s-=2}return a.unshift({startIndex:i+e.indexOf(n,l),endIndex:i+e.length}),a}function $u(e,t,i,n,r){let a=e.substring(ir(e,t),t)??"",[s]=bn(a,a.length),o=e.substring(ir(e,i),i)??"",l=e.substring(t,i),c=cp.test(a.trim()),d=!1;for(l=l.replace(n,(u,g,m="")=>{let h="";return!c&&a.trim()!=""?(h+=`
`,d=!0):c&&!_l.test(a)&&(h+=`
2024-06-12 15:46:38 +08:00
`+s,d=!0),h+=g+`
2024-07-08 15:37:38 +08:00
`,m===""&&c&&(h+=s),h}),l=l.replace(r,(u,g="",m,h)=>{let x=g==="";return x&&c&&_l.test(o.trim())?u:x&&c?`
2024-06-12 15:46:38 +08:00
`+s+m+h:`
2024-07-08 15:37:38 +08:00
`+m+h});d&&t>0;){let u=e[t-1];if(u!==" "&&u!==" ")break;t--}return de(e,t,i,l)}function Ss(e){let t=[...e.matchAll(dp)],i=[];for(let n of t){let r=ir(e,n.index);if(r===0)continue;let a=ir(e,r-1),s=n[0],o=e.substring(r,n.index+s.length);if(Ab(o,s))continue;let l=a,c=e.substring(a,r-1);if(!s.includes("|")&&!c.includes("|"))continue;c=c.replace(Rl,h=>{let x=h.trim();return x===""||x==="|"||(l+=h.length-1),""});let d=s.replace(Rl,"");if(c.endsWith("|")&&(c=c.slice(0,-1)),d.endsWith("|")&&(d=d.slice(0,-1)),Wu(c)!==Wu(d))continue;let u=n.index+n[0].length;if(u>=e.length-1){i.push({startIndex:l,endIndex:e.length});continue}let g=e.substring(u+1).split(`
`),m=0;for(;m<g.length&&up.test(g[m]);)u+=g[m].length+1,m++;i.push({startIndex:l,endIndex:u})}return i.reverse()}function Ab(e,t){if(e.trim()===""||t.includes("||"))return!0;let i=e.replace(t,"");return/[^\s>]/.test(i)}function Wu(e){let t=!1,i=0,n=0,r="";for(let a=0;a<e.length;a++)r=e[a],r==="\\"?(i++,t=i%2==1):(i=0,r==="|"&&!t&&n++,t=!1);return n}function op(e){let t=0,i=[],n=[...e.matchAll(pp)];if(!n||n.length===0)return i;let r=[...e.matchAll(mp)];return n.forEach(a=>{t=a.index;let s=!1,o=e.length-1;for(;r&&r.length!==0&&!s;)if(r[0].index<=t)r.shift();else{s=!0;let l=r[0];o=l.index+l[0].length}i.push({startIndex:t,endIndex:o}),!r||r.length}),i.reverse()}function lp(e,t){let i=xe("code",e);for(let n of i){let r=e.substring(n.start.offset,n.end.offset);!r.startsWith("```")||r.substring(3,r.indexOf(`
`)).trim()!==""||(e=de(e,n.start.offset+3,n.start.offset+3,t))}return e}var rt=/^([ \t]*)(#+)([ \t]+)([^\n\r]*?)([ \t]+#+)?$/gm,hp=`^XXX\\.*?
2023-11-09 17:30:33 +08:00
(?:((?:.|
)*?)
2024-07-08 15:37:38 +08:00
)?XXX(?=\\s|$)$`,Je=/^---\n((?:(((?!---)(?:.|\n)*?)\n)?))---(?=\n|$)/,Tb=hp.replaceAll("X","`"),zb=hp.replaceAll("X","~"),Lb=`^(( |( {4})).*
)+`,P0=new RegExp(`${Tb}|${zb}|${Lb}`,"gm"),zs=/(!?)\[{2}([^\][\n|]+)(\|([^\][\n|]+))?(\|([^\][\n|]+))?\]{2}/g,gr=/(!?)\[([^[]*)\](\(.*\))/g,hr=/(\s|^)(#[\p{L}\-_\d/]+)/gu,fp=/^%%\n[^%]*\n%%/gm,fr=/[,\s]+/,Ls=/(\. ?){2}\./g,yr="\\s*(>\\s*)*",_l=/^(>( |\t)*)+\$*?$/m,cp=/^\s*(>\s*)+/m,dp=/(\|? *:?-{1,}:? *\|?)(\| *:?-{1,}:? *\|?)*( |\t)*$/gm,Rl=/^(((>[ ]?)*)|([ ]{0,3}))\|/m,up=/[^\n]*?\|[^\n]*?(\n|$)/m,yp=/(([a-z\-0-9]+:)\/{2,3})([^\s/?#]*[^\s")'.?!/]|[/])?(([/?#][^\s")']*[^\s")'.?!])|[/])?/gi,kn=/(?:(?:(?:[a-z]+:)?\/\/)|www\.)(?:localhost|(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?|(?:(?:[a-z0-9][-_]*)*[a-z0-9]+)(?:\.(?:[a-z0-9]-*)*[a-z0-9]+)*(?:\.(?:[a-z]{2,})))(?::\d{2,5})?(?:(?:[/?#][a-z0-9-_%/&=?$.+~!*(,#@]*[a-z0-9-%_/$+~!*(,])|[/])?/gi,bp=/<a[\s]+([^>]+)>((?:.(?!<\/a>))*.)<\/a>/g,vp=/[\p{L}\p{N}\p{Pc}\p{M}\-'`]+/gu,xp=/&[^\s]+;$/mi,pp=Ep(!0),mp=Ep(!1),wp=/[“”„«»]/g,kp=/[]/g,Sp=/<%[^]*?%>/g,Ot="\\[.\\]",gp=new RegExp(`^${Ot}`),Ap=new RegExp(`^${yr}- ${Ot} `),Es=new RegExp(`^\\s*- ${Ot} `),As=new RegExp(`^\\s*(-|\\*|\\+|\\d+[.)]|- (${Ot}))`,"m"),Ts=/^(\[\^[^\]]*\]) ?([,.;!:?])/gm,os=/^(>\s*)+\[![^\s]*\]/m,er=/^\n?(>\s*)+((```)|(~~~))/m,Kl=RegExp(/\p{L}/,"u");function Xe(e){return e.replace(/\$/g,"$$$$")}function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tp(e){let t=e.match(zs);if(t){for(let i of t)if(i.includes("|")){let n=i.indexOf("|"),r=i.substring(0,n+1)+i.substring(n+1,i.length-2).trim()+"]]";e=e.replace(i,r)}}return e}function zp(e){let t=Ss(e);if(t.length===0)return e;for(let i of t)e=Tt(e,i.startIndex,i.endIndex);return e}function Os(e){let t=e.match(/^#\s+(.*)/m);if(t&&t[1]){let i=t[1];return i=i.replaceAll(zs,(n,r,a,s)=>s!=null?s.replace("|",""):a),i.replaceAll(gr,"$2")}return""}function Lp(e){return[...e.matchAll(hr)].map(t=>t[2])}function Ep(e){let t="<!-{2,} *linter-{ENDING_TEXT} *-{2,}>",i="";return e?i+="disable":i+="enable",new RegExp(t.replace("{ENDING_TEXT}",i),"g")}var Nl="tag",br="tags",vi=[Nl,br],Eb="alias",Yl="aliases",xi=[Eb,Yl],jl="linter-yaml-title-alias",Sn="disabled rules";function Ci(e){return e.match(Je)===null&&(e=`---
2023-11-09 17:30:33 +08:00
---
2024-07-08 15:37:38 +08:00
`+e),e}function An(e){let t=e.match(Je);return t?t[1]:null}function ye(e,t){if(!e.match(Je))return e;let i=e.match(Je)[0],n=t(i);return e=e.replace(i,Xe(n)),e}function Pl(e,t=!0){return t?new RegExp(`^([\\t ]*)${e}:[ \\t]*(\\S.*|(?:(?:\\n *- \\S.*)|((?:\\n *- *))*|(\\n([ \\t]+[^\\n]*))*)*)\\n`,"m"):new RegExp(`^${e}:[ \\t]*(\\S.*|(?:(?:\\n *- \\S.*)|((?:\\n *- *))*|(\\n([ \\t]+[^\\n]*))*)*)\\n`,"m")}function oe(e,t,i){let n=`${t}:${i}
`,r=!1,a=e.replace(Pl(t),(s,o)=>(r=!0,o+n));return r||(a=`${e}${n}`),a}function pe(e,t,i=!0){let n=e.match(Pl(t,i));if(n==null)return null;let r=n[2];return i||(r=n[1]),r}function Ct(e,t,i=!0){return e.replace(Pl(t,i),"")}function oi(e){if(e==null)return null;let t=Vo(e.replace(/\n(\t)+/g,`
`));return t??{}}function we(e,t,i,n,r=!1){if(typeof e=="string"&&(e=[e]),e==null||e.length===0)return Ob(t);let a=n&&(t=="multi-line"||t=="single string to multi-line"&&e.length>1);if(r||a)for(let s=0;s<e.length;s++){let o=e[s],l=Tn(o);l&&(o=o.substring(1,o.length-1));let c=r&&ss(o);l&&c||(c||l&&a)&&(e[s]=wi(o,i,c))}switch(t){case"single string to single-line":if(e.length===1)return" "+e[0];case"single-line":return" "+Op(e);case"single string to multi-line":if(e.length===1)return" "+e[0];case"multi-line":return Cb(e);case"single string space delimited":return e.length===1?" "+e[0]:" "+e.join(" ");case"single string comma delimited":return e.length===1?" "+e[0]:" "+e.join(", ");case"single-line space delimited":return e.length===1?" "+e[0]:" "+Op(e).replaceAll(", "," ")}}function Ob(e){switch(e){case"single-line":case"single-line space delimited":case"multi-line":return" []";case"single string to single-line":case"single string to multi-line":case"single string space delimited":case"single string comma delimited":return" "}}function Op(e){return e==null||e.length===0?"[]":"["+e.join(", ")+"]"}function Cb(e){return e==null||e.length===0?"[]":`
2023-11-09 17:30:33 +08:00
- `+e.join(`
2024-07-08 15:37:38 +08:00
- `)}function Fe(e){if(e==null||e.length===0)return null;if(e=e.trimEnd(),e.startsWith("["))return e=e.substring(1),e.endsWith("]")&&(e=e.substring(0,e.length-1)),e.length===0?null:Cs(e,",").filter(i=>i!="");if(e.includes(`
`)){let t=e.split(/[ \t]*\n[ \t]*-[ \t]*/);return t.splice(0,1),t=t.filter(i=>i!=""),t==null||t.length===0?null:t}return e}function st(e){if(e==null)return[];let t=[],i=[];Array.isArray(e)?i=e:e.includes(",")?i=Cs(e,","):i=Cs(e," ");for(let n of i)t.push(n.trim());return t}function ot(e){return typeof e=="string"?Cs(e,","):e}function Cs(e,t=","){if(e==""||e==null)return null;if(t.length>1)throw new Error(E("logs.invalid-delimiter-error-message"));let i=[],n="",r=0;for(;r<e.length;){let a=e.charAt(r);if(a===t)i.push(n.trim()),n="";else if(a==='"'||a==="'"){let s=e.indexOf(a,r+1);s!=-1?(n+=e.substring(r,s+1),r=s):n+=a}else n+=a;r++}return n.trim()!=""&&i.push(n.trim()),i}function Tn(e){return e.length>1&&(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))}function wi(e,t,i=!1,n=!1){let r=Mb(e,t,i);if(n)return r;try{if(Vo(r)===e)return r}catch{}let a=Go(e,{lineWidth:-1,quotingType:t,forceQuotes:i}).slice(0,-1),s=Go(e,{lineWidth:-1,quotingType:t=='"'?"'":'"',forceQuotes:i}).slice(0,-1);return s===e||s.length<a.length?s:a}function Mb(e,t,i=!1){if(Tn(e))return e;let n=e.includes("'"),r=e.includes('"'),a=e.includes(": ");return!n&&!r&&!a&&!i||n&&r?e:n?`"${e}"`:r?`'${e}'`:`${t}${e}${t}`}function Cp(e){let t=pe(e,Sn);if(t==null)return[];let i=t.includes(`
2024-06-12 15:46:38 +08:00
`)?`${Sn}:
2024-07-08 15:37:38 +08:00
`:`${Sn}: `;i+=t;let r=oi(i)["disabled rules"];return r?(typeof r=="string"&&(r=[r]),r):[]}var Ln=require("obsidian");var Mp=require("obsidian");function Mi(e,t,i){Mp.MarkdownRenderer.renderMarkdown(e,t,"",i);let n=t.innerHTML.trim();n.startsWith("<p>")&&(n=n.substring(3)),n.endsWith("</p>")&&(n=n.substring(0,n.length-4)),t.innerHTML=n}function pi(e){e.addClass("linter-visually-hidden")}function qi(e){e.removeClass("linter-visually-hidden")}var Mt=class{constructor(t,i,n,r,a){this.configKey=t;this.nameKey=i;this.descriptionKey=n;this.defaultValue=r;a&&(this.ruleAlias=a)}getName(){return E(this.nameKey)??""}getDescription(){return E(this.descriptionKey)??""}getSearchInfo(){return{name:this.getName(),description:this.getDescription()}}setOption(t,i){i.ruleConfigs[this.ruleAlias][this.configKey]=t}parseNameAndDescriptionAndRemoveSettingBorder(t,i){Mi(this.getName(),t.nameEl,i.settingsTab.component),Mi(this.getDescription(),t.descEl,i.settingsTab.component),t.settingEl.addClass("linter-no-border")}},zn=class extends Mt{display(t,i,n){let r=new Ln.Setting(t).addToggle(a=>{a.setValue(i.ruleConfigs[this.ruleAlias][this.configKey]),a.onChange(s=>{this.setOption(s,i),n.settings=i,n.saveSettings()})});this.parseNameAndDescriptionAndRemoveSettingBorder(r,n)}},vr=class extends Mt{display(t,i,n){let r=new Ln.Setting(t).addText(a=>{a.setValue(i.ruleConfigs[this.ruleAlias][this.configKey]),a.onChange(s=>{this.setOption(s,i),n.settings=i,n.saveSettings()})});this.parseNameAndDescriptionAndRemoveSettingBorder(r,n)}},Ms=class extends Mt{display(t,i,n){let r=new Ln.Setting(t).addTextArea(a=>{a.setValue(i.ruleConfigs[this.ruleAlias][this.configKey]),a.onChange(s=>{this.setOption(s,i),n.settings=i,n.saveSettings()})});this.parseNameAndDescriptionAndRemoveSettingBorder(r,n)}},qs=class extends Mt{display(t,i,n){let r=new Ln.Setting(t).addMomentFormat(a=>{a.setValue(i.ruleConfigs[this.ruleAlias][this.configKey]),a.setPlaceholder("dddd, MMMM Do YYYY, h:mm:ss a"),a.onChange(s=>{this.setOption(s,i),n.settings=i,n.saveSettings()})});this.parseNameAndDescriptionAndRemoveSettingBorder(r,n)}},Is=class{constructor(t,i){this.value=t,this.description=i}getDisplayValue(){return E(this.value)??""}},Bs=class extends Mt{constructor(t,i,n,r,a,s){super(t,i,n,r,s),this.options=a}getSearchInfo(){return{name:this.getName(),description:this.getDescription(),options:this.options}}display(t,i,n){let r=new Ln.Setting(t).addDropdown(a=>{for(let s of this.options)a.addOption(s.value.replace("enums.",""),s.getDisplayValue());a.setValue(i.ruleConfigs[this.ruleAlias][this.configKey]),a.onChange(s=>{this.setOption(s,i),n.settings=i,n.saveSettings()})});this.parseNameAndDescriptionAndRemoveSettingBorder(r,n)}};var En=class e extends Error{constructor(t,i){super(t),this.cause=i??null,this.stack=i.stack??null,Object.setPrototypeOf(this,e.prototype)}};var f={code:{replaceAction:"code",placeholder:"{CODE_BLOCK_PLACEHOLDER}"},inlineCode:{replaceAction:"inlineCode",placeholder:"{INLINE_CODE_BLOCK_PLACEHOLDER}"},image:{replaceAction:"image",placeholder:"{IMAGE_PLACEHOLDER}"},thematicBreak:{replaceAction:"thematicBreak",placeholder:"{HORIZONTAL_RULE_PLACEHOLDER}"},italics:{replaceAction:"emphasis",placeholder:"{ITALICS_PLACEHOLDER}"},bold:{replaceAction:"strong",placeholder:"{STRONG_PLACEHOLDER}"},list:{replaceAction:"list",placeholder:"{LIST_PLACEHOLDER}"},blockquote:{replaceAction:"blockquote",placeholder:"{BLOCKQUOTE_PLACEHOLDER}"},math:{replaceAction:"math",placeholder:"{MATH_PLACEHOLDER}"},inlineMath:{replaceAction:"inlineMath",placeholder:"{INLINE_MATH_PLACEHOLDER}"},html:{replaceAction:"html",placeholder:"{HTML_PLACEHOLDER}"},yaml:{replaceAction:Je,placeholder:Xe(`---
---`)},wikiLink:{replaceAction:zs,placeholder:"{WIKI_LINK_PLACEHOLDER}"},obsidianMultiLineComments:{replaceAction:fp,placeholder:"{OBSIDIAN_COMMENT_PLACEHOLDER}"},footnoteAtStartOfLine:{replaceAction:Ts,placeholder:"{FOOTNOTE_AT_START_OF_LINE_PLACEHOLDER}"},footnoteAfterATask:{replaceAction:/- \[.] (\[\^\w+\]) ?([,.;!:?])/gm,placeholder:"{FOOTNOTE_AFTER_A_TASK_PLACEHOLDER}"},url:{replaceAction:kn,placeholder:"{URL_PLACEHOLDER}"},anchorTag:{replaceAction:bp,placeholder:"{ANCHOR_PLACEHOLDER}"},templaterCommand:{replaceAction:Sp,placeholder:"{TEMPLATER_PLACEHOLDER}"},link:{replaceAction:Bb,placeholder:"{REGULAR_LINK_PLACEHOLDER}"},tag:{replaceAction:Fb,placeholder:"#tag-placeholder"},table:{replaceAction:_b,placeholder:"{TABLE_PLACEHOLDER}"},customIgnore:{replaceAction:Rb,placeholder:"{CUSTOM_IGNORE_PLACEHOLDER}"}};function Ee(e,t,i){let n=[];for(let r of e){let a;if(typeof r.replaceAction=="string")a=qb(t,r.placeholder,r.replaceAction);else if(r.replaceAction instanceof RegExp)a=Ib(t,r.placeholder,r.replaceAction);else if(typeof r.replaceAction=="function"){let s=r.replaceAction;a=s(t,r.placeholder)}t=a.newText,n.push({replacedValues:a.replacedValues,placeholder:r.placeholder})}return t=i(t),n=n.reverse(),n!=null&&n.length>0&&n.forEach(r=>{r.replacedValues.forEach(a=>{t=t.replace(new RegExp(r.placeholder,"i"),Xe(a))})}),t}function qb(e,t,i){let n=xe(i,e),r=[];for(let a of n){let s=e.substring(a.start.offset,a.end.offset);r.push(s),e=de(e,a.start.offset,a.end.offset,t)}return r.reverse(),{newText:e,replacedValues:r}}function Ib(e,t,i){let n=e.match(i),r=[];if(i.flags.includes("g")){if(e=e.replaceAll(i,t),n)for(let a of n)r.push(a)}else e=e.replace(i,t),n&&r.push(n[0]);return{newText:e,replacedValues:r}}function Bb(e,t){let i=xe("link",e),n=[];for(let r of i){if(r==null)continue;let a=e.substring(r.start.offset,r.end.offset);a.match(gr)&&(n.push(a),e=de(e,r.start.offset,r.end.offset,t))}return n.reverse(),{newText:e,replacedValues:n}}function Fb(e,t){let i=[];return e=e.replace(hr,(n,r,a)=>(i.push(a),r+t)),{newText:e,replacedValues:i}}function _b(e,t){let i=Ss(e),n=new Array(i.length),r=0,a=n.length;for(let s of i)n[a-1-r++]=e.substring(s.startIndex,s.endIndex),e=de(e,s.startIndex,s.endIndex,t);return{newText:e,replacedValues:n}}function Rb(e,t){let i=op(e),n=new Array(i.length),r=0,a=n.length;for(let s of i)n[a-1-r++]=e.substring(s.startIndex,s.endIndex),e=de(e,s.startIndex,s.endIndex,t);return{newText:e,replacedValues:n}}var D=(s=>(s.YAML="YAML",s.HEADING="Heading",s.FOOTNOTE="Footnote",s.CONTENT="Content",s.SPACING="Spacing",s.PASTE="Paste",s))(D||{}),Fs=class{constructor(t,i,n,r,a,s,o,l=[],c=!1,d=[]){this.nameKey=t;this.descriptionKey=i;this.settingsKey=n;this.alias=r;this.type=a;this.applyAfterIgnore=s;this.examples=o;this.options=l;this.hasSpecialExecutionOrder=c;this.ignoreTypes=d;this.ruleHeading=this.getName().toLowerCase().replaceAll(" ","-"),l.unshift(new zn("enabled",this.descriptionKey,"",!1));for(let u of l)u.ruleAlias=r}getDefaultOptions(){let t={};for(let i of this.options)t[i.configKey]=i.defaultValue;return t}getOptions(t){return t.ruleConfigs[this.settingsKey]}getName(){return E(this.nameKey)}getDescription(){return E(this.descriptionKey)}getURL(){return"https://platers.github.io/obsidian-linter/settings/"+this.type.toLowerCase()+"-rules/#"+this.ruleHeading}enabledOptionName(){return this.options[0].configKey}apply(t,i){return Ee(this.ignoreTypes,t,n=>this.applyAfterIgnore(n,i))}},_s=class{constructor(t,i,n,r={}){this.description=t,this.options=r,this.before=i,this.after=n}},Ip=Object.values(D);function Rs(e){let t=An(e);if(t===null)return[[],!1];let i=Cp(t);return i.includes("all")?[Ii.map(n=>n.alias),!0]:[i,!1]}var Ii=[],Db={},qt=new Map;function Bp(e){Ii.push(e),Ii.sort((t,i)=>Ip.indexOf(t.type)-Ip.indexOf(i.type)||t.settingsKey.localeCompare(i.settingsKey)),Db[e.alias]=e,qt.has(e.type)?qt.get(e.type).push(e):qt.set(e.type,[e])}function Ds(e,t){let i;throw e instanceof Ld?(i=e.toString(),i=E("logs.wrapper-yaml-error").replace("{ERROR_MESSAGE}",i.substring(i.indexOf(":")+1))):i=E("logs.wrapper-unknown-e
2023-11-09 17:30:33 +08:00
[ ]{`+Math.min.apply(Math,r)+"}","g");n=n.map(function(o){return o.replace(a,`
2023-12-10 12:54:30 +08:00
`)})}n[0]=n[0].replace(/^\r?\n/,"");var s=n[0];return t.forEach(function(o,l){var c=s.match(/(?:^|\n)( *)$/),d=c?c[1]:"",u=o;typeof o=="string"&&o.includes(`
2023-11-09 17:30:33 +08:00
`)&&(u=String(o).split(`
2024-02-26 20:05:21 +08:00
`).map(function(g,m){return m===0?g:""+d+g}).join(`
2024-07-08 15:37:38 +08:00
`)),s+=u+n[l+1]}),s}var p=Kb;var Mo=require("obsidian");var Cn,xr,lt,ei=class ei{static getRule(){if(!Y(ei,Cn).has(this.name)){let t=new this,i=new Fs(t.nameKey,t.descriptionKey,t.settingsKey,t.alias,t.type,t.safeApply.bind(t),t.exampleBuilders.map(n=>n.example),t.optionBuilders.map(n=>n.option),t.hasSpecialExecutionOrder,t.ignoreTypes);Y(ei,Cn).set(this.name,i),Y(ei,xr).set(t.alias,t)}return Y(ei,Cn).get(this.name)}static applyIfEnabledBase(t,i,n,r){let a=t.getOptions(n);if(a[t.enabledOptionName()]){St(t.alias);let s=Object.assign({},a,r);ri(`${E("logs.run-rule-text")} ${t.getName()}`);try{let o=t.apply(i,s);return Ji(t.alias),ri(o),[o,!0]}catch(o){Ji(t.alias),Ds(o,t.getName())}}else return[i,!1]}static getBuilderByName(t){return Y(ei,xr).get(t)}static setNoSettingControl(t,i){Y(ei,lt).has(t)||Y(ei,lt).set(t,[]),Y(ei,lt).get(t).push(i)}static hasSettingControl(t,i){return!Y(ei,lt).has(t)||!Y(ei,lt).get(t).includes(i)}};Cn=new WeakMap,xr=new WeakMap,lt=new WeakMap,ve(ei,Cn,new Map),ve(ei,xr,new Map),ve(ei,lt,new Map);var ct=ei,v=class extends ct{constructor(t){super(),this.alias=t.nameKey.replace(/rules\.(.*)\.name/,"$1"),this.settingsKey=t.nameKey.replace(/rules\.(.*)\.name/,"$1"),this.nameKey=t.nameKey,this.descriptionKey=t.descriptionKey,this.type=t.type,this.hasSpecialExecutionOrder=t.hasSpecialExecutionOrder??!1,t.ruleIgnoreTypes?this.ignoreTypes=[f.customIgnore,...t.ruleIgnoreTypes]:this.ignoreTypes=[f.customIgnore]}static register(t){let i=t.getRule();Bp(i)}safeApply(t,i){return this.apply(t,this.buildRuleOptions(i))}buildRuleOptions(t){t=t??{};let i=new this.OptionsClass,n=Object.assign(i,t);for(let r of this.optionBuilders)r.setRuleOption(n,t);return n}static applyIfEnabled(t,i,n,r){let a=this.getRule();return n.includes(a.alias)?(ri(a.alias+" "+E("logs.disabled-text")),[t,!1]):ct.applyIfEnabledBase(a,t,i,r)}static getRuleOptions(t){let i=ct.getRule.bind(this)(),n=new this,r=i.getOptions(t);return n.buildRuleOptions(r)}static noSettingControl(){return(t,i)=>{let n=t.constructor.name;ct.setNoSettingControl(n,i)}}},Hl,y=class{constructor(t){ve(this,Hl,void 0);this.example=new _s(t.description,t.before,t.after,t.options)}};Hl=new WeakMap;var Mn,dt=class{constructor(t){ve(this,Mn,void 0);this.OptionsClass=t.OptionsClass;let i=t.nameKey.split(".");i.length==1?this.configKey=i[0]:this.configKey=i[i.length-2],this.nameKey=t.nameKey,this.descriptionKey=t.descriptionKey,this.optionsKey=t.optionsKey}get defaultValue(){return new this.OptionsClass()[this.optionsKey]}get option(){return Y(this,Mn)||Be(this,Mn,this.buildOption()),Y(this,Mn)}setRuleOption(t,i){let n=i[this.configKey];n!==void 0&&(t[this.optionsKey]=n)}};Mn=new WeakMap;var W=class extends dt{buildOption(){return new zn(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},Ks=class extends dt{buildOption(){return new vr(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},ie=class extends dt{constructor(t){super(t),this.records=t.records.map(i=>new Is("enums."+i.value,i.description))}buildOption(){return new Bs(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue,this.records)}},me=class extends dt{constructor(t){super(t),this.separator=t.separator??`
`,this.splitter=t.splitter??/\n/}buildOption(){return new Ms(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue.join(this.separator))}setRuleOption(t,i){if(i[this.configKey]!==void 0){let n=i[this.configKey].split(this.splitter).filter(function(r){return r!=""});t[this.optionsKey]=n}}},ke=class extends dt{buildOption(){return new vr(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}},Ns=class extends dt{buildOption(){return new qs(this.configKey,this.nameKey,this.descriptionKey,this.defaultValue)}};var $l=class{},wr=class extends v{constructor(){super({nameKey:"rules.add-blank-line-after-yaml.name",descriptionKey:"rules.add-blank-line-after-yaml.description",type:"YAML"})}get OptionsClass(){return $l}apply(t,i){let n=t.match(Je);if(n===null)return t;let r=n[0],a=t.indexOf(r)+r.length;return a+1>=t.length||t.trimEnd()===r.trimEnd()||t.charAt(a+1)===`
2023-12-10 12:54:30 +08:00
`?t:t.replace(r,r+`
2024-07-08 15:37:38 +08:00
`)}get exampleBuilders(){return[new y({description:"A file with just YAML in it does not get a blank line after the YAML",before:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"A file with YAML followed directly by content has an empty line added",before:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
Here is some text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
${""}
Here is some text
2024-07-08 15:37:38 +08:00
`}),new y({description:"A file with YAML that already has a blank line after it and before content has no empty line added",before:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
${""}
Here is some text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
---
key: value
---
${""}
Here is some text
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};wr=T([v.register],wr);var Wl=new Map([["1nd","1st"],["2rd","2nd"],["2st","2nd"],["3nd","3rd"],["3st","3rd"],["4rd","4th"],["a-diaerers","a-diaereses"],["aaccess","access"],["aaccessibility","accessibility"],["aaccession","accession"],["aack","ack"],["aactual","actual"],["aactually","actually"],["aadd","add"],["aagain","again"],["aaggregation","aggregation"],["aanother","another"],["aapply","apply"],["aaproximate","approximate"],["aaproximated","approximated"],["aaproximately","approximately"],["aaproximates","approximates"],["aaproximating","approximating"],["aare","are"],["aassign","assign"],["aassignment","assignment"],["aassignments","assignments"],["aassociated","associated"],["aassumed","assumed"],["aautomatic","automatic"],["aautomatically","automatically"],["abailable","available"],["abanden","abandon"],["abandonded","abandoned"],["abandone","abandon"],["abandonned","abandoned"],["abandonning","abandoning"],["abbbreviated","abbreviated"],["abberation","aberration"],["abberations","aberrations"],["abberivates","abbreviates"],["abberration","aberration"],["abborted","aborted"],["abborting","aborting"],["abbrevate","abbreviate"],["abbrevation","abbreviation"],["abbrevations","abbreviations"],["abbreviaton","abbreviation"],["abbreviatons","abbreviations"],["abbriviate","abbreviate"],["abbriviation","abbreviation"],["abbriviations","abbreviations"],["aberation","aberration"],["abigious","ambiguous"],["abiguity","ambiguity"],["abilityes","abilities"],["abilties","abilities"],["abilty","ability"],["abiss","abyss"],["abitrarily","arbitrarily"],["abitrary","arbitrary"],["abitrate","arbitrate"],["abitration","arbitration"],["abizmal","abysmal"],["abnoramlly","abnormally"],["abnormalty","abnormally"],["abnormaly","abnormally"],["abnornally","abnormally"],["abnove","above"],["abnrormal","abnormal"],["aboluste","absolute"],["abolustely","absolutely"],["abolute","absolute"],["abondon","abandon"],["abondoned","abandoned"],["abondoning","abandoning"],["abondons","abandons"],["aboout","about"],["aborigene","aborigine"],["abortificant","abortifacient"],["aboslute","absolute"],["aboslutely","absolutely"],["abosulte","absolute"],["abosultely","absolutely"],["abosulute","absolute"],["abosulutely","absolutely"],["abotu","about"],["abount","about"],["aboutit","about it"],["aboutthe","about the"],["abouve","above"],["abov","above"],["aboved","above"],["abovemtioned","abovementioned"],["aboves","above"],["abovmentioned","abovementioned"],["abreviate","abbreviate"],["abreviated","abbreviated"],["abreviates","abbreviates"],["abreviating","abbreviating"],["abreviation","abbreviation"],["abreviations","abbreviations"],["abritrarily","arbitrarily"],["abritrary","arbitrary"],["abriviate","abbreviate"],["absail","abseil"],["absailing","abseiling"],["absance","absence"],["abscence","absence"],["abscound","abscond"],["abselutely","absolutely"],["abselutly","absolutely"],["absense","absence"],["absodefly","absolute"],["absodeflyly","absolutely"],["absolate","absolute"],["absolately","absolutely"],["absolaute","absolute"],["absolautely","absolutely"],["absoleted","obsoleted"],["absoletely","absolutely"],["absoliute","absolute"],["absoliutely","absolutely"],["absoloute","absolute"],["absoloutely","absolutely"],["absolte","absolute"],["absoltely","absolutely"],["absoltue","absolute"],["absoltuely","absolutely"],["absoluate","absolute"],["absoluately","absolutely"],["absolue","absolute"],["absoluely","absolutely"],["absoluet","absolute"],["absoluetly","absolutely"],["absolule","absolute"],["absolulte","absolute"],["absolultely","absolutely"],["absolune","absolute"],["absolunely","absolutely"],["absolure","absolute"],["absolurely","absolutely"],["absolut","absolute"],["absolutelly","absolutely"],["absoluth","absolute"],["absoluthe","absolute"],["absoluthely","absolutely"],["absoluthly","absolutely"],["absolutley","absolutely"],["absolutly","absolutely"],["absolutlye","absolutely"],["absoluute","absolute"],["absoluutely","absolutely"],["absoluve","absolute"],["absoluvely","absolutely"],["absoolute","absolute"
2023-11-09 17:30:33 +08:00
---
key: absoltely
---
${""}
I absoltely hate when my codeblocks get formatted when they should not be.
${""}
\`\`\`
# comments absoltely can be helpful, but they can also be misleading
\`\`\`
${""}
Note that inline code also has the applicable spelling errors ignored: \`absoltely\`
${""}
$$
Math block absoltely does not get auto-corrected.
$$
${""}
The same $ defenately $ applies to inline math.
${""}
#defenately stays the same
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: absoltely
---
${""}
I absolutely hate when my codeblocks get formatted when they should not be.
${""}
\`\`\`
# comments absoltely can be helpful, but they can also be misleading
\`\`\`
${""}
Note that inline code also has the applicable spelling errors ignored: \`absoltely\`
${""}
$$
Math block absoltely does not get auto-corrected.
$$
${""}
The same $ defenately $ applies to inline math.
${""}
#defenately stays the same
2024-07-08 15:37:38 +08:00
`}),new y({description:"Auto-correct misspellings keeps first letter's case",before:p`
2023-11-09 17:30:33 +08:00
Accodringly we made sure to update logic to make sure it would handle case sensitivity.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Accordingly we made sure to update logic to make sure it would handle case sensitivity.
2024-07-08 15:37:38 +08:00
`}),new y({description:"Links should not be auto-corrected",before:p`
2023-11-09 17:30:33 +08:00
http://www.Absoltely.com should not be corrected
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
http://www.Absoltely.com should not be corrected
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[new me({OptionsClass:Ys,nameKey:"rules.auto-correct-common-misspellings.ignore-words.name",descriptionKey:"rules.auto-correct-common-misspellings.ignore-words.description",optionsKey:"ignoreWords",splitter:fr,separator:", "})]}};kr=T([v.register],kr);var js=class{constructor(){this.style="space"}},It=class extends v{constructor(){super({nameKey:"rules.blockquote-style.name",descriptionKey:"rules.blockquote-style.description",type:"Content",hasSpecialExecutionOrder:!0,ruleIgnoreTypes:[f.html,f.code,f.math]})}get OptionsClass(){return js}apply(t,i){return i.style==="space"?Dl(t,n=>this.updateBlockquoteLines(n,this.addSpaceToIndicator)):Dl(t,n=>this.updateBlockquoteLines(n,this.removeSpaceFromIndicator))}removeSpaceFromIndicator(t,i){return i?t.replace(/>[ \t]+>/g,">>"):t.replace(/>[ \t]+/g,">")}addSpaceToIndicator(t,i){let n=t.replace(/>([^ ]|$)/g,"> $1").replace(/>>/g,"> >");return i?n:n.replace(/>(?:[ \t]{2,}|\t+)/g,"> ")}updateBlockquoteLines(t,i){let n=0,r=0,a="",s="",o=0,l=t,c=!1;do{r=l.indexOf(`
`,n),r===-1&&(r=l.length-1,c=!0),[a,o]=bn(l,r-1);let d=o+a.length+1,u=r;c&&u++;let g=l.substring(d,u);if(g.includes(f.math.placeholder)||g.includes(f.code.placeholder)){n++;continue}let m=As.test(g);s=i(a,m),o++,l=de(l,o,o+a.length,s),n=r+1+s.length-a.length}while(!c);return l}get exampleBuilders(){return[new y({description:"When style = `space`, a space is added to blockquotes missing a space after the indicator",before:p`
2023-11-09 17:30:33 +08:00
>Blockquotes will have a space added if one is not present
> Will be left as is.
${""}
> Nested blockquotes are also updated
>>Nesting levels are handled correctly
>> Even when only partially needing updates
> >Updated as well
>>>>>>> Is handled too
> > >>> As well
${""}
> <strong>Note that html is not affected in blockquotes</strong>
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> Blockquotes will have a space added if one is not present
> Will be left as is.
${""}
> Nested blockquotes are also updated
> > Nesting levels are handled correctly
> > Even when only partially needing updates
> > Updated as well
> > > > > > > Is handled too
> > > > > As well
${""}
> <strong>Note that html is not affected in blockquotes</strong>
2024-07-08 15:37:38 +08:00
`}),new y({description:"When style = `no space`, spaces are removed after a blockquote indicator",before:p`
2023-11-09 17:30:33 +08:00
> Multiple spaces are removed
> > Nesting is handled
> > > > > Especially when multiple levels are involved
> >>> > Even when partially correct already, it is handled
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
>Multiple spaces are removed
>>Nesting is handled
>>>>>Especially when multiple levels are involved
>>>>>Even when partially correct already, it is handled
2024-07-08 15:37:38 +08:00
`,options:{style:"no space"}})]}get optionBuilders(){return[new ie({OptionsClass:js,nameKey:"rules.blockquote-style.style.name",descriptionKey:"rules.blockquote-style.style.description",optionsKey:"style",records:[{value:"space",description:"> indicator is followed by a space"},{value:"no space",description:">indicator is not followed by a space"}]})]}};It=T([v.register],It);var Ps=class{};T([v.noSettingControl()],Ps.prototype,"lineContent",2);var Bt=class extends v{constructor(){super({nameKey:"rules.add-blockquote-indentation-on-paste.name",descriptionKey:"rules.add-blockquote-indentation-on-paste.description",type:"Paste"})}get OptionsClass(){return Ps}apply(t,i){let n=/^(\s*)((> ?)+) .*/,r=i.lineContent.match(n);if(!r)return t;let a=r[1]??"",s=r[2]??"";return t.trim().replace(/\n/gm,`
${a}${s} `)}get exampleBuilders(){return[new y({description:"Line being pasted into regular text does not get blockquotified with current line being `Part 1 of the sentence`",before:p`
2023-11-09 17:30:33 +08:00
was much less likely to succeed, but they tried it anyway.
Part 2 was much more interesting.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
was much less likely to succeed, but they tried it anyway.
Part 2 was much more interesting.
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"Part 1 of the sentence"}}),new y({description:"Line being pasted into a blockquote gets blockquotified with current line being `> > `",before:p`
2023-11-09 17:30:33 +08:00
${""}
This content is being added to a blockquote
Note that the second line is indented and the surrounding blank lines were trimmed
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
This content is being added to a blockquote
> > Note that the second line is indented and the surrounding blank lines were trimmed
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"> > "}})]}get optionBuilders(){return[]}};Bt=T([v.register],Bt);var Ft=class{constructor(){this.style="Title Case";this.ignoreWords=["macOS","iOS","iPhone","iPad","JavaScript","TypeScript","AppleScript","I"];this.lowercaseWords=["a","an","the","aboard","about","abt.","above","abreast","absent","across","after","against","along","aloft","alongside","amid","amidst","mid","midst","among","amongst","anti","apropos","around","round","as","aslant","astride","at","atop","ontop","bar","barring","before","B4","behind","below","beneath","neath","beside","besides","between","'tween","beyond","but","by","chez","circa","c.","ca.","come","concerning","contra","counting","cum","despite","spite","down","during","effective","ere","except","excepting","excluding","failing","following","for","from","in","including","inside","into","less","like","minus","modulo","mod","near","nearer","nearest","next","notwithstanding","of","o'","off","offshore","on","onto","opposite","out","outside","over","o'er","pace","past","pending","per","plus","post","pre","pro","qua","re","regarding","respecting","sans","save","saving","short","since","sub","than","through","thru","throughout","thruout","till","times","to","t'","touching","toward","towards","under","underneath","unlike","until","unto","up","upon","versus","vs.","v.","via","vice","vis-\xE0-vis","wanting","with","w/","w.","c\u0304","within","w/i","without","'thout","w/o","abroad","adrift","aft","afterward","afterwards","ahead","apart","ashore","aside","away","back","backward","backwards","beforehand","downhill","downstage","downstairs","downstream","downward","downwards","downwind","east","eastward","eastwards","forth","forward","forwards","heavenward","heavenwards","hence","henceforth","here","hereby","herein","hereof","hereto","herewith","home","homeward","homewards","indoors","inward","inwards","leftward","leftwards","north","northeast","northward","northwards","northwest","now","onward","onwards","outdoors","outward","outwards","overboard","overhead","overland","overseas","rightward","rightwards","seaward","seawards","skywards","skyward","south","southeast","southwards","southward","southwest","then","thence","thenceforth","there","thereby","therein","thereof","thereto","therewith","together","underfoot","underground","uphill","upstage","upstairs","upstream","upward","upwards","upwind","west","westward","westwards","when","whence","where","whereby","wherein","whereto","wherewith","although","because","considering","given","granted","if","lest","once","provided","providing","seeing","so","supposing","though","unless","whenever","whereas","wherever","while","whilst","ago","according to","as regards","counter to","instead of","owing to","pertaining to","at the behest of","at the expense of","at the hands of","at risk of","at the risk of","at variance with","by dint of","by means of","by virtue of","by way of","for the sake of","for sake of","for lack of","for want of","from want of","in accordance with","in addition to","in case of","in charge of","in compliance with","in conformity with","in contact with","in exchange for","in favor of","in front of","in lieu of","in light of","in the light of","in line with","in place of","in point of","in quest of","in relation to","in regard to","with regard to","in respect to","with respect to","in return for","in search of","in step with","in touch with","in terms of","in the name of","in view of","on account of","on behalf of","on grounds of","on the grounds of","on the part of","on top of","with a view to","with the exception of","\xE0 la","a la","as soon as","as well as","close to","due to","far from","in case","other than","prior to","pursuant to","regardless of","subsequent to","as long as","as much as","as far as","by the time","in as much as","inasmuch","in order to","in order that","even","provide that","if only","whether","whose","whoever","why","how","or not","whatever","what","both","and","or","not only","but also","either","neither","nor","just","rather","no sooner","such","that","yet","is","it"];this.ignoreCasedWords
2023-11-09 17:30:33 +08:00
# this is a heading 1
## THIS IS A HEADING 2
### a heading 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# This is a Heading 1
## This is a Heading 2
### A Heading 3
2024-07-08 15:37:38 +08:00
`,options:{style:"Title Case",ignoreCasedWords:!1}}),new y({description:"With `Title Case=true`, `Ignore Cased Words=true`",before:p`
2023-11-09 17:30:33 +08:00
# this is a heading 1
## THIS IS A HEADING 2
### a hEaDiNg 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# This is a Heading 1
## THIS IS A HEADING 2
### A hEaDiNg 3
2024-07-08 15:37:38 +08:00
`,options:{style:"Title Case",ignoreCasedWords:!0}}),new y({description:"With `First letter=true`",before:p`
2023-11-09 17:30:33 +08:00
# this is a heading 1
## this is a heading 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# This is a heading 1
## This is a heading 2
2024-07-08 15:37:38 +08:00
`,options:{style:"First letter"}}),new y({description:"With `ALL CAPS=true`",before:p`
2023-11-09 17:30:33 +08:00
# this is a heading 1
## this is a heading 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# THIS IS A HEADING 1
## THIS IS A HEADING 2
2024-07-08 15:37:38 +08:00
`,options:{style:"ALL CAPS"}})]}get optionBuilders(){return[new ie({OptionsClass:Ft,nameKey:"rules.capitalize-headings.style.name",descriptionKey:"rules.capitalize-headings.style.description",optionsKey:"style",records:[{value:"Title Case",description:"Capitalize Using Title Case Rules"},{value:"ALL CAPS",description:"CAPITALIZE THE WHOLE TITLE"},{value:"First letter",description:"Only capitalize the first letter"}]}),new W({OptionsClass:Ft,nameKey:"rules.capitalize-headings.ignore-case-words.name",descriptionKey:"rules.capitalize-headings.ignore-case-words.description",optionsKey:"ignoreCasedWords"}),new me({OptionsClass:Ft,nameKey:"rules.capitalize-headings.ignore-words.name",descriptionKey:"rules.capitalize-headings.ignore-words.description",optionsKey:"ignoreWords",splitter:fr,separator:", "}),new me({OptionsClass:Ft,nameKey:"rules.capitalize-headings.lowercase-words.name",descriptionKey:"rules.capitalize-headings.lowercase-words.description",optionsKey:"lowercaseWords",splitter:fr,separator:", "})]}};_t=T([v.register],_t);var Hs=class{constructor(){this.innerNewLines=!1}},Sr=class extends v{constructor(){super({nameKey:"rules.compact-yaml.name",descriptionKey:"rules.compact-yaml.description",type:"Spacing"})}get OptionsClass(){return Hs}apply(t,i){return ye(t,n=>(n=n.replace(/^---\n+/,`---
2023-11-09 17:30:33 +08:00
`),n=n.replace(/\n+---/,`
---`),i.innerNewLines&&(n=n.replaceAll(/\n{2,}/g,`
2024-07-08 15:37:38 +08:00
`)),n))}get exampleBuilders(){return[new y({description:"Remove blank lines at the start and end of the YAML",before:p`
2023-11-09 17:30:33 +08:00
---
${""}
date: today
${""}
title: unchanged without inner new lines turned on
${""}
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date: today
${""}
title: unchanged without inner new lines turned on
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"Remove blank lines anywhere in YAML with inner new lines set to true",before:p`
2023-11-09 17:30:33 +08:00
---
${""}
date: today
${""}
${""}
title: remove inner new lines
${""}
---
${""}
# Header 1
${""}
${""}
Body content here.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date: today
title: remove inner new lines
---
${""}
# Header 1
${""}
${""}
Body content here.
2024-07-08 15:37:38 +08:00
`,options:{innerNewLines:!0}})]}get optionBuilders(){return[new W({OptionsClass:Hs,nameKey:"rules.compact-yaml.inner-new-lines.name",descriptionKey:"rules.compact-yaml.inner-new-lines.description",optionsKey:"innerNewLines"})]}};Sr=T([v.register],Sr);var Ul=class{},Ar=class extends v{constructor(){super({nameKey:"rules.consecutive-blank-lines.name",descriptionKey:"rules.consecutive-blank-lines.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Ul}apply(t,i){return t.replace(/(\n([\t\v\f\r \u00a0\u2000-\u200b\u2028-\u2029\u3000]+)?){2,}\n/g,`
2023-11-09 17:30:33 +08:00
2024-07-08 15:37:38 +08:00
`)}get exampleBuilders(){return[new y({description:"Consecutive blank lines are removed",before:p`
2023-11-09 17:30:33 +08:00
Some text
${""}
${""}
Some more text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Some text
${""}
Some more text
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Ar=T([v.register],Ar);var Vl=class{},Tr=class extends v{constructor(){super({nameKey:"rules.convert-bullet-list-markers.name",descriptionKey:"rules.convert-bullet-list-markers.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Vl}apply(t,i){return t.replace(/^([^\S\n]*)([•§])([^\S\n]*)/gm,"$1-$3")}get exampleBuilders(){return[new y({description:"Converts \u2022",before:p`
2023-11-09 17:30:33 +08:00
item 1
item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- item 1
- item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Converts \xA7",before:p`
2023-11-09 17:30:33 +08:00
item 1
§ item 2
§ item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- item 1
- item 2
- item 3
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Tr=T([v.register],Tr);var $s=class{constructor(){this.tabsize=4}},zr=class extends v{constructor(){super({nameKey:"rules.convert-spaces-to-tabs.name",descriptionKey:"rules.convert-spaces-to-tabs.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return $s}apply(t,i){let n=String(i.tabsize),r=new RegExp("^( *) {"+n+"}","gm");t=this.replaceAllRegexMatches(t,r);let a=new RegExp("^((>( | *))*(>( | )) *) {"+n+"}","gm");return t=this.replaceAllRegexMatches(t,a),t}replaceAllRegexMatches(t,i){for(;t.match(i)!=null;)t=t.replace(i,"$1 ");return t}get exampleBuilders(){return[new y({description:"Converting spaces to tabs with `tabsize = 3`",before:p`
2023-11-09 17:30:33 +08:00
- text with no indention
- text indented with 3 spaces
- text with no indention
- text indented with 6 spaces
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- text with no indention
\t- text indented with 3 spaces
- text with no indention
\t\t- text indented with 6 spaces
2024-07-08 15:37:38 +08:00
`,options:{tabsize:3}}),new y({description:"Converting spaces to tabs with `tabsize = 3` works in blockquotes",before:p`
2023-11-09 17:30:33 +08:00
> - text with no indention
> - text indented with 3 spaces
> - text with no indention
> - text indented with 6 spaces
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> - text with no indention
> \t- text indented with 3 spaces
> - text with no indention
> \t\t- text indented with 6 spaces
2024-07-08 15:37:38 +08:00
`,options:{tabsize:3}})]}get optionBuilders(){return[new Ks({OptionsClass:$s,nameKey:"rules.convert-spaces-to-tabs.tabsize.name",descriptionKey:"rules.convert-spaces-to-tabs.tabsize.description",optionsKey:"tabsize"})]}};zr=T([v.register],zr);var ki=class{constructor(){this.aliasArrayStyle="single-line";this.dedupeAliasKey=!0;this.tagArrayStyle="single-line";this.dedupeTagKey=!0;this.dedupeArrayKeys=!0;this.ignoreDedupeArrayKeys=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};T([v.noSettingControl()],ki.prototype,"aliasArrayStyle",2),T([v.noSettingControl()],ki.prototype,"tagArrayStyle",2),T([v.noSettingControl()],ki.prototype,"defaultEscapeCharacter",2),T([v.noSettingControl()],ki.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var Lr=class extends v{constructor(){super({nameKey:"rules.dedupe-yaml-array-values.name",descriptionKey:"rules.dedupe-yaml-array-values.description",type:"YAML"})}get OptionsClass(){return ki}apply(t,i){return ye(t,n=>{let r=oi(n.replace(`---
2024-02-26 20:05:21 +08:00
`,"").replace(`
2024-07-08 15:37:38 +08:00
---`,""));if(!r)return n;for(let a of xi)if(i.dedupeAliasKey&&Object.keys(r).includes(a)){n=oe(n,a,we(ot(this.getUniqueArray(Fe(pe(n,a)))),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of vi)if(i.dedupeTagKey&&Object.keys(r).includes(a)){n=oe(n,a,we(st(this.getUniqueArray(Fe(pe(n,a)))),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.dedupeArrayKeys){let a=[...xi,...vi,...i.ignoreDedupeArrayKeys];for(let s of Object.keys(r)){if(a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null)continue;let o=pe(n,s),l="single-line";o.includes(`
`)&&(l="multi-line");let c=this.getUniqueArray(Fe(o));n=oe(n,s,we(c,l,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}}return n})}getUniqueArray(t){return t==null||typeof t=="string"||t.length<=1?t:[...new Set(t)]}get exampleBuilders(){return[new y({description:"Dedupe YAML tags is case sensitive and will use your default format for tags.",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research, computer, Computer]
aliases:
- Title 1
- Title2
---
`,after:p`
---
tags: [computer, research, Computer]
aliases:
- Title 1
- Title2
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Dedupe YAML aliases is case sensitive and will use your default format for aliases.",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research]
aliases:
- Title 1
- Title2
- Title 1
- Title2
- Title 3
---
`,after:p`
---
tags: [computer, research]
aliases:
- Title 1
- Title2
- Title 3
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Dedupe YAML array keys is case sensitive and will try to preserve the original array format.",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research]
aliases:
- Title 1
- Title2
arr1: [val, val1, val, val2, Val]
arr2:
- Val
- Val
- val
- val2
- Val2
---
`,after:p`
---
tags: [computer, research]
aliases:
- Title 1
- Title2
arr1: [val, val1, val2, Val]
arr2:
- Val
- val
- val2
- Val2
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Dedupe YAML respects list of keys to not remove duplicates of for normal arrays (keys to ignore is just `arr2` for this example)",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research]
aliases:
- Title 1
- Title2
arr1: [val, val1, val, val2, Val]
arr2:
- Val
- Val
- val
- val2
- Val2
---
`,after:p`
---
tags: [computer, research]
aliases:
- Title 1
- Title2
arr1: [val, val1, val2, Val]
arr2:
- Val
- Val
- val
- val2
- Val2
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line",ignoreDedupeArrayKeys:["arr2"]}})]}get optionBuilders(){return[new W({OptionsClass:ki,nameKey:"rules.dedupe-yaml-array-values.dedupe-alias-key.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-alias-key.description",optionsKey:"dedupeAliasKey"}),new W({OptionsClass:ki,nameKey:"rules.dedupe-yaml-array-values.dedupe-tag-key.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-tag-key.description",optionsKey:"dedupeTagKey"}),new W({OptionsClass:ki,nameKey:"rules.dedupe-yaml-array-values.dedupe-array-keys.name",descriptionKey:"rules.dedupe-yaml-array-values.dedupe-array-keys.description",optionsKey:"dedupeArrayKeys"}),new me({OptionsClass:ki,nameKey:"rules.dedupe-yaml-array-values.ignore-keys.name",descriptionKey:"rules.dedupe-yaml-array-values.ignore-keys.description",optionsKey:"ignoreDedupeArrayKeys"})]}};Lr=T([v.register],Lr);var Ws=class{constructor(){this.defaultLanguage=""}},Er=class extends v{constructor(){super({nameKey:"rules.default-language-for-code-fences.name",descriptionKey:"rules.default-language-for-code-fences.description",type:"Content",ruleIgnoreTypes:[f.yaml,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Ws}apply(t,i){return lp(t,i.defaultLanguage)}get exampleBuilders(){return[new y({description:"Add a default language `javascript` to code blocks that do not have a language specified",before:p`
2023-12-10 12:54:30 +08:00
\`\`\`
var temp = 'text';
// this is a code block
\`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
\`\`\`javascript
var temp = 'text';
// this is a code block
\`\`\`
2024-07-08 15:37:38 +08:00
`,options:{defaultLanguage:"javascript"}}),new y({description:"If a code block already has a language specified, do not change it",before:p`
2023-12-10 12:54:30 +08:00
\`\`\`javascript
var temp = 'text';
// this is a code block
\`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
\`\`\`javascript
var temp = 'text';
// this is a code block
\`\`\`
2024-07-08 15:37:38 +08:00
`,options:{defaultLanguage:"shell"}}),new y({description:"Empty string as the default language will not add a language to code blocks",before:p`
2023-12-10 12:54:30 +08:00
\`\`\`
var temp = 'text';
// this is a code block
\`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-12-10 12:54:30 +08:00
\`\`\`
var temp = 'text';
// this is a code block
\`\`\`
2024-07-08 15:37:38 +08:00
`,options:{defaultLanguage:""}})]}get optionBuilders(){return[new ke({OptionsClass:Ws,nameKey:"rules.default-language-for-code-fences.default-language.name",descriptionKey:"rules.default-language-for-code-fences.default-language.description",optionsKey:"defaultLanguage"})]}};Er=T([v.register],Er);var Us=class{constructor(){this.style="consistent"}},Or=class extends v{constructor(){super({nameKey:"rules.emphasis-style.name",descriptionKey:"rules.emphasis-style.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag,f.math,f.inlineMath]})}get OptionsClass(){return Us}apply(t,i){return ws(t,i.style,"emphasis")}get exampleBuilders(){return[new y({description:"Emphasis indicators should use underscores when style is set to 'underscore'",before:p`
2023-11-09 17:30:33 +08:00
# Emphasis Cases
${""}
*Test emphasis*
* Test not emphasized *
This is *emphasized* mid sentence
This is *emphasized* mid sentence with a second *emphasis* on the same line
This is ***bold and emphasized***
This is ***nested bold** and ending emphasized*
This is ***nested emphasis* and ending bold**
${""}
**Test bold**
${""}
* List Item1 with *emphasized text*
* List Item2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Emphasis Cases
${""}
_Test emphasis_
* Test not emphasized *
This is _emphasized_ mid sentence
This is _emphasized_ mid sentence with a second _emphasis_ on the same line
This is _**bold and emphasized**_
This is _**nested bold** and ending emphasized_
This is **_nested emphasis_ and ending bold**
${""}
**Test bold**
${""}
* List Item1 with _emphasized text_
* List Item2
2024-07-08 15:37:38 +08:00
`,options:{style:"underscore"}}),new y({description:"Emphasis indicators should use asterisks when style is set to 'asterisk'",before:p`
2023-11-09 17:30:33 +08:00
# Emphasis Cases
${""}
_Test emphasis_
_ Test not emphasized _
This is _emphasized_ mid sentence
This is _emphasized_ mid sentence with a second _emphasis_ on the same line
This is ___bold and emphasized___
This is ___nested bold__ and ending emphasized_
This is ___nested emphasis_ and ending bold__
${""}
__Test bold__
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Emphasis Cases
${""}
*Test emphasis*
_ Test not emphasized _
This is *emphasized* mid sentence
This is *emphasized* mid sentence with a second *emphasis* on the same line
This is *__bold and emphasized__*
This is *__nested bold__ and ending emphasized*
This is __*nested emphasis* and ending bold__
${""}
__Test bold__
2024-07-08 15:37:38 +08:00
`,options:{style:"asterisk"}}),new y({description:"Emphasis indicators should use consistent style based on first emphasis indicator in a file when style is set to 'consistent'",before:p`
2023-11-09 17:30:33 +08:00
# Emphasis First Emphasis Is an Asterisk
${""}
*First emphasis*
This is _emphasized_ mid sentence
This is *emphasized* mid sentence with a second _emphasis_ on the same line
This is *__bold and emphasized__*
This is *__nested bold__ and ending emphasized*
This is **_nested emphasis_ and ending bold**
${""}
__Test bold__
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Emphasis First Emphasis Is an Asterisk
${""}
*First emphasis*
This is *emphasized* mid sentence
This is *emphasized* mid sentence with a second *emphasis* on the same line
This is *__bold and emphasized__*
This is *__nested bold__ and ending emphasized*
This is ***nested emphasis* and ending bold**
${""}
__Test bold__
2024-07-08 15:37:38 +08:00
`,options:{style:"consistent"}}),new y({description:"Emphasis indicators should use consistent style based on first emphasis indicator in a file when style is set to 'consistent'",before:p`
2023-11-09 17:30:33 +08:00
# Emphasis First Emphasis Is an Underscore
${""}
**_First emphasis_**
This is _emphasized_ mid sentence
This is *emphasized* mid sentence with a second _emphasis_ on the same line
This is *__bold and emphasized__*
This is _**nested bold** and ending emphasized_
This is __*nested emphasis* and ending bold__
${""}
__Test bold__
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Emphasis First Emphasis Is an Underscore
${""}
**_First emphasis_**
This is _emphasized_ mid sentence
This is _emphasized_ mid sentence with a second _emphasis_ on the same line
This is ___bold and emphasized___
This is _**nested bold** and ending emphasized_
This is ___nested emphasis_ and ending bold__
${""}
__Test bold__
2024-07-08 15:37:38 +08:00
`,options:{style:"consistent"}})]}get optionBuilders(){return[new ie({OptionsClass:Us,nameKey:"rules.emphasis-style.style.name",descriptionKey:"rules.emphasis-style.style.description",optionsKey:"style",records:[{value:"consistent",description:"Makes sure the first instance of emphasis is the style that will be used throughout the document"},{value:"asterisk",description:"Makes sure * is the emphasis indicator"},{value:"underscore",description:"Makes sure _ is the emphasis indicator"}]})]}};Or=T([v.register],Or);var Gl=class{},Cr=class extends v{constructor(){super({nameKey:"rules.empty-line-around-blockquotes.name",descriptionKey:"rules.empty-line-around-blockquotes.description",type:"Spacing"})}get OptionsClass(){return Gl}apply(t,i){return np(t)}get exampleBuilders(){return[new y({description:"Blockquotes that start a document do not get an empty line before them.",before:p`
2023-11-09 17:30:33 +08:00
> Quote content here
> quote content continued
# Title here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> Quote content here
> quote content continued
${""}
# Title here
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blockquotes that end a document do not get an empty line after them.",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1
> Quote content here
> quote content continued
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1
${""}
> Quote content here
> quote content continued
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blockquotes that are nested have the proper empty line added",before:p`
2023-11-09 17:30:33 +08:00
# Make sure that nested blockquotes are accounted for correctly
> Quote content here
> quote content continued
> > Nested Blockquote
> > content continued
${""}
**Note that the empty line is either one less blockquote indicator if followed/proceeded by more blockquote content or it is an empty line**
${""}
# Doubly nested code block
${""}
> > Quote content here
> > quote content continued
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Make sure that nested blockquotes are accounted for correctly
${""}
> Quote content here
> quote content continued
>
> > Nested Blockquote
> > content continued
${""}
**Note that the empty line is either one less blockquote indicator if followed/proceeded by more blockquote content or it is an empty line**
${""}
# Doubly nested code block
${""}
> > Quote content here
> > quote content continued
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Cr=T([v.register],Cr);var Ql=class{},Mr=class extends v{constructor(){super({nameKey:"rules.empty-line-around-code-fences.name",descriptionKey:"rules.empty-line-around-code-fences.description",type:"Spacing"})}get OptionsClass(){return Ql}apply(t,i){return ip(t)}get exampleBuilders(){return[new y({description:"Fenced code blocks that start a document do not get an empty line before them.",before:p`
2023-11-09 17:30:33 +08:00
\`\`\` js
var temp = 'text';
// this is a code block
\`\`\`
Text after code block.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
\`\`\` js
var temp = 'text';
// this is a code block
\`\`\`
${""}
Text after code block.
2024-07-08 15:37:38 +08:00
`}),new y({description:"Fenced code blocks that end a document do not get an empty line after them.",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1
\`\`\`
Here is a code block
\`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1
${""}
\`\`\`
Here is a code block
\`\`\`
2024-07-08 15:37:38 +08:00
`}),new y({description:"Fenced code blocks that are in a blockquote have the proper empty line added",before:p`
2023-11-09 17:30:33 +08:00
# Make sure that code blocks in blockquotes are accounted for correctly
> \`\`\`js
> var text = 'this is some text';
> \`\`\`
>
> \`\`\`js
> var other text = 'this is more text';
> \`\`\`
${""}
**Note that the blanks blockquote lines added do not have whitespace after them**
${""}
# Doubly nested code block
${""}
> > \`\`\`js
> > var other text = 'this is more text';
> > \`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Make sure that code blocks in blockquotes are accounted for correctly
> \`\`\`js
> var text = 'this is some text';
> \`\`\`
>
> \`\`\`js
> var other text = 'this is more text';
> \`\`\`
${""}
**Note that the blanks blockquote lines added do not have whitespace after them**
${""}
# Doubly nested code block
${""}
> > \`\`\`js
> > var other text = 'this is more text';
> > \`\`\`
2024-07-08 15:37:38 +08:00
`}),new y({description:"Nested fenced code blocks get empty lines added around them",before:p`
2023-11-09 17:30:33 +08:00
\`\`\`markdown
# Header
${""}
\`\`\`\`JavaScript
var text = 'some string';
\`\`\`\`
\`\`\`
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
\`\`\`markdown
# Header
${""}
\`\`\`\`JavaScript
var text = 'some string';
\`\`\`\`
${""}
\`\`\`
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Mr=T([v.register],Mr);var Vs=class{constructor(){this.minimumNumberOfDollarSignsToBeAMathBlock=2}};T([v.noSettingControl()],Vs.prototype,"minimumNumberOfDollarSignsToBeAMathBlock",2);var qr=class extends v{constructor(){super({nameKey:"rules.empty-line-around-math-blocks.name",descriptionKey:"rules.empty-line-around-math-blocks.description",type:"Spacing",ruleIgnoreTypes:[f.yaml,f.code]})}get OptionsClass(){return Vs}apply(t,i){return tp(t,i.minimumNumberOfDollarSignsToBeAMathBlock)}get exampleBuilders(){return[new y({description:"Math blocks that start a document do not get an empty line before them.",before:p`
2023-11-09 17:30:33 +08:00
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
some more text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
${""}
some more text
2024-07-08 15:37:38 +08:00
`}),new y({description:"Math blocks that are singe-line are updated based on the value of `Number of Dollar Signs to Indicate a Math Block` (in this case its value is 2)",before:p`
2023-11-09 17:30:33 +08:00
$$\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}$$
some more text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
$$\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}$$
${""}
some more text
2024-07-08 15:37:38 +08:00
`}),new y({description:"Math blocks that end a document do not get an empty line after them.",before:p`
2023-11-09 17:30:33 +08:00
Some text
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Some text
${""}
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
2024-07-08 15:37:38 +08:00
`}),new y({description:"Math blocks that are not at the start or the end of the document will have an empty line added before and after them",before:p`
2023-11-09 17:30:33 +08:00
Some text
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
some more text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Some text
${""}
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
${""}
some more text
2024-07-08 15:37:38 +08:00
`}),new y({description:"Math blocks in callouts or blockquotes have the appropriately formatted blank lines added",before:p`
2023-11-09 17:30:33 +08:00
> Math block in blockquote
> $$
> \\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
> $$
${""}
More content here
${""}
> Math block doubly nested in blockquote
> > $$
> > \\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
> > $$
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> Math block in blockquote
>
> $$
> \\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
> $$
${""}
More content here
${""}
> Math block doubly nested in blockquote
>
> > $$
> > \\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
> > $$
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};qr=T([v.register],qr);var Zl=class{},Ir=class extends v{constructor(){super({nameKey:"rules.empty-line-around-tables.name",descriptionKey:"rules.empty-line-around-tables.description",type:"Spacing",ruleIgnoreTypes:[f.yaml,f.code,f.math,f.inlineMath,f.wikiLink,f.link]})}get OptionsClass(){return Zl}apply(t,i){return zp(t)}get exampleBuilders(){return[new y({description:"Tables that start a document do not get an empty line before them.",before:p`
2023-11-09 17:30:33 +08:00
| Column 1 | Column 2 |
|----------|----------|
| foo | bar |
| baz | qux |
| quux | quuz |
More text.
# Heading
${""}
**Note that text directly following a table is considered part of a table according to github markdown**
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
| Column 1 | Column 2 |
|----------|----------|
| foo | bar |
| baz | qux |
| quux | quuz |
${""}
More text.
# Heading
${""}
**Note that text directly following a table is considered part of a table according to github markdown**
2024-07-08 15:37:38 +08:00
`}),new y({description:"Tables that end a document do not get an empty line after them.",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1
| Column 1 | Column 2 |
|----------|----------|
| foo | bar |
| baz | qux |
| quux | quuz |
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1
${""}
| Column 1 | Column 2 |
|----------|----------|
| foo | bar |
| baz | qux |
| quux | quuz |
2024-07-08 15:37:38 +08:00
`}),new y({description:"Tables that are not at the start or the end of the document will have an empty line added before and after them",before:p`
2023-11-09 17:30:33 +08:00
# Table 1
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| foo | bar | blob |
| baz | qux | trust |
| quux | quuz | glob |
# Table 2 without Pipe at Start and End
| Column 1 | Column 2 |
:-: | -----------:
bar | baz
foo | bar
# Header for more content
New paragraph.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Table 1
${""}
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| foo | bar | blob |
| baz | qux | trust |
| quux | quuz | glob |
${""}
# Table 2 without Pipe at Start and End
${""}
| Column 1 | Column 2 |
:-: | -----------:
bar | baz
foo | bar
${""}
# Header for more content
New paragraph.
2024-07-08 15:37:38 +08:00
`}),new y({description:"Tables in callouts or blockquotes have the appropriately formatted blank lines added",before:p`
2023-11-09 17:30:33 +08:00
> Table in blockquote
> | Column 1 | Column 2 | Column 3 |
> |----------|----------|----------|
> | foo | bar | blob |
> | baz | qux | trust |
> | quux | quuz | glob |
${""}
More content here
${""}
> Table doubly nested in blockquote
> > | Column 1 | Column 2 | Column 3 |
> > |----------|----------|----------|
> > | foo | bar | blob |
> > | baz | qux | trust |
> > | quux | quuz | glob |
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> Table in blockquote
>
> | Column 1 | Column 2 | Column 3 |
> |----------|----------|----------|
> | foo | bar | blob |
> | baz | qux | trust |
> | quux | quuz | glob |
${""}
More content here
${""}
> Table doubly nested in blockquote
>
> > | Column 1 | Column 2 | Column 3 |
> > |----------|----------|----------|
> > | foo | bar | blob |
> > | baz | qux | trust |
> > | quux | quuz | glob |
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Ir=T([v.register],Ir);var Br=class{constructor(){this.defaultEscapeCharacter='"';this.tryToEscapeSingleLineArrays=!1}};T([v.noSettingControl()],Br.prototype,"defaultEscapeCharacter",2);var Rt=class extends v{constructor(){super({nameKey:"rules.escape-yaml-special-characters.name",descriptionKey:"rules.escape-yaml-special-characters.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Br}apply(t,i){return ye(t,n=>{let r=n.split(`
`),a=r.length;if(a<1)return n;for(let s=0;s<a;s++){let o=r[s].trim(),l=o.indexOf(":"),c=l<0||l+1>=o.length,d=o.startsWith("-"),u=d&&o.length<2;if(c&&u)continue;let g=1;if(!d)g+=l;else if(l!==-1&&s+1<a){let h=r[s],x=h.indexOf("-")+1;for(;x<h.length&&h.charAt(x)===" ";)x++;let b=0,k=r[s+1];for(;b<k.length&&k.charAt(b)===" ";)b++;x<=b&&(g+=l)}let m=o.substring(g).trim();if(m.startsWith("[")){if(i.tryToEscapeSingleLineArrays){if(m.length<3)continue;let h=m.substring(1,m.length-1).split(","),x=h.length;for(let b=0;b<x;b++){let k=h[b].trim();k.startsWith("[")&&(k=k.substring(1).trimStart()),k.endsWith("]")&&(k=k.substring(0,k.length-1).trimEnd()),h[b]=h[b].replace(k,wi(k,i.defaultEscapeCharacter,!1,!0))}r[s]=r[s].replace(m,"["+h.join(",")+"]")}continue}r[s]=r[s].replace(m,wi(m,i.defaultEscapeCharacter,!1,!0))}return r.join(`
`)})}get exampleBuilders(){return[new y({description:"YAML without anything to escape",before:p`
2023-11-09 17:30:33 +08:00
---
key: value
otherKey: []
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: value
otherKey: []
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"YAML with unescaped values",before:p`
2023-11-09 17:30:33 +08:00
---
key: value: with colon in the middle
secondKey: value with ' a single quote present
thirdKey: "already escaped: value"
fourthKey: value with " a double quote present
fifthKey: value with both ' " a double and single quote present is not escaped, but is invalid YAML
sixthKey: colon:between characters is fine
otherKey: []
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: "value: with colon in the middle"
secondKey: "value with ' a single quote present"
thirdKey: "already escaped: value"
fourthKey: 'value with " a double quote present'
fifthKey: value with both ' " a double and single quote present is not escaped, but is invalid YAML
sixthKey: colon:between characters is fine
otherKey: []
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"YAML with unescaped values in an expanded list with `Default Escape Character = '`",before:p`
2023-11-09 17:30:33 +08:00
---
key:
- value: with colon in the middle
- value with ' a single quote present
- 'already escaped: value'
- value with " a double quote present
- value with both ' " a double and single quote present is not escaped, but is invalid YAML
- colon:between characters is fine
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key:
- 'value: with colon in the middle'
- "value with ' a single quote present"
- 'already escaped: value'
- 'value with " a double quote present'
- value with both ' " a double and single quote present is not escaped, but is invalid YAML
- colon:between characters is fine
---
2024-07-08 15:37:38 +08:00
`,options:{defaultEscapeCharacter:"'"}}),new y({description:"YAML with unescaped values with arrays",before:p`
2023-11-09 17:30:33 +08:00
---
array: [value: with colon in the middle, value with ' a single quote present, "already escaped: value", value with " a double quote present, value with both ' " a double and single quote present is not escaped but is invalid YAML, colon:between characters is fine]
nestedArray: [[value: with colon in the middle, value with ' a single quote present], ["already escaped: value", value with " a double quote present], value with both ' " a double and single quote present is not escaped but is invalid YAML, colon:between characters is fine]
nestedArray2: [[value: with colon in the middle], value with ' a single quote present]
---
${""}
_Note that escaped commas in a YAML array will be treated as a separator._
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
array: ["value: with colon in the middle", "value with ' a single quote present", "already escaped: value", 'value with " a double quote present', value with both ' " a double and single quote present is not escaped but is invalid YAML, colon:between characters is fine]
nestedArray: [["value: with colon in the middle", "value with ' a single quote present"], ["already escaped: value", 'value with " a double quote present'], value with both ' " a double and single quote present is not escaped but is invalid YAML, colon:between characters is fine]
nestedArray2: [["value: with colon in the middle"], "value with ' a single quote present"]
---
${""}
_Note that escaped commas in a YAML array will be treated as a separator._
2024-07-08 15:37:38 +08:00
`,options:{tryToEscapeSingleLineArrays:!0}})]}get optionBuilders(){return[new W({OptionsClass:Br,nameKey:"rules.escape-yaml-special-characters.try-to-escape-single-line-arrays.name",descriptionKey:"rules.escape-yaml-special-characters.try-to-escape-single-line-arrays.description",optionsKey:"tryToEscapeSingleLineArrays"})]}};Rt=T([v.register],Rt);var Gs=class{};T([v.noSettingControl()],Gs.prototype,"fileName",2);var Fr=class extends v{constructor(){super({nameKey:"rules.file-name-heading.name",descriptionKey:"rules.file-name-heading.description",type:"Heading",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Gs}apply(t,i){if(t.match(/^#\s.*/m))return t;let r=i.fileName,a=t.indexOf(`
2023-11-09 17:30:33 +08:00
---`);a=a==-1||!t.startsWith(`---
`)?0:a+5;let s=`# ${r}
`;return t.length<a&&(s=`
2024-07-08 15:37:38 +08:00
`+s),At(t,a,s)}get exampleBuilders(){return[new y({description:"Inserts an H1 heading",before:p`
2023-11-09 17:30:33 +08:00
This is a line of text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# File Name
This is a line of text
2024-07-08 15:37:38 +08:00
`,options:{fileName:"File Name"}}),new y({description:"Inserts heading after YAML front matter",before:p`
2023-11-09 17:30:33 +08:00
---
title: My Title
---
This is a line of text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: My Title
---
# File Name
This is a line of text
2024-07-08 15:37:38 +08:00
`,options:{fileName:"File Name"}})]}get optionBuilders(){return[]}};Fr=T([v.register],Fr);var Jl=class{},_r=class extends v{constructor(){super({nameKey:"rules.footnote-after-punctuation.name",descriptionKey:"rules.footnote-after-punctuation.description",type:"Footnote",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.yaml,f.link,f.wikiLink,f.tag,f.footnoteAtStartOfLine,f.footnoteAfterATask]})}get OptionsClass(){return Jl}apply(t,i){return t.replace(/(\[\^[^\]]+\]) ?([,.;!:?])/gm,"$2$1")}get exampleBuilders(){return[new y({description:"Placing footnotes after punctuation.",before:p`
2023-11-09 17:30:33 +08:00
Lorem[^1]. Ipsum[^2], doletes.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem.[^1] Ipsum,[^2] doletes.
2024-07-08 15:37:38 +08:00
`}),new y({description:"A footnote at the start of a task is not moved to after the punctuation",before:p`
2023-11-09 17:30:33 +08:00
- [ ] [^1]: This is a footnote and a task.
- [ ] This is a footnote and a task that gets swapped with the punctuation[^2]!
[^2]: This footnote got modified
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [ ] [^1]: This is a footnote and a task.
- [ ] This is a footnote and a task that gets swapped with the punctuation![^2]
[^2]: This footnote got modified
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};_r=T([v.register],_r);var Rr=class{constructor(){this.defaultEscapeCharacter='"';this.forceYamlEscape=[]}};T([v.noSettingControl()],Rr.prototype,"defaultEscapeCharacter",2);var Dt=class extends v{constructor(){super({nameKey:"rules.force-yaml-escape.name",descriptionKey:"rules.force-yaml-escape.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Rr}apply(t,i){return ye(t,n=>{for(let r of i.forceYamlEscape){let a=pe(n,r);if(a!=null){if(a.includes(`
`)||a.startsWith(" [")||Tn(a))continue;a=wi(a,i.defaultEscapeCharacter,!0),n=oe(n,r," "+a)}}return n})}get exampleBuilders(){return[new y({description:"YAML without anything to escape",before:p`
2023-11-09 17:30:33 +08:00
---
key: value
otherKey: []
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: value
otherKey: []
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"Force YAML keys to be escaped with double quotes where not already escaped with `Force YAML Escape on Keys = 'key'\\n'title'\\n'bool'`",before:p`
2023-11-09 17:30:33 +08:00
---
key: 'Already escaped value'
title: This is a title
bool: false
unaffected: value
---
${""}
_Note that the force YAML key option should not be used with arrays._
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: 'Already escaped value'
title: "This is a title"
bool: "false"
unaffected: value
---
${""}
_Note that the force YAML key option should not be used with arrays._
2024-07-08 15:37:38 +08:00
`,options:{forceYamlEscape:["key","title","bool"],defaultEscapeCharacter:'"'}})]}get optionBuilders(){return[new me({OptionsClass:Rr,nameKey:"rules.force-yaml-escape.force-yaml-escape-keys.name",descriptionKey:"rules.force-yaml-escape.force-yaml-escape-keys.description",optionsKey:"forceYamlEscape"})]}};Dt=T([v.register],Dt);var Xl=class{},Kt=class extends v{constructor(){super({nameKey:"rules.format-tags-in-yaml.name",descriptionKey:"rules.format-tags-in-yaml.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Xl}apply(t,i){return ye(t,n=>n.replace(new RegExp(`\\n(${br}|${Nl}):(.*?)(?=\\n(?:[A-Za-z-]+?:|---))`,"s"),function(r){return r.replaceAll("#","")}))}get exampleBuilders(){return[new y({description:"Format Tags in YAML frontmatter",before:p`
2023-11-09 17:30:33 +08:00
---
tags: #one #two #three #nested/four/five
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: one two three nested/four/five
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"Format tags in array",before:p`
2023-11-09 17:30:33 +08:00
---
tags: [#one #two #three]
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [one two three]
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"Format tags in array with `tag` as the tags key",before:p`
2023-11-09 17:30:33 +08:00
---
tag: [#one #two #three]
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tag: [one two three]
---
2024-07-08 15:37:38 +08:00
`}),new y({description:"Format tags in list",before:p`
2023-11-09 17:30:33 +08:00
---
tags:
- #tag1
- #tag2
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags:
- tag1
- tag2
---
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Kt=T([v.register],Kt);var li=class{constructor(){this.aliasArrayStyle="single-line";this.formatAliasKey=!0;this.tagArrayStyle="single-line";this.formatTagKey=!0;this.defaultArrayStyle="single-line";this.formatArrayKeys=!0;this.forceSingleLineArrayStyle=[];this.forceMultiLineArrayStyle=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};T([v.noSettingControl()],li.prototype,"aliasArrayStyle",2),T([v.noSettingControl()],li.prototype,"tagArrayStyle",2),T([v.noSettingControl()],li.prototype,"defaultEscapeCharacter",2),T([v.noSettingControl()],li.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var Dr=class extends v{constructor(){super({nameKey:"rules.format-yaml-array.name",descriptionKey:"rules.format-yaml-array.description",type:"YAML"})}get OptionsClass(){return li}apply(t,i){return ye(t,n=>{let r=oi(n.replace(`---
2023-11-09 17:30:33 +08:00
`,"").replace(`
2024-07-08 15:37:38 +08:00
---`,""));if(!r)return n;for(let a of xi)if(i.formatAliasKey&&Object.keys(r).includes(a)){n=oe(n,a,we(ot(Fe(pe(n,a))),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of vi)if(i.formatTagKey&&Object.keys(r).includes(a)){n=oe(n,a,we(st(Fe(pe(n,a))),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.formatArrayKeys){let a=[...xi,...vi,...i.forceMultiLineArrayStyle,...i.forceSingleLineArrayStyle];for(let s of Object.keys(r))a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null||(n=oe(n,s,we(Fe(pe(n,s)),i.defaultArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)))}for(let a of i.forceSingleLineArrayStyle)Object.keys(r).includes(a)&&(n=oe(n,a,we(Fe(pe(n,a)),"single-line",i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)));for(let a of i.forceMultiLineArrayStyle)Object.keys(r).includes(a)&&(n=oe(n,a,we(Fe(pe(n,a)),"multi-line",i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays)));return n})}get exampleBuilders(){return[new y({description:"Format tags as a single-line array delimited by spaces and aliases as a multi-line array and format the key `test` to be a single-line array",before:p`
2023-11-09 17:30:33 +08:00
---
tags:
- computer
- research
aliases: Title 1, Title2
test: this is a value
---
${""}
# Notes:
${""}
Nesting YAML arrays may result in unexpected results.
${""}
Multi-line arrays will have empty values removed only leaving one if it is completely empty. The same is not true for single-line arrays as that is invalid YAML unless it comes as the last entry in the array.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [computer, research]
aliases:
- Title 1
- Title2
test: [this is a value]
---
${""}
# Notes:
${""}
Nesting YAML arrays may result in unexpected results.
${""}
Multi-line arrays will have empty values removed only leaving one if it is completely empty. The same is not true for single-line arrays as that is invalid YAML unless it comes as the last entry in the array.
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line",forceSingleLineArrayStyle:["test"]}}),new y({description:"Format tags as a single string with space delimiters, ignore aliases, and format regular YAML arrays as single-line arrays",before:p`
2023-11-09 17:30:33 +08:00
---
aliases: Typescript
types:
- thought provoking
- peer reviewed
tags: [computer, science, trajectory]
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases: Typescript
types: [thought provoking, peer reviewed]
tags: computer science trajectory
---
2024-07-08 15:37:38 +08:00
`,options:{formatAliasKey:!1,tagArrayStyle:"single string space delimited"}}),new y({description:"Arrays with dictionaries in them are ignored",before:p`
2023-11-09 17:30:33 +08:00
---
gists:
- id: test123
url: 'some_url'
filename: file.md
isPublic: true
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
gists:
- id: test123
url: 'some_url'
filename: file.md
isPublic: true
---
2024-07-08 15:37:38 +08:00
`,options:{formatArrayKeys:!0,defaultArrayStyle:"single-line"}})]}get optionBuilders(){return[new W({OptionsClass:li,nameKey:"rules.format-yaml-array.alias-key.name",descriptionKey:"rules.format-yaml-array.alias-key.description",optionsKey:"formatAliasKey"}),new W({OptionsClass:li,nameKey:"rules.format-yaml-array.tag-key.name",descriptionKey:"rules.format-yaml-array.tag-key.description",optionsKey:"formatTagKey"}),new ie({OptionsClass:li,nameKey:"rules.format-yaml-array.default-array-style.name",descriptionKey:"rules.format-yaml-array.default-array-style.description",optionsKey:"defaultArrayStyle",records:[{value:"multi-line",description:"```key:\\n - value```"},{value:"single-line",description:"```key: [value]```"}]}),new W({OptionsClass:li,nameKey:"rules.format-yaml-array.default-array-keys.name",descriptionKey:"rules.format-yaml-array.default-array-keys.description",optionsKey:"formatArrayKeys"}),new me({OptionsClass:li,nameKey:"rules.format-yaml-array.force-single-line-array-style.name",descriptionKey:"rules.format-yaml-array.force-single-line-array-style.description",optionsKey:"forceSingleLineArrayStyle"}),new me({OptionsClass:li,nameKey:"rules.format-yaml-array.force-multi-line-array-style.name",descriptionKey:"rules.format-yaml-array.force-multi-line-array-style.description",optionsKey:"forceMultiLineArrayStyle"})]}};Dr=T([v.register],Dr);var Qs=class{constructor(){this.startAtH2=!1}},Kr=class extends v{constructor(){super({nameKey:"rules.header-increment.name",descriptionKey:"rules.header-increment.description",type:"Heading",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Qs}apply(t,i){let n=0,r=i.startAtH2?2:1,a=[],s=[0,0,0,0,0,0],o=s.length;return t.replace(rt,(l,c="",d="",u="",g="",m="")=>{let h=d.length;if(h=h<=o?h:o,s[h-1]>=0&&h<n){let x=s.length;for(;a.length!==0&&h<=a[a.length-1];)x=a.pop();a.length===0?x=0:x--;for(let b=s.length-1;b>=x;b--)s[b]=0}if(s[h-1]<=0){let x=n,b=a.length+r;b=b<=o?b:o;for(let k=x;k<h-1;k++)s[k]=b-1;a.push(h),s[h-1]=b}return n=h,c+"#".repeat(s[h-1])+u+g+m})}get exampleBuilders(){return[new y({description:"Heading levels are decremented as needed",before:p`
2023-11-09 17:30:33 +08:00
# H1
### H3
### H3
#### H4
###### H6
${""}
We skipped a 2nd level heading
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
## H3
## H3
### H4
#### H6
${""}
We skipped a 2nd level heading
2024-07-08 15:37:38 +08:00
`}),new y({description:"Skipped headings in sections that would be decremented will result in those headings not having the same meaning",before:p`
2023-11-09 17:30:33 +08:00
# H1
### H3
${""}
We skip from 1 to 3
${""}
###### H6
${""}
We skip from 3 to 6 leaving out 4, 5, and 6. Thus headings level 4 and 5 will be treated like H3 above until another H2 or H1 is encountered
${""}
##### H5
${""}
We skipped 5 previously so it will be treated the same as the H3 above since it was the next lowest header that was to be decremented
${""}
## H2
${""}
This resets the decrement section so the H6 below is decremented to an H3
${""}
###### H6
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
## H3
${""}
We skip from 1 to 3
${""}
### H6
${""}
We skip from 3 to 6 leaving out 4, 5, and 6. Thus headings level 4 and 5 will be treated like H3 above until another H2 or H1 is encountered
${""}
## H5
${""}
We skipped 5 previously so it will be treated the same as the H3 above since it was the next lowest header that was to be decremented
${""}
# H2
${""}
This resets the decrement section so the H6 below is decremented to an H3
${""}
## H6
2024-07-08 15:37:38 +08:00
`}),new y({description:"When `Start Header Increment at Heading Level 2 = true`, H1s become H2s and the other headers are incremented accordingly",before:p`
2023-11-09 17:30:33 +08:00
# H1 becomes H2
#### H4 becomes H3
###### H6
## H2
###### H6
# H1
## H2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
## H1 becomes H2
### H4 becomes H3
#### H6
## H2
### H6
## H1
### H2
2024-07-08 15:37:38 +08:00
`,options:{startAtH2:!0}})]}get optionBuilders(){return[new W({OptionsClass:Qs,nameKey:"rules.header-increment.start-at-h2.name",descriptionKey:"rules.header-increment.start-at-h2.description",optionsKey:"startAtH2"})]}};Kr=T([v.register],Kr);var Yr=class{constructor(){this.bottom=!0;this.emptyLineAfterYaml=!0}},Nr=class extends v{constructor(){super({nameKey:"rules.heading-blank-lines.name",descriptionKey:"rules.heading-blank-lines.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink]})}get OptionsClass(){return Yr}apply(t,i){return i.bottom?(t=t.replace(/^(#+\s.*)/gm,`
2023-11-09 17:30:33 +08:00
$1
`),t=t.replace(/\n+(#+\s.*)/g,`
$1`),t=t.replace(/(^#+\s.*)\n+/gm,`$1
2024-02-26 20:05:21 +08:00
`)):t=t.replace(/^([^#\n][^\n]+)\n+(#+\s.*)/gm,`$1
2023-11-09 17:30:33 +08:00
2024-07-08 15:37:38 +08:00
$2`),t=t.replace(/^\n+(#+\s.*)/,"$1"),t=t.replace(/(#+\s.*)\n+$/,"$1"),i.emptyLineAfterYaml||(t=t.replace(new RegExp("("+Je.source+")\\n+(#+\\s.*)"),`$1
$5`)),t}get exampleBuilders(){return[new y({description:"Headings should be surrounded by blank lines",before:p`
2023-11-09 17:30:33 +08:00
# H1
## H2
${""}
${""}
# H1
line
## H2
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
${""}
## H2
${""}
# H1
${""}
line
${""}
## H2
2024-07-08 15:37:38 +08:00
`}),new y({description:"With `Bottom=false`",before:p`
2023-11-09 17:30:33 +08:00
# H1
line
## H2
# H1
line
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
line
${""}
## H2
# H1
line
2024-07-08 15:37:38 +08:00
`,options:{bottom:!1,emptyLineAfterYaml:!0}}),new y({description:"Empty line before header and after YAML is removed with `Empty Line Between YAML and Header=false`",before:p`
2023-11-09 17:30:33 +08:00
---
key: value
---
${""}
# Header
Paragraph here...
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
key: value
---
# Header
Paragraph here...
2024-07-08 15:37:38 +08:00
`,options:{bottom:!0,emptyLineAfterYaml:!1}})]}get optionBuilders(){return[new W({OptionsClass:Yr,nameKey:"rules.heading-blank-lines.bottom.name",descriptionKey:"rules.heading-blank-lines.bottom.description",optionsKey:"bottom"}),new W({OptionsClass:Yr,nameKey:"rules.heading-blank-lines.empty-line-after-yaml.name",descriptionKey:"rules.heading-blank-lines.empty-line-after-yaml.description",optionsKey:"emptyLineAfterYaml"})]}};Nr=T([v.register],Nr);var ec=class{},jr=class extends v{constructor(){super({nameKey:"rules.headings-start-line.name",descriptionKey:"rules.headings-start-line.description",type:"Heading",ruleIgnoreTypes:[f.code,f.math,f.yaml]})}get OptionsClass(){return ec}apply(t,i){return t.replaceAll(rt,n=>n.trimStart())}get exampleBuilders(){return[new y({description:"Removes spaces prior to a heading",before:p`
2023-11-09 17:30:33 +08:00
${""} ## Other heading preceded by 2 spaces ##
_Note that if the spacing is enough for the header to be considered to be part of a codeblock it will not be affected by this rule._
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
## Other heading preceded by 2 spaces ##
_Note that if the spacing is enough for the header to be considered to be part of a codeblock it will not be affected by this rule._
2024-07-08 15:37:38 +08:00
`}),new y({description:"Tags are not affected by this",before:p`
2023-11-09 17:30:33 +08:00
${""} #test
${""} # Heading &amp;
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
${""} #test
# Heading &amp;
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};jr=T([v.register],jr);var Zs=class{constructor(){this.textToInsert=["aliases: ","tags: "]}},Pr=class extends v{constructor(){super({nameKey:"rules.insert-yaml-attributes.name",descriptionKey:"rules.insert-yaml-attributes.description",type:"YAML"})}get OptionsClass(){return Zs}apply(t,i){return t=Ci(t),ye(t,n=>{let r=i.textToInsert.reverse(),a=oi(n.match(Je)[1]);for(let s of r){let o=s.split(":")[0];Object.prototype.hasOwnProperty.call(a,o)||(n=n.replace(/^---\n/,Xe(`---
2023-11-09 17:30:33 +08:00
${s}
2024-07-08 15:37:38 +08:00
`)))}return n})}get exampleBuilders(){return[new y({description:"Insert static lines into YAML frontmatter. Text to insert: `aliases:\ntags: doc\nanimal: dog`",before:p`
2023-11-09 17:30:33 +08:00
---
animal: cat
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
tags: doc
animal: cat
---
2024-07-08 15:37:38 +08:00
`,options:{textToInsert:["aliases:","tags: doc","animal: dog"]}})]}get optionBuilders(){return[new me({OptionsClass:Zs,nameKey:"rules.insert-yaml-attributes.text-to-insert.name",descriptionKey:"rules.insert-yaml-attributes.text-to-insert.description",optionsKey:"textToInsert"})]}};Pr=T([v.register],Pr);var ic=class{},Hr=class extends v{constructor(){super({nameKey:"rules.line-break-at-document-end.name",descriptionKey:"rules.line-break-at-document-end.description",type:"Spacing"})}get OptionsClass(){return ic}apply(t,i){return t=t.replace(/\n+$/g,""),t+=`
`,t}get exampleBuilders(){return[new y({description:"Appending a line break to the end of the document.",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
${""}
2024-07-08 15:37:38 +08:00
`}),new y({description:"Removing trailing line breaks to the end of the document, except one.",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
${""}
${""}
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
${""}
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Hr=T([v.register],Hr);var tc=class{},$r=class extends v{constructor(){super({nameKey:"rules.move-footnotes-to-the-bottom.name",descriptionKey:"rules.move-footnotes-to-the-bottom.description",type:"Footnote",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.yaml]})}get OptionsClass(){return tc}apply(t,i){return Vu(t)}get exampleBuilders(){return[new y({description:"Moving footnotes to the bottom",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum, consectetur adipiscing elit. [^1] Donec dictum turpis quis ipsum pellentesque.
${""}
[^1]: first footnote
${""}
Quisque lorem est, fringilla sed enim at, sollicitudin lacinia nisi.[^2]
[^2]: second footnote
${""}
Maecenas malesuada dignissim purus ac volutpat.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum, consectetur adipiscing elit. [^1] Donec dictum turpis quis ipsum pellentesque.
${""}
Quisque lorem est, fringilla sed enim at, sollicitudin lacinia nisi.[^2]
Maecenas malesuada dignissim purus ac volutpat.
${""}
[^1]: first footnote
[^2]: second footnote
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};$r=T([v.register],$r);var Js=class{constructor(){this.minimumNumberOfDollarSignsToBeAMathBlock=2}};T([v.noSettingControl()],Js.prototype,"minimumNumberOfDollarSignsToBeAMathBlock",2);var Nt=class extends v{constructor(){super({nameKey:"rules.move-math-block-indicators-to-their-own-line.name",descriptionKey:"rules.move-math-block-indicators-to-their-own-line.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.inlineCode],hasSpecialExecutionOrder:!0})}get OptionsClass(){return Js}apply(t,i){return sp(t,i.minimumNumberOfDollarSignsToBeAMathBlock)}get exampleBuilders(){return[new y({description:"Moving math block indicator to its own line when `Number of Dollar Signs to Indicate a Math Block` = 2",before:p`
2023-11-09 17:30:33 +08:00
This is left alone:
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
The following is updated:
$$L = \\frac{1}{2} \\rho v^2 S C_L$$
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
This is left alone:
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
The following is updated:
$$
L = \\frac{1}{2} \\rho v^2 S C_L
$$
2024-07-08 15:37:38 +08:00
`}),new y({description:"Moving math block indicator to its own line when `Number of Dollar Signs to Indicate a Math Block` = 3 and opening indicator is on the same line as the start of the content",before:p`
2023-11-09 17:30:33 +08:00
$$$\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$$
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
$$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$$
2024-07-08 15:37:38 +08:00
`}),new y({description:"Moving math block indicator to its own line when `Number of Dollar Signs to Indicate a Math Block` = 2 and ending indicator is on the same line as the ending line of the content",before:p`
2023-11-09 17:30:33 +08:00
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}$$
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
$$
\\boldsymbol{a}=\\begin{bmatrix}a_x \\\\ a_y\\end{bmatrix}
$$
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Nt=T([v.register],Nt);var ut=class{constructor(){this.tagArrayStyle="single-line";this.howToHandleExistingTags="Nothing";this.tagsToIgnore=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};T([v.noSettingControl()],ut.prototype,"tagArrayStyle",2),T([v.noSettingControl()],ut.prototype,"defaultEscapeCharacter",2),T([v.noSettingControl()],ut.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var Wr=class extends v{constructor(){super({nameKey:"rules.move-tags-to-yaml.name",descriptionKey:"rules.move-tags-to-yaml.description",type:"YAML",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.html,f.wikiLink,f.link]})}get OptionsClass(){return ut}apply(t,i){let n;return Ee([f.yaml],t,r=>(n=Lp(r),r)),n.length===0||(t=Ci(t),t=ye(t,r=>{r=r.replace(`---
`,"").replace("---","");let a=[],s=br;for(let c of vi){let d=pe(r,c);if(d!=null){a=st(Fe(d)),s=c;break}}let o=new Set;if(typeof a=="string")o.add(a),a=[a];else if(a!=null)for(let c of a)o.add(c);else a=[];for(let c of n){let d=c.trim().substring(1);!o.has(d)&&!i.tagsToIgnore.includes(d)&&(o.add(d),a.push(d))}return`---
${oe(r,s,we(a,i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}---`}),t=Ee([f.yaml],t,r=>(i.howToHandleExistingTags!=="Nothing"&&(r=r.replace(hr,a=>{let s=a.indexOf("#"),o=a.substring(s+1);return i.tagsToIgnore.includes(o)?a:i.howToHandleExistingTags==="Remove hashtag"?a.substring(0,s)+o:""})),r)),t=t.replace(/(\n---)( |\t)+/,"$1")),t}get exampleBuilders(){return[new y({description:"Move tags from body to YAML with `Tags to ignore = 'ignored-tag'`",before:p`
2023-11-09 17:30:33 +08:00
Text has to do with #test and #markdown
${""}
#test content here
\`\`\`
#ignored
Code block content is ignored
\`\`\`
${""}
This inline code \`#ignored content\`
${""}
#ignored-tag is ignored since it is in the ignored list
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, markdown]
---
Text has to do with #test and #markdown
${""}
#test content here
\`\`\`
#ignored
Code block content is ignored
\`\`\`
${""}
This inline code \`#ignored content\`
${""}
#ignored-tag is ignored since it is in the ignored list
2024-07-08 15:37:38 +08:00
`,options:{tagsToIgnore:["ignored-tag"]}}),new y({description:"Move tags from body to YAML with existing tags retains the already existing ones and only adds new ones",before:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2]
---
Text has to do with #test and #markdown
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2, markdown]
---
Text has to do with #test and #markdown
2024-07-08 15:37:38 +08:00
`}),new y({description:"Move tags to YAML frontmatter and then remove hashtags in body content tags when `Body tag operation = 'Remove hashtag'` and `Tags to ignore = 'yet-another-ignored-tag'`.",before:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2]
---
Text has to do with #test and #markdown
${""}
The tag at the end of this line stays as a tag since it is ignored #yet-another-ignored-tag
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2, markdown]
---
Text has to do with test and markdown
${""}
The tag at the end of this line stays as a tag since it is ignored #yet-another-ignored-tag
2024-07-08 15:37:38 +08:00
`,options:{howToHandleExistingTags:"Remove hashtag",tagsToIgnore:["yet-another-ignored-tag"]}}),new y({description:"Move tags to YAML frontmatter and then remove body content tags when `Body tag operation = 'Remove whole tag'`.",before:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2]
---
This document will have #tags removed and spacing around tags is left alone except for the space prior to the hashtag #warning
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: [test, tag2, tags, warning]
---
This document will have removed and spacing around tags is left alone except for the space prior to the hashtag
2024-07-08 15:37:38 +08:00
`,options:{howToHandleExistingTags:"Remove whole tag"}})]}get optionBuilders(){return[new ie({OptionsClass:ut,nameKey:"rules.move-tags-to-yaml.how-to-handle-existing-tags.name",descriptionKey:"rules.move-tags-to-yaml.how-to-handle-existing-tags.description",optionsKey:"howToHandleExistingTags",records:[{value:"Nothing",description:"Leaves tags in the body of the file alone"},{value:"Remove hashtag",description:"Removes `#` from tags in content body after moving them to the YAML frontmatter"},{value:"Remove whole tag",description:"Removes the whole tag in content body after moving them to the YAML frontmatter. _Note that this removes the first space prior to the tag as well_"}]}),new me({OptionsClass:ut,nameKey:"rules.move-tags-to-yaml.tags-to-ignore.name",descriptionKey:"rules.move-tags-to-yaml.tags-to-ignore.description",optionsKey:"tagsToIgnore"})]}};Wr=T([v.register],Wr);var eo=class{constructor(){this.noBareURIs=!1}},Xs="'\"\u2018\u2019\u201C\u201D`[]",bv=["http","ftp","https","smtp"],Ur=class extends v{constructor(){super({nameKey:"rules.no-bare-urls.name",descriptionKey:"rules.no-bare-urls.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag,f.image,f.inlineCode,f.anchorTag,f.html]})}get OptionsClass(){return eo}apply(t,i){let n=t.match(kn);if(n&&(t=this.handleMatches(t,n,!1)),i.noBareURIs){let r=t.match(yp);r&&(t=this.handleMatches(t,r,!0))}return t}handleMatches(t,i,n){let r=0,a=i.length;for(let s=0;s<a;s++){let o=i[s],l=t.indexOf(o,r),c=l+o.length;o.charAt(0)==="<"&&(o=o.substring(1),l++),o.charAt(o.length-1)===">"&&(o=o.substring(0,o.length-1),c--);let d=l===0?void 0:t.charAt(l-1),u=c>=t.length?void 0:t.charAt(c),g=Xi(o,"(");if(g!=0&&g!=Xi(o,")")&&u==")"?(o+=u,c++,u=c>=t.length?void 0:t.charAt(c)):g==0&&o.endsWith(")")&&(u=")",c--,o=o.substring(0,o.length-1)),this.skipMatch(d,u,o,n)){r=l+o.length;continue}if(d!=null&&d==="<"&&u!=null&&u===">"){let m=l-1;for(;m>0&&t.charAt(m-1)==="<";)m--;let h=c;for(;h<t.length-1&&t.charAt(h+1)===">";)h++;t=de(t,m,h+1,"<"+o+">"),r=l+o.length;continue}t=de(t,l,l+o.length,"<"+o+">"),r=l+o.length+2}return t}skipMatch(t,i,n,r){let a=t!=null&&Xs.includes(t)||Xs.includes(n.charAt(0)),s=i!=null&&Xs.includes(i)||Xs.includes(n.charAt(n.length-1));return a&&s?!0:r?bv.includes(n.substring(0,n.indexOf(":"))):!1}get exampleBuilders(){return[new y({description:"Make sure that links are inside of angle brackets when not in single quotes('), double quotes(\"), or backticks(`)",before:p`
2023-11-09 17:30:33 +08:00
https://github.com
braces around url should stay the same: [https://github.com]
backticks around url should stay the same: \`https://github.com\`
Links mid-sentence should be updated like https://google.com will be.
'https://github.com'
"https://github.com"
<https://github.com>
links should stay the same: [](https://github.com)
https://gitlab.com
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
<https://github.com>
braces around url should stay the same: [https://github.com]
backticks around url should stay the same: \`https://github.com\`
Links mid-sentence should be updated like <https://google.com> will be.
'https://github.com'
"https://github.com"
<https://github.com>
links should stay the same: [](https://github.com)
<https://gitlab.com>
2024-07-08 15:37:38 +08:00
`}),new y({description:`Angle brackets are added if the url is not the only text in the single quotes(') or double quotes(")`,before:p`
2023-11-09 17:30:33 +08:00
[https://github.com some text here]
backticks around a url should stay the same: \`https://github.com some text here\`
single quotes around a url should stay the same, but only if the contents of the single quotes is the url: 'https://github.com some text here'
double quotes around a url should stay the same, but only if the contents of the double quotes is the url: "https://github.com some text here"
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
[<https://github.com> some text here]
backticks around a url should stay the same: \`https://github.com some text here\`
single quotes around a url should stay the same, but only if the contents of the single quotes is the url: '<https://github.com> some text here'
double quotes around a url should stay the same, but only if the contents of the double quotes is the url: "<https://github.com> some text here"
2024-07-08 15:37:38 +08:00
`}),new y({description:"Multiple angle brackets at the start and or end of a url will be reduced down to 1",before:p`
2023-11-09 17:30:33 +08:00
<<https://github.com>
<https://google.com>>
<<https://gitlab.com>>
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
<https://github.com>
<https://google.com>
<https://gitlab.com>
2024-07-08 15:37:38 +08:00
`}),new y({description:"Puts angle brackets around URIs when `No Bare URIs` is enabled",before:p`
2023-11-09 17:30:33 +08:00
obsidian://show-plugin?id=cycle-in-sidebar
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
<obsidian://show-plugin?id=cycle-in-sidebar>
2024-07-08 15:37:38 +08:00
`,options:{noBareURIs:!0}})]}get optionBuilders(){return[new W({OptionsClass:eo,nameKey:"rules.no-bare-urls.no-bare-uris.name",descriptionKey:"rules.no-bare-urls.no-bare-uris.description",optionsKey:"noBareURIs"})]}};Ur=T([v.register],Ur);var Gr=class{constructor(){this.numberStyle="ascending";this.listEndStyle="."}},Vr=class extends v{constructor(){super({nameKey:"rules.ordered-list-style.name",descriptionKey:"rules.ordered-list-style.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.tag]})}get OptionsClass(){return Gr}apply(t,i){return rp(t,i.numberStyle,i.listEndStyle)}get exampleBuilders(){return[new y({description:"Ordered lists have list items set to ascending numerical order when Number Style is `ascending`.",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
4. Item 3
${""}
Some text here
${""}
1. Item 1
1. Item 2
1. Item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
3. Item 3
${""}
Some text here
${""}
1. Item 1
2. Item 2
3. Item 3
2024-07-08 15:37:38 +08:00
`}),new y({description:"Nested ordered lists have list items set to ascending numerical order when Number Style is `ascending`.",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
1. Subitem 1
5. Subitem 2
2. Subitem 3
4. Item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
1. Subitem 1
2. Subitem 2
3. Subitem 3
3. Item 3
2024-07-08 15:37:38 +08:00
`}),new y({description:"Ordered list in blockquote has list items set to '1.' when Number Style is `lazy`.",before:p`
2023-11-09 17:30:33 +08:00
> 1. Item 1
> 4. Item 2
> > 1. Subitem 1
> > 5. Subitem 2
> > 2. Subitem 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> 1. Item 1
> 1. Item 2
> > 1. Subitem 1
> > 1. Subitem 2
> > 1. Subitem 3
2024-07-08 15:37:38 +08:00
`,options:{numberStyle:"lazy"}}),new y({description:"Ordered list in blockquote has list items set to ascending numerical order when Number Style is `ascending`.",before:p`
2023-11-09 17:30:33 +08:00
> 1. Item 1
> 4. Item 2
> > 1. Subitem 1
> > 5. Subitem 2
> > 2. Subitem 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> 1. Item 1
> 2. Item 2
> > 1. Subitem 1
> > 2. Subitem 2
> > 3. Subitem 3
2024-07-08 15:37:38 +08:00
`}),new y({description:"Nested ordered list has list items set to '1)' when Number Style is `lazy` and Ordered List Indicator End Style is `)`.",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
1. Subitem 1
5. Subitem 2
2. Subitem 3
4. Item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1) Item 1
1) Item 2
1) Subitem 1
1) Subitem 2
1) Subitem 3
1) Item 3
2024-07-08 15:37:38 +08:00
`,options:{listEndStyle:")",numberStyle:"lazy"}})]}get optionBuilders(){return[new ie({OptionsClass:Gr,nameKey:"rules.ordered-list-style.number-style.name",descriptionKey:"rules.ordered-list-style.number-style.description",optionsKey:"numberStyle",records:[{value:"ascending",description:"Makes sure ordered list items are ascending (i.e. 1, 2, 3, etc.)"},{value:"lazy",description:"Makes sure ordered list item indicators all are the number 1"}]}),new ie({OptionsClass:Gr,nameKey:"rules.ordered-list-style.list-end-style.name",descriptionKey:"rules.ordered-list-style.list-end-style.description",optionsKey:"listEndStyle",records:[{value:".",description:"Makes sure ordered list items indicators end in '.' (i.e `1.`)"},{value:")",description:"Makes sure ordered list item indicators end in ')' (i.e. `1)`)"}]})]}};Vr=T([v.register],Vr);var nc=class{},Qr=class extends v{constructor(){super({nameKey:"rules.paragraph-blank-lines.name",descriptionKey:"rules.paragraph-blank-lines.description",type:"Spacing",ruleIgnoreTypes:[f.obsidianMultiLineComments,f.yaml,f.table]})}get OptionsClass(){return nc}apply(t,i){return Zu(t)}get exampleBuilders(){return[new y({description:"Paragraphs should be surrounded by blank lines",before:p`
2023-11-09 17:30:33 +08:00
# H1
Newlines are inserted.
A paragraph is a line that starts with a letter.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
${""}
Newlines are inserted.
${""}
A paragraph is a line that starts with a letter.
2024-07-08 15:37:38 +08:00
`}),new y({description:"Paragraphs can be extended via the use of 2 or more spaces at the end of a line, a line break html or xml, or a backslash (\\)",before:p`
2023-11-09 17:30:33 +08:00
# H1
Content${" "}
Paragraph content continued <br>
Paragraph content continued once more <br/>
2024-06-12 15:46:38 +08:00
Paragraph content yet again\\
2023-11-09 17:30:33 +08:00
Last line of paragraph
A new paragraph
# H2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
${""}
Content${" "}
Paragraph content continued <br>
Paragraph content continued once more <br/>
2024-06-12 15:46:38 +08:00
Paragraph content yet again\\
2023-11-09 17:30:33 +08:00
Last line of paragraph
${""}
A new paragraph
${""}
# H2
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Qr=T([v.register],Qr);var Zr=class{};T([v.noSettingControl()],Zr.prototype,"lineContent",2),T([v.noSettingControl()],Zr.prototype,"selectedText",2);var Yt=class extends v{constructor(){super({nameKey:"rules.prevent-double-checklist-indicator-on-paste.name",descriptionKey:"rules.prevent-double-checklist-indicator-on-paste.description",type:"Paste"})}get OptionsClass(){return Zr}apply(t,i){let n=Ap.test(i.lineContent),r=Es.test(t),a=Es.test(i.selectedText);return!n||!r||a?t:t.replace(Es,"")}get exampleBuilders(){return[new y({description:"Line being pasted is left alone when current line has no checklist indicator in it: `Regular text here`",before:p`
2023-11-09 17:30:33 +08:00
- [ ] Checklist item being pasted
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [ ] Checklist item being pasted
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"Regular text here",selectedText:""}}),new y({description:"Line being pasted into a blockquote without a checklist indicator is left alone when it lacks a checklist indicator: `> > `",before:p`
2023-11-09 17:30:33 +08:00
- [ ] Checklist item contents here
More content here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [ ] Checklist item contents here
More content here
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"> > ",selectedText:""}}),new y({description:"Line being pasted into a blockquote with a checklist indicator has its checklist indicator removed when current line is: `> - [x] `",before:p`
2023-11-09 17:30:33 +08:00
- [ ] Checklist item contents here
More content here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Checklist item contents here
More content here
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"> - [x] ",selectedText:""}}),new y({description:"Line being pasted with a checklist indicator has its checklist indicator removed when current line is: `- [ ] `",before:p`
2023-11-09 17:30:33 +08:00
- [x] Checklist item 1
- [ ] Checklist item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Checklist item 1
- [ ] Checklist item 2
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"- [ ] ",selectedText:""}}),new y({description:"Line being pasted as a checklist indicator has its checklist indicator removed when current line is: `- [!] `",before:p`
2023-11-09 17:30:33 +08:00
- [x] Checklist item 1
- [ ] Checklist item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Checklist item 1
- [ ] Checklist item 2
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"- [!] ",selectedText:""}}),new y({description:"When pasting a checklist and the selected text starts with a checklist, the text to paste should still start with a checklist",before:p`
2023-11-09 17:30:33 +08:00
- [x] Checklist item 1
- [ ] Checklist item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [x] Checklist item 1
- [ ] Checklist item 2
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"- [!] Some text here",selectedText:"- [!] Some text here"}})]}get optionBuilders(){return[]}};Yt=T([v.register],Yt);var Jr=class{};T([v.noSettingControl()],Jr.prototype,"lineContent",2),T([v.noSettingControl()],Jr.prototype,"selectedText",2);var jt=class extends v{constructor(){super({nameKey:"rules.prevent-double-list-item-indicator-on-paste.name",descriptionKey:"rules.prevent-double-list-item-indicator-on-paste.description",type:"Paste"})}get OptionsClass(){return Jr}apply(t,i){let n=new RegExp(`^${yr}[*+-] `),r=/^\s*[*+-] /,a=n.test(i.lineContent),s=n.test(i.selectedText),o=r.test(t);return s||!a||!o?t:t.replace(r,"")}get exampleBuilders(){return[new y({description:"Line being pasted is left alone when current line has no list indicator in it: `Regular text here`",before:p`
2023-11-09 17:30:33 +08:00
- List item being pasted
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- List item being pasted
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"Regular text here",selectedText:""}}),new y({description:"Line being pasted into a blockquote without a list indicator is left alone when it lacks a list indicator: `> > `",before:p`
2023-11-09 17:30:33 +08:00
* List item contents here
More content here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
* List item contents here
More content here
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"> > ",selectedText:""}}),new y({description:"Line being pasted into a blockquote with a list indicator is has its list indicator removed when current line is: `> * `",before:p`
2023-11-09 17:30:33 +08:00
+ List item contents here
More content here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
List item contents here
More content here
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"> * ",selectedText:""}}),new y({description:"Line being pasted with a list indicator is has its list indicator removed when current line is: `+ `",before:p`
2023-11-09 17:30:33 +08:00
- List item 1
- List item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
List item 1
- List item 2
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"+ ",selectedText:""}}),new y({description:"When pasting a list item and the selected text starts with a list item indicator, the text to paste should still start with a list item indicator",before:p`
2023-11-09 17:30:33 +08:00
- List item 1
- List item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- List item 1
- List item 2
2024-07-08 15:37:38 +08:00
`,options:{lineContent:"+ ",selectedText:"+ "}})]}get optionBuilders(){return[]}};jt=T([v.register],jt);var rc=class{},Pt=class extends v{constructor(){super({nameKey:"rules.proper-ellipsis-on-paste.name",descriptionKey:"rules.proper-ellipsis-on-paste.description",type:"Paste"})}get OptionsClass(){return rc}apply(t,i){return t.replaceAll(Ls,"\u2026")}get exampleBuilders(){return[new y({description:"Replacing three consecutive dots with an ellipsis even if spaces are present",before:p`
2023-11-09 17:30:33 +08:00
Lorem (...) Impsum.
Lorem (. ..) Impsum.
Lorem (. . .) Impsum.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem () Impsum.
Lorem () Impsum.
Lorem () Impsum.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Pt=T([v.register],Pt);var ac=class{},Xr=class extends v{constructor(){super({nameKey:"rules.proper-ellipsis.name",descriptionKey:"rules.proper-ellipsis.description",type:"Content"})}get OptionsClass(){return ac}apply(t,i){return Ee([f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag,f.image],t,n=>n.replaceAll(Ls,"\u2026"))}get exampleBuilders(){return[new y({description:"Replacing three consecutive dots with an ellipsis.",before:p`
2023-11-09 17:30:33 +08:00
Lorem (...) Impsum.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem () Impsum.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Xr=T([v.register],Xr);var Ht=class{constructor(){this.singleQuoteStyleEnabled=!0;this.singleQuoteStyle="''";this.doubleQuoteStyleEnabled=!0;this.doubleQuoteStyle='""'}},ea=class extends v{constructor(){super({nameKey:"rules.quote-style.name",descriptionKey:"rules.quote-style.description",type:"Content",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.yaml,f.math,f.inlineMath,f.html,f.link,f.wikiLink,f.templaterCommand,f.image]})}get OptionsClass(){return Ht}apply(t,i){let n=t;return i.doubleQuoteStyleEnabled&&(i.doubleQuoteStyle==='""'?n=this.convertSmartDoubleQuotesToStraightQuotes(n):n=this.convertStraightQuoteToSmartQuote(n,'"',"\u201C\u201D"[0],"\u201C\u201D"[1],!1)),i.singleQuoteStyleEnabled&&(i.singleQuoteStyle==="''"?n=this.convertSmartSingleQuotesToStraightQuotes(n):n=this.convertStraightQuoteToSmartQuote(n,"'","\u2018\u2019"[0],"\u2018\u2019"[1],!0)),n}convertSmartSingleQuotesToStraightQuotes(t){return t.replace(kp,"'")}convertSmartDoubleQuotesToStraightQuotes(t){return t.replace(wp,'"')}convertStraightQuoteToSmartQuote(t,i,n,r,a){let s=du(i,t);if(s.length===0)return t;let o=t.length-1,l,c="",d="",u=!1,g=!1,m=!1,h=!1,x=!1,b="";for(let k of s)c=k==0?"":t.charAt(k-1),d=k===o?"":t.charAt(k+1),u=Kl.test(c),g=Kl.test(d),x=u&&g,m=c!=""&&c.trim()==="",h=d!=""&&d.trim()==="",x&&a?l=r:h&&!m?(l=r,b=l):m&&!h?(l=n,b=l):(b===""||b===r?l=n:l=r,b=l),t=de(t,k,k+1,l);return t}get exampleBuilders(){return[new y({description:"Smart quotes used in file are converted to straight quotes when styles are set to `Straight`",before:p`
2023-11-09 17:30:33 +08:00
# Double Quote Cases
There are a bunch of different kinds of smart quote indicators
More than you would think
«Including this one for Spanish»
# Single Quote Cases
Simple smart quotes get replaced
Another single style smart quote also gets replaced
Even this style of single smart quotes is replaced
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Double Quote Cases
"There are a bunch of different kinds of smart quote indicators"
"More than you would think"
"Including this one for Spanish"
# Single Quote Cases
'Simple smart quotes get replaced'
'Another single style smart quote also gets replaced'
'Even this style of single smart quotes is replaced'
2024-07-08 15:37:38 +08:00
`}),new y({description:"Straight quotes used in file are converted to smart quotes when styles are set to `Smart`",before:p`
2023-11-09 17:30:33 +08:00
"As you can see, these double quotes will be converted to smart quotes"
"Common contractions are handled as well. For example can't is updated to smart quotes."
"Nesting a quote in a quote like so: 'here I am' is handled correctly"
'Single quotes by themselves are handled correctly'
Possessives are handled correctly: Pam's dog is really cool!
Templater commands are ignored: <% tp.date.now("YYYY-MM-DD", 7) %>
${""}
Be careful as converting straight quotes to smart quotes requires you to have an even amount of quotes
once possessives and common contractions have been dealt with. If not, it will throw an error.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
As you can see, these double quotes will be converted to smart quotes
Common contractions are handled as well. For example cant is updated to smart quotes.
Nesting a quote in a quote like so: here I am is handled correctly
Single quotes by themselves are handled correctly
Possessives are handled correctly: Pams dog is really cool!
Templater commands are ignored: <% tp.date.now("YYYY-MM-DD", 7) %>
${""}
Be careful as converting straight quotes to smart quotes requires you to have an even amount of quotes
once possessives and common contractions have been dealt with. If not, it will throw an error.
2024-07-08 15:37:38 +08:00
`,options:{singleQuoteStyle:"\u2018\u2019",doubleQuoteStyle:"\u201C\u201D"}})]}get optionBuilders(){return[new W({OptionsClass:Ht,nameKey:"rules.quote-style.single-quote-enabled.name",descriptionKey:"rules.quote-style.single-quote-enabled.description",optionsKey:"singleQuoteStyleEnabled"}),new ie({OptionsClass:Ht,nameKey:"rules.quote-style.single-quote-style.name",descriptionKey:"rules.quote-style.single-quote-style.description",optionsKey:"singleQuoteStyle",records:[{value:"''",description:`Uses "'" instead of smart single quotes`},{value:"\u2018\u2019",description:'Uses "\u2018" and "\u2019" instead of straight single quotes'}]}),new W({OptionsClass:Ht,nameKey:"rules.quote-style.double-quote-enabled.name",descriptionKey:"rules.quote-style.double-quote-enabled.description",optionsKey:"doubleQuoteStyleEnabled"}),new ie({OptionsClass:Ht,nameKey:"rules.quote-style.double-quote-style.name",descriptionKey:"rules.quote-style.double-quote-style.description",optionsKey:"doubleQuoteStyle",records:[{value:'""',description:`Uses '"' instead of smart double quotes`},{value:"\u201C\u201D",description:"Uses '\u201C' and '\u201D' instead of straight double quotes"}]})]}};ea=T([v.register],ea);var sc=class{},ia=class extends v{constructor(){super({nameKey:"rules.re-index-footnotes.name",descriptionKey:"rules.re-index-footnotes.description",type:"Footnote",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.yaml,f.tag]})}get OptionsClass(){return sc}apply(t,i){return Gu(t)}get exampleBuilders(){return[new y({description:"Re-indexing footnotes after having deleted previous footnotes",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum at aliquet felis.[^3] Donec dictum turpis quis pellentesque,[^5] et iaculis tortor condimentum.
${""}
[^3]: first footnote
[^5]: second footnote
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum at aliquet felis.[^1] Donec dictum turpis quis pellentesque,[^2] et iaculis tortor condimentum.
${""}
[^1]: first footnote
[^2]: second footnote
2024-07-08 15:37:38 +08:00
`}),new y({description:"Re-indexing footnotes after inserting a footnote between",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^1a] Vestibulum nec blandit felis, vulputate finibus purus.[^2] Praesent quis iaculis diam.
${""}
[^1]: first footnote
[^1a]: third footnote, inserted later
[^2]: second footnotes
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^2] Vestibulum nec blandit felis, vulputate finibus purus.[^3] Praesent quis iaculis diam.
${""}
[^1]: first footnote
[^2]: third footnote, inserted later
[^3]: second footnotes
2024-07-08 15:37:38 +08:00
`}),new y({description:"Re-indexing footnotes preserves multiple references to the same footnote index",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^1a] Vestibulum nec blandit felis, vulputate finibus purus.[^2] Praesent quis iaculis diam.[^1]
${""}
[^1]: first footnote
[^1a]: third footnote, inserted later
[^2]: second footnotes
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^2] Vestibulum nec blandit felis, vulputate finibus purus.[^3] Praesent quis iaculis diam.[^1]
${""}
[^1]: first footnote
[^2]: third footnote, inserted later
[^3]: second footnotes
2024-07-08 15:37:38 +08:00
`}),new y({description:"Re-indexing footnotes condense duplicate footnotes into 1 when key and footnote are the same",before:p`
2023-11-09 17:30:33 +08:00
bla[^1], bla[^1], bla[^2]
[^1]: bla
[^1]: bla
[^2]: bla
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
bla[^1], bla[^1], bla[^2]
[^1]: bla
[^2]: bla
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};ia=T([v.register],ia);var oc=class{},ta=class extends v{constructor(){super({nameKey:"rules.remove-consecutive-list-markers.name",descriptionKey:"rules.remove-consecutive-list-markers.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return oc}apply(t,i){return t.replace(/^([ |\t]*)- - \b/gm,"$1- ")}get exampleBuilders(){return[new y({description:"Removing consecutive list markers.",before:p`
2023-11-09 17:30:33 +08:00
- item 1
- - copypasted item A
- item 2
- indented item
- - copypasted item B
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- item 1
- copypasted item A
- item 2
- indented item
- copypasted item B
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};ta=T([v.register],ta);var lc=class{},na=class extends v{constructor(){super({nameKey:"rules.remove-empty-lines-between-list-markers-and-checklists.name",descriptionKey:"rules.remove-empty-lines-between-list-markers-and-checklists.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag,f.thematicBreak]});this.replaceEmptyLinesBetweenList=function(i,n){let r=new RegExp(`^${n}
2023-11-09 17:30:33 +08:00
{2,}${n}$`,"gm"),a,s=i;do a=s.match(r),s=s.replaceAll(r,`$1
2024-07-08 15:37:38 +08:00
$4`);while(a);return s}}get OptionsClass(){return lc}apply(i,n){let r=`(( |\\t)*- ${Ot}( |\\t)+.+)`;i=this.replaceEmptyLinesBetweenList(i,r),i=this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\d+\\.( |\\t)+.+)"),i=this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\+( |\\t)+.+)");let o=`(( |\\t)*-(?! ${Ot})( |\\t)+.+)`;return i=this.replaceEmptyLinesBetweenList(i,o),this.replaceEmptyLinesBetweenList(i,"(( |\\t)*\\*( |\\t)+.+)")}get exampleBuilders(){return[new y({description:"Blank lines are removed between ordered list items",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
${""}
2. Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blank lines are removed between list items when the list indicator is '-'",before:p`
2023-11-09 17:30:33 +08:00
- Item 1
${""}
\t- Subitem 1
${""}
- Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- Item 1
\t- Subitem 1
- Item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blank lines are removed between checklist items",before:p`
2023-11-09 17:30:33 +08:00
- [x] Item 1
${""}
\t- [!] Subitem 1
${""}
- [ ] Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [x] Item 1
\t- [!] Subitem 1
- [ ] Item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blank lines are removed between list items when the list indicator is '+'",before:p`
2023-11-09 17:30:33 +08:00
+ Item 1
${""}
\t+ Subitem 1
${""}
+ Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
+ Item 1
\t+ Subitem 1
+ Item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blank lines are removed between list items when the list indicator is '*'",before:p`
2023-11-09 17:30:33 +08:00
* Item 1
${""}
\t* Subitem 1
${""}
* Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
* Item 1
\t* Subitem 1
* Item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Blanks lines are removed between like list types (ordered, specific list item indicators, and checklists) while blanks are left between different kinds of list item indicators",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
${""}
2. Item 2
${""}
- Item 1
${""}
\t- Subitem 1
${""}
- Item 2
${""}
- [x] Item 1
${""}
\t- [f] Subitem 1
${""}
- [ ] Item 2
${""}
+ Item 1
${""}
\t+ Subitem 1
${""}
+ Item 2
${""}
* Item 1
${""}
\t* Subitem 1
${""}
* Item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
${""}
- Item 1
\t- Subitem 1
- Item 2
${""}
- [x] Item 1
\t- [f] Subitem 1
- [ ] Item 2
${""}
+ Item 1
\t+ Subitem 1
+ Item 2
${""}
* Item 1
\t* Subitem 1
* Item 2
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};na=T([v.register],na);var cc=class{},ra=class extends v{constructor(){super({nameKey:"rules.remove-empty-list-markers.name",descriptionKey:"rules.remove-empty-list-markers.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return cc}apply(t,i){let n=new RegExp(`^${yr}(-|\\*|\\+|\\d+[.)]|- (\\[(.)\\]))\\s*?$`,"gm");return t=t.replace(new RegExp(n.source+"\\n","gm"),""),t=t.replace(new RegExp("\\n"+n.source,"gm"),""),t.replace(n,"")}get exampleBuilders(){return[new y({description:"Removes empty list markers.",before:p`
2023-11-09 17:30:33 +08:00
- item 1
-
- item 2
${""}
* list 2 item 1
*
* list 2 item 2
${""}
+ list 3 item 1
+
+ list 3 item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- item 1
- item 2
${""}
* list 2 item 1
* list 2 item 2
${""}
+ list 3 item 1
+ list 3 item 2
2024-07-08 15:37:38 +08:00
`}),new y({description:"Removes empty ordered list markers.",before:p`
2023-11-09 17:30:33 +08:00
1. item 1
2.
3. item 2
${""}
1. list 2 item 1
2. list 2 item 2
3. ${""}
${""}
_Note that this rule does not make sure that the ordered list is sequential after removal_
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. item 1
3. item 2
${""}
1. list 2 item 1
2. list 2 item 2
${""}
_Note that this rule does not make sure that the ordered list is sequential after removal_
2024-07-08 15:37:38 +08:00
`}),new y({description:"Removes empty checklist markers.",before:p`
2023-11-09 17:30:33 +08:00
- [ ] item 1
- [x]
- [ ] item 2
- [ ] ${""}
${""}
_Note that this will affect checked and uncheck checked list items_
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- [ ] item 1
- [ ] item 2
${""}
_Note that this will affect checked and uncheck checked list items_
2024-07-08 15:37:38 +08:00
`}),new y({description:"Removes empty list, checklist, and ordered list markers in callouts/blockquotes",before:p`
2023-11-09 17:30:33 +08:00
> Checklist in blockquote
> - [ ] item 1
> - [x]
> - [ ] item 2
> - [ ] ${""}
${""}
> Ordered List in blockquote
> > 1. item 1
> > 2.
> > 3. item 2
> > 4. ${""}
${""}
> Regular lists in blockquote
>
> - item 1
> -
> - item 2
>
> List 2
>
> * item 1
> *
> * list 2 item 2
>
> List 3
>
> + item 1
> +
> + item 2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> Checklist in blockquote
> - [ ] item 1
> - [ ] item 2
${""}
> Ordered List in blockquote
> > 1. item 1
> > 3. item 2
${""}
> Regular lists in blockquote
>
> - item 1
> - item 2
>
> List 2
>
> * item 1
> * list 2 item 2
>
> List 3
>
> + item 1
> + item 2
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};ra=T([v.register],ra);var dc=class{},aa=class extends v{constructor(){super({nameKey:"rules.remove-hyphenated-line-breaks.name",descriptionKey:"rules.remove-hyphenated-line-breaks.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return dc}apply(t,i){return t.replace(/\b[-] \b/g,"")}get exampleBuilders(){return[new y({description:"Removing hyphenated line breaks.",before:p`
2023-11-09 17:30:33 +08:00
This text has a linebr eak.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
This text has a linebreak.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};aa=T([v.register],aa);var uc=class{},$t=class extends v{constructor(){super({nameKey:"rules.remove-hyphens-on-paste.name",descriptionKey:"rules.remove-hyphens-on-paste.description",type:"Paste"})}get OptionsClass(){return uc}apply(t,i){return t.replace(/([^\s-])[-]\s+\n?(?=\w)/g,"$1")}get exampleBuilders(){return[new y({description:"Remove hyphen in content to paste",before:p`
2023-11-09 17:30:33 +08:00
Text that was cool but hyper-
tension made it uncool.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Text that was cool but hypertension made it uncool.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};$t=T([v.register],$t);var pc=class{},Wt=class extends v{constructor(){super({nameKey:"rules.remove-leading-or-trailing-whitespace-on-paste.name",descriptionKey:"rules.remove-leading-or-trailing-whitespace-on-paste.description",type:"Paste"})}get OptionsClass(){return pc}apply(t,i){return t.replace(/^[\n ]+|\s+$/g,"")}get exampleBuilders(){return[new y({description:"Removes leading spaces and newline characters",before:p`
2023-11-09 17:30:33 +08:00
${""}
${""}
This text was really indented
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
This text was really indented
2024-07-08 15:37:38 +08:00
`}),new y({description:"Leaves leading tabs alone",before:p`
2023-11-09 17:30:33 +08:00
${""}
${""}
\t\tThis text is really indented
${""}
2024-07-08 15:37:38 +08:00
`,after:" This text is really indented"})]}get optionBuilders(){return[]}};Wt=T([v.register],Wt);var mc=class{},Ut=class extends v{constructor(){super({nameKey:"rules.remove-leftover-footnotes-from-quote-on-paste.name",descriptionKey:"rules.remove-leftover-footnotes-from-quote-on-paste.description",ruleIgnoreTypes:[f.wikiLink,f.link,f.image],type:"Paste"})}get OptionsClass(){return mc}apply(t,i){return t.replace(/(\D)[.,]\d+/g,"$1")}get exampleBuilders(){return[new y({description:"Footnote reference removed",before:p`
2023-11-09 17:30:33 +08:00
He was sure that he would get off without doing any time, but the cops had other plans.50
${""}
_Note that the format for footnote references to remove is a dot or comma followed by any number of digits_
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
He was sure that he would get off without doing any time, but the cops had other plans
${""}
_Note that the format for footnote references to remove is a dot or comma followed by any number of digits_
2024-07-08 15:37:38 +08:00
`}),new y({description:"Footnote reference removal does not affect links",before:p`
2023-11-09 17:30:33 +08:00
[[Half is .5]]
[Half is .5](HalfIs.5.md)
![](HalfIs.5.jpg)
![[Half is .5.jpg]]
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
[[Half is .5]]
[Half is .5](HalfIs.5.md)
![](HalfIs.5.jpg)
![[Half is .5.jpg]]
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Ut=T([v.register],Ut);var gc=class{},sa=class extends v{constructor(){super({nameKey:"rules.remove-link-spacing.name",descriptionKey:"rules.remove-link-spacing.description",type:"Spacing"})}get OptionsClass(){return gc}apply(t,i){return t=Ju(t),Tp(t)}get exampleBuilders(){return[new y({description:"Space in regular markdown link text",before:p`
2023-11-09 17:30:33 +08:00
[ here is link text1 ](link_here)
[ here is link text2](link_here)
[here is link text3 ](link_here)
[here is link text4](link_here)
[\there is link text5\t](link_here)
[](link_here)
**Note that image markdown syntax does not get affected even if it is transclusion:**
![\there is link text6 ](link_here)
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
[here is link text1](link_here)
[here is link text2](link_here)
[here is link text3](link_here)
[here is link text4](link_here)
[here is link text5](link_here)
[](link_here)
**Note that image markdown syntax does not get affected even if it is transclusion:**
![\there is link text6 ](link_here)
2024-07-08 15:37:38 +08:00
`}),new y({description:"Space in wiki link text",before:p`
2023-11-09 17:30:33 +08:00
[[link_here| here is link text1 ]]
[[link_here|here is link text2 ]]
[[link_here| here is link text3]]
[[link_here|here is link text4]]
[[link_here|\there is link text5\t]]
![[link_here|\there is link text6\t]]
[[link_here]]
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
[[link_here|here is link text1]]
[[link_here|here is link text2]]
[[link_here|here is link text3]]
[[link_here|here is link text4]]
[[link_here|here is link text5]]
![[link_here|here is link text6]]
[[link_here]]
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};sa=T([v.register],sa);var hc=class{},Vt=class extends v{constructor(){super({nameKey:"rules.remove-multiple-blank-lines-on-paste.name",descriptionKey:"rules.remove-multiple-blank-lines-on-paste.description",type:"Paste"})}get OptionsClass(){return hc}apply(t,i){return t.replace(/\n{3,}/g,`
2023-11-09 17:30:33 +08:00
2024-07-08 15:37:38 +08:00
`)}get exampleBuilders(){return[new y({description:"Multiple blanks lines condensed down to one",before:p`
2023-11-09 17:30:33 +08:00
Here is the first line.
${""}
${""}
${""}
${""}
Here is some more text.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Here is the first line.
${""}
Here is some more text.
2024-07-08 15:37:38 +08:00
`}),new y({description:"Text with only one blank line in a row is left alone",before:p`
2023-11-09 17:30:33 +08:00
First line.
${""}
Last line.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
First line.
${""}
Last line.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};Vt=T([v.register],Vt);var fc=class{},oa=class extends v{constructor(){super({nameKey:"rules.remove-multiple-spaces.name",descriptionKey:"rules.remove-multiple-spaces.description",type:"Content",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.inlineMath,f.yaml,f.link,f.wikiLink,f.tag,f.table]})}get OptionsClass(){return fc}apply(t,i){return t=t.replace(/(?!^>)([^\s])( ){2,}([^\s])/gm,"$1 $3"),t}get exampleBuilders(){return[new y({description:"Removing double and triple space.",before:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet.
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Lorem ipsum dolor sit amet.
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};oa=T([v.register],oa);var Gt=class{constructor(){this.includeFullwidthForms=!0;this.includeCJKSymbolsAndPunctuation=!0;this.includeDashes=!0;this.otherSymbols=""}},la=class extends v{constructor(){super({nameKey:"rules.remove-space-around-characters.name",descriptionKey:"rules.remove-space-around-characters.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.inlineCode,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return Gt}apply(t,i){let n="";if(i.includeFullwidthForms&&(n+="\uFF01-\uFF5E"),i.includeCJKSymbolsAndPunctuation&&(n+="\u3000-\u30FF"),i.includeDashes&&(n+="\u2013\u2014"),n+=at(i.otherSymbols),!n)return t;let r=new RegExp(`([ ])+([${n}])`,"g"),a=new RegExp(`([${n}])([ ])+`,"g"),s=function(l){return l.replace(r,"$2").replace(a,"$1")},o=Ee([f.list],t,s);return o=ks(o,s),o}get exampleBuilders(){return[new y({description:"Remove Spaces and Tabs around Fullwidth Characters",before:p`
2023-11-09 17:30:33 +08:00
Full list of affected characters: _
This is a fullwidth period\t with text after it.
This is a fullwidth comma\t with text after it.
This is a fullwidth left parenthesis \twith text after it.
This is a fullwidth right parenthesis with text after it.
This is a fullwidth colon with text after it.
This is a fullwidth semicolon with text after it.
emoves space at start of line
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
Full list of affected characters:_
This is a fullwidth periodwith text after it.
This is a fullwidth commawith text after it.
This is a fullwidth left parenthesiswith text after it.
This is a fullwidth right parenthesiswith text after it.
This is a fullwidth colonwith text after it.
This is a fullwidth semicolonwith text after it.
emoves space at start of line
2024-07-08 15:37:38 +08:00
`}),new y({description:"Fullwidth Characters in List Do not Affect List Markdown Syntax",before:p`
2023-11-09 17:30:33 +08:00
# List indicators should not have the space after them removed if they are followed by a fullwidth character
${""}
- contents here
- more contents here more text here
+ another item here
* one last item here
${""}
# Nested in a blockquote
${""}
> - contents here
> - more contents here more text here
> + another item here
> * one last item here
${""}
# Doubly nested in a blockquote
${""}
> The following is doubly nested
> > - contents here
> > - more contents here more text here
> > + another item here
> > * one last item here
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# List indicators should not have the space after them removed if they are followed by a fullwidth character
${""}
- contents here
- more contents heremore text here
+ another item here
* one last item here
${""}
# Nested in a blockquote
${""}
> - contents here
> - more contents heremore text here
> + another item here
> * one last item here
${""}
# Doubly nested in a blockquote
${""}
> The following is doubly nested
> > - contents here
> > - more contents heremore text here
> > + another item here
> > * one last item here
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[new W({nameKey:"rules.remove-space-around-characters.include-fullwidth-forms.name",descriptionKey:"rules.remove-space-around-characters.include-fullwidth-forms.description",OptionsClass:Gt,optionsKey:"includeFullwidthForms"}),new W({nameKey:"rules.remove-space-around-characters.include-cjk-symbols-and-punctuation.name",descriptionKey:"rules.remove-space-around-characters.include-cjk-symbols-and-punctuation.description",OptionsClass:Gt,optionsKey:"includeCJKSymbolsAndPunctuation"}),new W({nameKey:"rules.remove-space-around-characters.include-dashes.name",descriptionKey:"rules.remove-space-around-characters.include-dashes.description",OptionsClass:Gt,optionsKey:"includeDashes"}),new ke({nameKey:"rules.remove-space-around-characters.other-symbols.name",descriptionKey:"rules.remove-space-around-characters.other-symbols.description",OptionsClass:Gt,optionsKey:"otherSymbols"})]}};la=T([v.register],la);var da=class{constructor(){this.charactersToRemoveSpacesBefore=",!?;:).\u2019\u201D]";this.charactersToRemoveSpacesAfter="\xBF\xA1\u2018\u201C(["}},ca=class extends v{constructor(){super({nameKey:"rules.remove-space-before-or-after-characters.name",descriptionKey:"rules.remove-space-before-or-after-characters.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return da}apply(t,i){let n=at(i.charactersToRemoveSpacesBefore),r=at(i.charactersToRemoveSpacesAfter);if(!n&&!r)return t;let a=new RegExp(`([ ])+([${n}])`,"g"),s=new RegExp(`([${r}])([ ])+`,"g"),o=function(c){return c.replace(a,"$2").replace(s,"$1")},l=Ee([f.list,f.html],t,o);return l=ks(l,o),l}get exampleBuilders(){return[new y({description:"Remove Spaces and Tabs Before and After Default Symbol Set",before:p`
2023-11-09 17:30:33 +08:00
In the end , the space gets removed\t .
The space before the question mark was removed right ?
The space before the exclamation point gets removed !
A semicolon ; and colon : have spaces removed before them
Text in single quotes
Text in double quotes
[ Text in square braces ]
( Text in parenthesis )
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
In the end, the space gets removed.
The space before the question mark was removed right?
The space before the exclamation point gets removed!
A semicolon; and colon: have spaces removed before them
Text in single quotes
Text in double quotes
[Text in square braces]
(Text in parenthesis)
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[new ke({nameKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-before.name",descriptionKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-before.description",OptionsClass:da,optionsKey:"charactersToRemoveSpacesBefore"}),new ke({nameKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-after.name",descriptionKey:"rules.remove-space-before-or-after-characters.characters-to-remove-space-after.description",OptionsClass:da,optionsKey:"charactersToRemoveSpacesAfter"})]}};ca=T([v.register],ca);var io=class{constructor(){this.punctuationToRemove=".,;:!\u3002\uFF0C\uFF1B\uFF1A\uFF01"}},ua=class extends v{constructor(){super({nameKey:"rules.remove-trailing-punctuation-in-heading.name",descriptionKey:"rules.remove-trailing-punctuation-in-heading.description",type:"Heading",ruleIgnoreTypes:[f.code,f.math,f.yaml]})}get OptionsClass(){return io}apply(t,i){return t.replaceAll(rt,(n,r="",a="",s="",o="",l="")=>{if(o==""||o.match(xp))return n;let c=o.trimEnd(),d=c.charAt(c.length-1);return i.punctuationToRemove.includes(d)?r+a+s+o.substring(0,c.length-1)+o.substring(c.length)+l:n})}get exampleBuilders(){return[new y({description:"Removes punctuation from the end of a heading",before:p`
2023-11-09 17:30:33 +08:00
# Heading ends in a period.
## Other heading ends in an exclamation mark! ##
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading ends in a period
## Other heading ends in an exclamation mark ##
2024-07-08 15:37:38 +08:00
`}),new y({description:"HTML Entities at the end of a heading is ignored",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1
## Heading &amp;
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1
## Heading &amp;
2024-07-08 15:37:38 +08:00
`}),new y({description:"Removes punctuation from the end of a heading when followed by whitespace",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1!${" "}
## Heading 2.\t
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1${" "}
## Heading 2\t
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[new ke({OptionsClass:io,nameKey:"rules.remove-trailing-punctuation-in-heading.punctuation-to-remove.name",descriptionKey:"rules.remove-trailing-punctuation-in-heading.punctuation-to-remove.description",optionsKey:"punctuationToRemove"})]}};ua=T([v.register],ua);var to=class{constructor(){this.yamlKeysToRemove=[]}},pa=class extends v{constructor(){super({nameKey:"rules.remove-yaml-keys.name",descriptionKey:"rules.remove-yaml-keys.description",type:"YAML"})}get OptionsClass(){return to}apply(t,i){let n=i.yamlKeysToRemove;if(n.length===0)return t;let r=An(t);if(r===null)return t;let a=r;for(let s of n){let o=s.trim();o.endsWith(":")&&(o=o.substring(0,o.length-1)),a=Ct(a,o)}return t.replace(r,a)}get exampleBuilders(){return[new y({description:'Removes the values specified in `YAML Keys to Remove` = "status:\nkeywords\ndate"',before:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
keywords:
- keyword1
- keyword2
status: WIP
date: 02/15/2022
---
${""}
# Header Context
${""}
Text
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
---
${""}
# Header Context
${""}
Text
2024-07-08 15:37:38 +08:00
`,options:{yamlKeysToRemove:["status:","keywords","date"]}})]}get optionBuilders(){return[new me({OptionsClass:to,nameKey:"rules.remove-yaml-keys.yaml-keys-to-remove.name",descriptionKey:"rules.remove-yaml-keys.yaml-keys-to-remove.description",optionsKey:"yamlKeysToRemove"})]}};pa=T([v.register],pa);var mi=class{constructor(){this.aliasArrayStyle="single-line";this.sortAliasKey=!0;this.tagArrayStyle="single-line";this.sortTagKey=!0;this.sortArrayKeys=!0;this.sortOrder="Ascending Alphabetical";this.ignoreSortArrayKeys=[];this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};T([v.noSettingControl()],mi.prototype,"aliasArrayStyle",2),T([v.noSettingControl()],mi.prototype,"tagArrayStyle",2),T([v.noSettingControl()],mi.prototype,"defaultEscapeCharacter",2),T([v.noSettingControl()],mi.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var ma=class extends v{constructor(){super({nameKey:"rules.sort-yaml-array-values.name",descriptionKey:"rules.sort-yaml-array-values.description",type:"YAML"})}get OptionsClass(){return mi}apply(t,i){return ye(t,n=>{let r=oi(n.replace(`---
2024-02-26 20:05:21 +08:00
`,"").replace(`
2024-07-08 15:37:38 +08:00
---`,""));if(!r)return n;for(let a of xi)if(i.sortAliasKey&&Object.keys(r).includes(a)){n=oe(n,a,we(ot(this.sortArray(Fe(pe(n,a)),i.sortOrder)),i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0));break}for(let a of vi)if(i.sortTagKey&&Object.keys(r).includes(a)){n=oe(n,a,we(st(this.sortArray(Fe(pe(n,a)),i.sortOrder)),i.tagArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays));break}if(i.sortArrayKeys){let a=[...xi,...vi,...i.ignoreSortArrayKeys];for(let s of Object.keys(r)){if(a.includes(s)||!Array.isArray(r[s])||r[s].length!==0&&typeof r[s][0]=="object"&&r[s][0]!==null)continue;let o=pe(n,s),l="single-line";o.includes(`
`)&&(l="multi-line");let c=this.sortArray(Fe(o),i.sortOrder);n=oe(n,s,we(c,l,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays))}}return n})}sortArray(t,i){return t==null||typeof t=="string"||t.length<=1||(t.sort(function(n,r){let a=n.toLowerCase().localeCompare(r.toLowerCase());return a===0?n.localeCompare(r):a}),i==="Ascending Alphabetical")||t.reverse(),t}get exampleBuilders(){return[new y({description:"Sorting YAML array values alphabetically",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research, androids, Computer]
aliases:
- Title 1
- Title 2
---
`,after:p`
---
tags: [androids, computer, Computer, research]
aliases:
- Title 1
- Title 2
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Sorting YAML array values to be alphabetically descending",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research, androids, Computer]
aliases:
- Title 1
- Title 2
---
`,after:p`
---
tags: [research, Computer, computer, androids]
aliases:
- Title 2
- Title 1
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Sort YAML Arrays respects list of keys to not sort values of for normal arrays (keys to ignore is just `arr2` for this example)",before:p`
2024-02-26 20:05:21 +08:00
---
tags: [computer, research]
aliases:
- Title 1
- Title 2
arr1: [val, val2, val1]
arr2:
- val
- val2
- val1
---
`,after:p`
---
tags: [computer, research]
aliases:
- Title 1
- Title 2
arr1: [val, val1, val2]
arr2:
- val
- val2
- val1
---
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line",ignoreSortArrayKeys:["arr2"]}})]}get optionBuilders(){return[new W({OptionsClass:mi,nameKey:"rules.sort-yaml-array-values.sort-alias-key.name",descriptionKey:"rules.sort-yaml-array-values.sort-alias-key.description",optionsKey:"sortAliasKey"}),new W({OptionsClass:mi,nameKey:"rules.sort-yaml-array-values.sort-tag-key.name",descriptionKey:"rules.sort-yaml-array-values.sort-tag-key.description",optionsKey:"sortTagKey"}),new W({OptionsClass:mi,nameKey:"rules.sort-yaml-array-values.sort-array-keys.name",descriptionKey:"rules.sort-yaml-array-values.sort-array-keys.description",optionsKey:"sortArrayKeys"}),new me({OptionsClass:mi,nameKey:"rules.sort-yaml-array-values.ignore-keys.name",descriptionKey:"rules.sort-yaml-array-values.ignore-keys.description",optionsKey:"ignoreSortArrayKeys"}),new ie({OptionsClass:mi,nameKey:"rules.sort-yaml-array-values.sort-order.name",descriptionKey:"rules.sort-yaml-array-values.sort-order.description",optionsKey:"sortOrder",records:[{value:"Ascending Alphabetical",description:"Sorts the array values from a to z"},{value:"Descending Alphabetical",description:"Sorts the array values from z to a"}]})]}};ma=T([v.register],ma);var yc=class{},ga=class extends v{constructor(){super({nameKey:"rules.space-after-list-markers.name",descriptionKey:"rules.space-after-list-markers.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return yc}apply(t,i){return t=t.replace(/^(\s*\d+\.|\s*[-+*])[^\S\r\n]+/gm,"$1 "),t.replace(/^(\s*\d+\.|\s*[-+*]\s+\[[ xX]\])[^\S\r\n]+/gm,"$1 ")}get exampleBuilders(){return[new y({description:"A single space is left between the list marker and the text of the list item",before:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
${""}
- [ ] Item 1
- [x] Item 2
\t- [ ] Item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. Item 1
2. Item 2
${""}
- [ ] Item 1
- [x] Item 2
\t- [ ] Item 3
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[]}};ga=T([v.register],ga);var fa=class{constructor(){this.englishNonLetterCharactersAfterCJKCharacters=`-+'"([\xA5$`;this.englishNonLetterCharactersBeforeCJKCharacters=`-+;:'"\xB0%$)]`}},ha=class extends v{constructor(){super({nameKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.name",descriptionKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.description",type:"Spacing",ruleIgnoreTypes:[f.code,f.inlineCode,f.yaml,f.image,f.link,f.wikiLink,f.tag,f.math,f.inlineMath,f.html]})}get OptionsClass(){return fa}apply(t,i){let n=this.buildHeadRegex(i.englishNonLetterCharactersAfterCJKCharacters),r=this.buildTailRegex(i.englishNonLetterCharactersBeforeCJKCharacters),a=`${f.link.placeholder}|${f.inlineMath.placeholder}|${f.inlineCode.placeholder}|${f.wikiLink.placeholder}`.replaceAll("{","\\{").replaceAll("}","\\}"),s=new RegExp(`(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})( *)(${a})`,"gmu"),o=new RegExp(`(${a})( *)(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})`,"gmu"),l=function(d){return d.replace(n,"$1 $3").replace(r,"$1 $3")},c=Ee([f.italics,f.bold],t,l);return c=c.replace(s,"$1 $3").replace(o,"$1 $3"),c=Xu(c,l),c=ep(c,l),c}buildHeadRegex(t){t&&t!==""&&(t=t.replaceAll(/\s/g,""));let i="";return t&&t.length!=0&&(i=`|[${at(t)}]`),new RegExp(`(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})( *)(\\[[^[]*\\]\\(.*\\)|\`[^\`]*\`|\\w+${i}|\\*[^*])`,"gmu")}buildTailRegex(t){t&&t!==""&&(t=t.replaceAll(/\s/g,""));let i="";return t&&t.length!=0&&(i=`|[${at(t)}]`),new RegExp(`(\\[[^[]*\\]\\(.*\\)|\`[^\`]*\`|\\w+${i}|[^*]\\*)( *)(\\p{sc=Han}|\\p{sc=Katakana}|\\p{sc=Hiragana}|\\p{sc=Hangul})`,"gmu")}get exampleBuilders(){return[new y({description:"Space between Chinese and English",before:p`
2023-11-09 17:30:33 +08:00
中文字符串english中文字符串
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
中文字符串 english 中文字符串
2024-07-08 15:37:38 +08:00
`}),new y({description:"Space between Chinese and link",before:p`
2023-11-09 17:30:33 +08:00
中文字符串[english](http://example.com)中文字符串。
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
中文字符串 [english](http://example.com) 中文字符串。
2024-07-08 15:37:38 +08:00
`}),new y({description:"Space between Chinese and inline code block",before:p`
2023-11-09 17:30:33 +08:00
中文字符串\`code\`中文字符串。
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
中文字符串 \`code\` 中文字符串。
2024-07-08 15:37:38 +08:00
`}),new y({description:"No space between Chinese and English in tag",before:p`
2023-11-09 17:30:33 +08:00
#标签A #标签2标签
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
#标签A #标签2标签
2024-07-08 15:37:38 +08:00
`}),new y({description:"Make sure that spaces are not added between italics and chinese characters to preserve markdown syntax",before:p`
2023-11-09 17:30:33 +08:00
_这是一个数学公式_
*这是一个数学公式english*
${""}
# Handling bold and italics nested in each other is not supported at this time
${""}
**_这是一_个数学公式**
*这是一hello__个数学world公式__*
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
_这是一个数学公式_
*这是一个数学公式 english*
${""}
# Handling bold and italics nested in each other is not supported at this time
${""}
**_ 这是一 _ 个数学公式**
*这是一 hello__ 个数学 world 公式 __*
2024-07-08 15:37:38 +08:00
`}),new y({description:"Images and links are ignored",before:p`
2023-11-09 17:30:33 +08:00
[[这是一个数学公式english]]
![[这是一个数学公式english.jpg]]
[这是一个数学公式english](这是一个数学公式english.md)
![这是一个数学公式english](这是一个数学公式english.jpg)
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
[[这是一个数学公式english]]
![[这是一个数学公式english.jpg]]
[这是一个数学公式english](这是一个数学公式english.md)
![这是一个数学公式english](这是一个数学公式english.jpg)
2024-07-08 15:37:38 +08:00
`}),new y({description:"Space between CJK and English",before:p`
2023-11-09 17:30:33 +08:00
日本語englishひらがな
カタカナenglishカタカナ
ハンカクカタカナenglish全角数字
한글english한글
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
日本語 english ひらがな
カタカナ english カタカナ
ハンカクカタカナ english全角数字
한글 english 한글
2024-07-08 15:37:38 +08:00
`})]}get optionBuilders(){return[new ke({OptionsClass:fa,nameKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-before.name",descriptionKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-before.description",optionsKey:"englishNonLetterCharactersBeforeCJKCharacters"}),new ke({OptionsClass:fa,nameKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-after.name",descriptionKey:"rules.space-between-chinese-japanese-or-korean-and-english-or-numbers.english-symbols-punctuation-after.description",optionsKey:"englishNonLetterCharactersAfterCJKCharacters"})]}};ha=T([v.register],ha);var no=class{constructor(){this.style="consistent"}},ya=class extends v{constructor(){super({nameKey:"rules.strong-style.name",descriptionKey:"rules.strong-style.description",type:"Content",ruleIgnoreTypes:[f.code,f.yaml,f.link,f.wikiLink,f.tag,f.math,f.inlineMath]})}get OptionsClass(){return no}apply(t,i){return ws(t,i.style,"strong")}get exampleBuilders(){return[new y({description:"Strong indicators should use underscores when style is set to 'underscore'",before:p`
2023-11-09 17:30:33 +08:00
# Strong/Bold Cases
${""}
**Test bold**
** Test not bold **
This is **bold** mid sentence
This is **bold** mid sentence with a second **bold** on the same line
This is ***bold and emphasized***
This is ***nested bold** and ending emphasized*
This is ***nested emphasis* and ending bold**
${""}
*Test emphasis*
${""}
* List Item1 with **bold text**
* List Item2
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Strong/Bold Cases
${""}
__Test bold__
** Test not bold **
This is __bold__ mid sentence
This is __bold__ mid sentence with a second __bold__ on the same line
This is *__bold and emphasized__*
This is *__nested bold__ and ending emphasized*
This is __*nested emphasis* and ending bold__
${""}
*Test emphasis*
${""}
* List Item1 with __bold text__
* List Item2
2024-07-08 15:37:38 +08:00
`,options:{style:"underscore"}}),new y({description:"Strong indicators should use asterisks when style is set to 'asterisk'",before:p`
2023-11-09 17:30:33 +08:00
# Strong/Bold Cases
${""}
__Test bold__
__ Test not bold __
This is __bold__ mid sentence
This is __bold__ mid sentence with a second __bold__ on the same line
This is ___bold and emphasized___
This is ___nested bold__ and ending emphasized_
This is ___nested emphasis_ and ending bold__
${""}
_Test emphasis_
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Strong/Bold Cases
${""}
**Test bold**
__ Test not bold __
This is **bold** mid sentence
This is **bold** mid sentence with a second **bold** on the same line
This is _**bold and emphasized**_
This is _**nested bold** and ending emphasized_
This is **_nested emphasis_ and ending bold**
${""}
_Test emphasis_
2024-07-08 15:37:38 +08:00
`,options:{style:"asterisk"}}),new y({description:"Strong indicators should use consistent style based on first strong indicator in a file when style is set to 'consistent'",before:p`
2023-11-09 17:30:33 +08:00
# Strong First Strong Is an Asterisk
${""}
**First bold**
This is __bold__ mid sentence
This is __bold__ mid sentence with a second **bold** on the same line
This is ___bold and emphasized___
This is *__nested bold__ and ending emphasized*
This is **_nested emphasis_ and ending bold**
${""}
__Test bold__
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Strong First Strong Is an Asterisk
${""}
**First bold**
This is **bold** mid sentence
This is **bold** mid sentence with a second **bold** on the same line
This is _**bold and emphasized**_
This is ***nested bold** and ending emphasized*
This is **_nested emphasis_ and ending bold**
${""}
**Test bold**
2024-07-08 15:37:38 +08:00
`,options:{style:"consistent"}}),new y({description:"Strong indicators should use consistent style based on first strong indicator in a file when style is set to 'consistent'",before:p`
2023-11-09 17:30:33 +08:00
# Strong First Strong Is an Underscore
${""}
__First bold__
This is **bold** mid sentence
This is **bold** mid sentence with a second __bold__ on the same line
This is **_bold and emphasized_**
This is ***nested bold** and ending emphasized*
This is ___nested emphasis_ and ending bold__
${""}
**Test bold**
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Strong First Strong Is an Underscore
${""}
__First bold__
This is __bold__ mid sentence
This is __bold__ mid sentence with a second __bold__ on the same line
This is ___bold and emphasized___
This is *__nested bold__ and ending emphasized*
This is ___nested emphasis_ and ending bold__
${""}
__Test bold__
2024-07-08 15:37:38 +08:00
`,options:{style:"consistent"}})]}get optionBuilders(){return[new ie({OptionsClass:no,nameKey:"rules.strong-style.style.name",descriptionKey:"rules.strong-style.style.description",optionsKey:"style",records:[{value:"consistent",description:"Makes sure the first instance of strong is the style that will be used throughout the document"},{value:"asterisk",description:"Makes sure ** is the strong indicator"},{value:"underscore",description:"Makes sure __ is the strong indicator"}]})]}};ya=T([v.register],ya);var ro=class{constructor(){this.twoSpaceLineBreak=!1}},Qt=class extends v{constructor(){super({nameKey:"rules.trailing-spaces.name",descriptionKey:"rules.trailing-spaces.description",type:"Spacing",hasSpecialExecutionOrder:!0,ruleIgnoreTypes:[f.code,f.math,f.yaml,f.link,f.wikiLink,f.tag]})}get OptionsClass(){return ro}apply(t,i){return i.twoSpaceLineBreak?(t=t.replace(/(\S)[ \t]$/gm,"$1"),t=t.replace(/(\S)[ \t]{3,}$/gm,"$1"),t=t.replace(/(\S)( ?\t\t? ?)$/gm,"$1"),t):t.replace(/[ \t]+$/gm,"")}get exampleBuilders(){return[new y({description:"Removes trailing spaces and tabs.",before:p`
2023-11-09 17:30:33 +08:00
# H1
Line with trailing spaces and tabs. ${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
Line with trailing spaces and tabs.
2024-07-08 15:37:38 +08:00
`}),new y({description:"With `Two Space Linebreak = true`",before:p`
2023-11-09 17:30:33 +08:00
# H1
Line with trailing spaces and tabs. ${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# H1
Line with trailing spaces and tabs. ${""}
2024-07-08 15:37:38 +08:00
`,options:{twoSpaceLineBreak:!0}})]}get optionBuilders(){return[new W({OptionsClass:ro,nameKey:"rules.trailing-spaces.twp-space-line-break.name",descriptionKey:"rules.trailing-spaces.twp-space-line-break.description",optionsKey:"twoSpaceLineBreak"})]}};Qt=T([v.register],Qt);var ao=class{constructor(){this.lineBreakIndicator=" "}},ba=class extends v{constructor(){super({nameKey:"rules.two-spaces-between-lines-with-content.name",descriptionKey:"rules.two-spaces-between-lines-with-content.description",type:"Content",ruleIgnoreTypes:[f.obsidianMultiLineComments,f.yaml,f.table]})}get OptionsClass(){return ao}apply(t,i){return Qu(t,i.lineBreakIndicator)}get exampleBuilders(){return[new y({description:"Make sure two spaces are added to the ends of lines that have content on it and the next line for lists, blockquotes, and paragraphs when the line break indicator is ` `",before:p`
2023-11-09 17:30:33 +08:00
# Heading 1
First paragraph stays as the first paragraph
${""}
- list item 1
- list item 2
Continuation of list item 2
- list item 3
${""}
1. Item 1
2. Item 2
Continuation of item 3
3. Item 3
${""}
Paragraph for with link [[other file name]].
Continuation *of* the paragraph has \`inline code block\` __in it__.
Even more continuation
${""}
Paragraph lines that end in <br/>
Or lines that end in <br>
2024-06-12 15:46:38 +08:00
Are left swapped
2023-11-09 17:30:33 +08:00
Since they mean the same thing
${""}
\`\`\` text
Code blocks are ignored
Even with multiple lines
\`\`\`
Another paragraph here
${""}
> Blockquotes are affected
> More content here
Content here
${""}
<div>
html content
should be ignored
</div>
Even more content here
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
# Heading 1
First paragraph stays as the first paragraph
${""}
- list item 1
- list item 2 ${""}
Continuation of list item 2
- list item 3
${""}
1. Item 1
2. Item 2 ${""}
Continuation of item 3
3. Item 3
${""}
Paragraph for with link [[other file name]]. ${""}
Continuation *of* the paragraph has \`inline code block\` __in it__. ${""}
Even more continuation
${""}
2024-06-12 15:46:38 +08:00
Paragraph lines that end in ${""}
Or lines that end in ${""}
Are left swapped ${""}
2023-11-09 17:30:33 +08:00
Since they mean the same thing
${""}
\`\`\` text
Code blocks are ignored
Even with multiple lines
\`\`\`
Another paragraph here
${""}
> Blockquotes are affected ${""}
> More content here ${""}
Content here
${""}
<div>
html content
should be ignored
</div>
Even more content here
${""}
2024-07-08 15:37:38 +08:00
`,options:{lineBreakIndicator:" "}})]}get optionBuilders(){return[new ie({OptionsClass:ao,nameKey:"rules.two-spaces-between-lines-with-content.line-break-indicator.name",descriptionKey:"rules.two-spaces-between-lines-with-content.line-break-indicator.description",optionsKey:"lineBreakIndicator",records:[{value:" ",description:" "},{value:"<br/>",description:"<br/>"},{value:"<br>",description:"<br>"},{value:"\\",description:"\\"}]})]}};ba=T([v.register],ba);var so=class{constructor(){this.listStyle="consistent"}},va=class extends v{constructor(){super({nameKey:"rules.unordered-list-style.name",descriptionKey:"rules.unordered-list-style.description",type:"Content",ruleIgnoreTypes:[f.code,f.math,f.yaml,f.tag]})}get OptionsClass(){return so}apply(t,i){return ap(t,i.listStyle)}get exampleBuilders(){return[new y({description:"Unordered lists have their indicator updated to `*` when `List item style = 'consistent'` and `*` is the first unordered list indicator",before:p`
2023-11-09 17:30:33 +08:00
1. ordered item 1
2. ordered item 2
${""}
Checklists should be ignored
- [ ] Checklist item 1
- [x] completed item
${""}
* Item 1
- Sublist 1 item 1
- Sublist 1 item 2
- Item 2
+ Sublist 2 item 1
+ Sublist 2 item 2
+ Item 3
* Sublist 3 item 1
* Sublist 3 item 2
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
1. ordered item 1
2. ordered item 2
${""}
Checklists should be ignored
- [ ] Checklist item 1
- [x] completed item
${""}
* Item 1
* Sublist 1 item 1
* Sublist 1 item 2
* Item 2
* Sublist 2 item 1
* Sublist 2 item 2
* Item 3
* Sublist 3 item 1
* Sublist 3 item 2
${""}
2024-07-08 15:37:38 +08:00
`}),new y({description:"Unordered lists have their indicator updated to `-` when `List item style = '-'`",before:p`
2023-11-09 17:30:33 +08:00
- Item 1
* Sublist 1 item 1
* Sublist 1 item 2
* Item 2
+ Sublist 2 item 1
+ Sublist 2 item 2
+ Item 3
- Sublist 3 item 1
- Sublist 3 item 2
${""}
See that the ordered list is ignored, but its sublist is not
${""}
1. Item 1
- Sub item 1
1. Item 2
* Sub item 2
1. Item 3
+ Sub item 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
- Item 1
- Sublist 1 item 1
- Sublist 1 item 2
- Item 2
- Sublist 2 item 1
- Sublist 2 item 2
- Item 3
- Sublist 3 item 1
- Sublist 3 item 2
${""}
See that the ordered list is ignored, but its sublist is not
${""}
1. Item 1
- Sub item 1
1. Item 2
- Sub item 2
1. Item 3
- Sub item 3
2024-07-08 15:37:38 +08:00
`,options:{listStyle:"-"}}),new y({description:"Unordered lists have their indicator updated to `*` when `List item style = '*'`",before:p`
2023-11-09 17:30:33 +08:00
- Item 1
* Sublist 1 item 1
* Sublist 1 item 2
* Item 2
+ Sublist 2 item 1
+ Sublist 2 item 2
+ Item 3
- Sublist 3 item 1
- Sublist 3 item 2
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
* Item 1
* Sublist 1 item 1
* Sublist 1 item 2
* Item 2
* Sublist 2 item 1
* Sublist 2 item 2
* Item 3
* Sublist 3 item 1
* Sublist 3 item 2
${""}
2024-07-08 15:37:38 +08:00
`,options:{listStyle:"*"}}),new y({description:"Unordered list in blockquote has list item indicators set to `+` when `List item style = '-'`",before:p`
2023-11-09 17:30:33 +08:00
> - Item 1
> + Item 2
> > * Subitem 1
> > + Subitem 2
> > - Sub sub item 1
> > - Subitem 3
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
> + Item 1
> + Item 2
> > + Subitem 1
> > + Subitem 2
> > + Sub sub item 1
> > + Subitem 3
2024-07-08 15:37:38 +08:00
`,options:{listStyle:"+"}})]}get optionBuilders(){return[new ie({OptionsClass:so,nameKey:"rules.unordered-list-style.list-style.name",descriptionKey:"rules.unordered-list-style.list-style.description",optionsKey:"listStyle",records:[{value:"consistent",description:"Makes sure unordered list items use a consistent list item indicator in the file which will be based on the first list item found"},{value:"-",description:"Makes sure unordered list items use `-` as their indicator"},{value:"*",description:"Makes sure unordered list items use `*` as their indicator"},{value:"+",description:"Makes sure unordered list items use `+` as their indicator"}]})]}};va=T([v.register],va);var Hi=class{constructor(){this.priorityKeysAtStartOfYaml=!0;this.yamlKeyPrioritySortOrder=[];this.yamlSortOrderForOtherKeys="None"}};T([v.noSettingControl()],Hi.prototype,"dateModifiedKey",2),T([v.noSettingControl()],Hi.prototype,"currentTimeFormatted",2),T([v.noSettingControl()],Hi.prototype,"yamlTimestampDateModifiedEnabled",2);var Zt=class extends v{constructor(){super({nameKey:"rules.yaml-key-sort.name",descriptionKey:"rules.yaml-key-sort.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Hi}apply(t,i){let n=An(t);if(n===null)return t;let r=n,a=i.priorityKeysAtStartOfYaml,s=i.yamlKeyPrioritySortOrder,o=0;for(let x of s)x.endsWith(":")&&(s[o]=x.substring(0,x.length-1)),o++;let l=oi(r),c=this.getYAMLKeysSorted(r,s,l),d=c.sortedYamlKeyValues;r=c.remainingYaml;let u=i.yamlSortOrderForOtherKeys;if(l==null)return this.getTextWithNewYamlFrontmatter(t,n,d,r,a,i.dateModifiedKey,i.currentTimeFormatted,i.yamlTimestampDateModifiedEnabled);let g=Object.keys(l),m;if(u==="Ascending Alphabetical")m=this.sortAlphabeticallyAsc;else if(u==="Descending Alphabetical")m=this.sortAlphabeticallyDesc;else return this.getTextWithNewYamlFrontmatter(t,n,d,r,a,i.dateModifiedKey,i.currentTimeFormatted,i.yamlTimestampDateModifiedEnabled);g=g.sort(m);let h=this.getYAMLKeysSorted(r,g,l);return this.getTextWithNewYamlFrontmatter(t,n,d,h.sortedYamlKeyValues,a,i.dateModifiedKey,i.currentTimeFormatted,i.yamlTimestampDateModifiedEnabled)}getYAMLKeysSorted(t,i,n){let r="";for(let a of i){if(!(a in n))continue;let s=pe(t,a,!1);s!==null&&(s.includes(`
2024-01-10 16:42:54 +08:00
`)?r+=`${a}:${s}
`:r+=`${a}: ${s}
2024-07-08 15:37:38 +08:00
`,t=Ct(t,a,!1))}return{remainingYaml:t,sortedYamlKeyValues:r}}updateDateModifiedIfYamlChanged(t,i,n,r){return t==i?i:oe(i,n," "+r)}getTextWithNewYamlFrontmatter(t,i,n,r,a,s,o,l){let c=`${r}${n}`;return a&&(c=`${n}${r}`),l&&(c=this.updateDateModifiedIfYamlChanged(i,c,s,o)),t.replace(i,c)}sortAlphabeticallyAsc(t,i){return t=t.toLowerCase(),i=i.toLowerCase(),t<i?-1:i<t?1:0}sortAlphabeticallyDesc(t,i){return t=t.toLowerCase(),i=i.toLowerCase(),t>i?-1:i>t?1:0}get exampleBuilders(){return[new y({description:"Sorts YAML keys in order specified by `YAML Key Priority Sort Order` has a sort order of `date type language`",before:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
keywords: []
status: WIP
date: 02/15/2022
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date: 02/15/2022
type: programming
language: Typescript
tags: computer
keywords: []
status: WIP
---
2024-07-08 15:37:38 +08:00
`,options:{yamlKeyPrioritySortOrder:["date","type","language"],yamlSortOrderForOtherKeys:"None",priorityKeysAtStartOfYaml:!0}}),new y({description:"Sorts YAML keys in order specified by `YAML Key Priority Sort Order` has a sort order of `date type language` with `'YAML Sort Order for Other Keys' = Ascending Alphabetical`",before:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
keywords: []
status: WIP
date: 02/15/2022
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date: 02/15/2022
type: programming
language: Typescript
keywords: []
status: WIP
tags: computer
---
2024-07-08 15:37:38 +08:00
`,options:{yamlKeyPrioritySortOrder:["date","type","language"],yamlSortOrderForOtherKeys:"Ascending Alphabetical"}}),new y({description:"Sorts YAML keys in order specified by `YAML Key Priority Sort Order` has a sort order of `date type language` with `'YAML Sort Order for Other Keys' = Descending Alphabetical`",before:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
keywords: []
status: WIP
date: 02/15/2022
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date: 02/15/2022
type: programming
language: Typescript
tags: computer
status: WIP
keywords: []
---
2024-07-08 15:37:38 +08:00
`,options:{yamlKeyPrioritySortOrder:["date","type","language"],yamlSortOrderForOtherKeys:"Descending Alphabetical",priorityKeysAtStartOfYaml:!0}}),new y({description:"Sorts YAML keys in order specified by `YAML Key Priority Sort Order` has a sort order of `date type language` with `'YAML Sort Order for Other Keys' = Descending Alphabetical` and `'Priority Keys at Start of YAML' = false`",before:p`
2023-11-09 17:30:33 +08:00
---
language: Typescript
type: programming
tags: computer
keywords: []
${""}
status: WIP
date: 02/15/2022
---
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
tags: computer
status: WIP
keywords: []
date: 02/15/2022
type: programming
language: Typescript
---
2024-07-08 15:37:38 +08:00
`,options:{yamlKeyPrioritySortOrder:["date","type","language"],yamlSortOrderForOtherKeys:"Descending Alphabetical",priorityKeysAtStartOfYaml:!1}})]}get optionBuilders(){return[new me({OptionsClass:Hi,nameKey:"rules.yaml-key-sort.yaml-key-priority-sort-order.name",descriptionKey:"rules.yaml-key-sort.yaml-key-priority-sort-order.description",optionsKey:"yamlKeyPrioritySortOrder"}),new W({OptionsClass:Hi,nameKey:"rules.yaml-key-sort.priority-keys-at-start-of-yaml.name",descriptionKey:"rules.yaml-key-sort.priority-keys-at-start-of-yaml.description",optionsKey:"priorityKeysAtStartOfYaml"}),new ie({OptionsClass:Hi,nameKey:"rules.yaml-key-sort.yaml-sort-order-for-other-keys.name",descriptionKey:"rules.yaml-key-sort.yaml-sort-order-for-other-keys.description",optionsKey:"yamlSortOrderForOtherKeys",records:[{value:"None",description:"No sorting other than what is in the YAML Key Priority Sort Order text area"},{value:"Ascending Alphabetical",description:"Sorts the keys based on key value from a to z"},{value:"Descending Alphabetical",description:"Sorts the keys based on key value from z to a"}]})]}};Zt=T([v.register],Zt);var Oe=require("obsidian");var wc=pn($p());var Ue=class{constructor(){this.dateCreatedKey="date created";this.dateCreated=!0;this.forceRetentionOfCreatedValue=!1;this.format="dddd, MMMM Do YYYY, h:mm:ss a";this.dateModified=!0;this.dateModifiedKey="date modified";this.convertToUTC=!1;this.locale="en"}};T([v.noSettingControl()],Ue.prototype,"alreadyModified",2),T([v.noSettingControl()],Ue.prototype,"fileCreatedTime",2),T([v.noSettingControl()],Ue.prototype,"fileModifiedTime",2),T([v.noSettingControl()],Ue.prototype,"locale",2),T([v.noSettingControl()],Ue.prototype,"currentTime",2),T([v.noSettingControl()],Ue.prototype,"fileName",2);var pt=class extends v{constructor(){super({nameKey:"rules.yaml-timestamp.name",descriptionKey:"rules.yaml-timestamp.description",type:"YAML",hasSpecialExecutionOrder:!0})}get OptionsClass(){return Ue}apply(t,i){let n=i.alreadyModified,r=Ci(t);return n=n||r!==t,i.format=i.format.trimEnd(),ye(r,a=>{if(i.dateCreated){let s=!1;[a,s]=this.handleDateCreatedValue(a,i),n=n||s}return i.dateModified&&(a=this.handleDateModifiedValue(a,n,i)),a})}handleDateCreatedValue(t,i){let n=!1,r=`
2023-11-09 17:30:33 +08:00
${i.dateCreatedKey}: [^
]+
`,a=`
${i.dateCreatedKey}:[ ]*
2024-07-08 15:37:38 +08:00
`,s=new RegExp(a),o=new RegExp(r),l=(0,Oe.moment)(i.fileCreatedTime);l.locale(i.locale);let c=i.convertToUTC?l.utc().format(i.format):l.format(i.format),d=`
${i.dateCreatedKey}: ${c}`,u=o.test(t);if(!u&&s.test(t))t=t.replace(s,Xe(d)+`
`),n=!0;else if(u){if(u){let g=this.getYAMLTimestampString(t,o,i.dateCreatedKey),m=(0,wc.default)(g);if(i.forceRetentionOfCreatedValue&&i.format!==m){let h=this.parseValueToCurrentFormatIfPossible(g,i.format,i.locale,i.convertToUTC);if(h==null)throw new Error(E("logs.invalid-date-format-error").replace("{DATE}",g).replace("{FILE_NAME}",i.fileName));let x=i.convertToUTC?h.utc().format(i.format):h.format(i.format);if(x!==g){let b=`
${i.dateCreatedKey}: ${x}`;t=t.replace(o,Xe(b)+`
`),n=!0}}else if(!i.forceRetentionOfCreatedValue){let h=(0,Oe.moment)(g,i.format,i.locale,!0);(h==null||!h.isValid())&&(t=t.replace(o,Xe(d)+`
2023-12-10 12:54:30 +08:00
`),n=!0)}}}else{let g=t.indexOf(`
2024-06-12 15:46:38 +08:00
---`);t=At(t,g,`
2023-12-10 12:54:30 +08:00
${i.dateCreatedKey}: ${c}`),n=!0}return[t,n]}handleDateModifiedValue(t,i,n){let r=`
2023-11-09 17:30:33 +08:00
${n.dateModifiedKey}: [^
]+
`,a=`
${n.dateModifiedKey}:[ ]*
2024-07-08 15:37:38 +08:00
`,s=new RegExp(a),o=new RegExp(r),l=(0,Oe.moment)(n.fileModifiedTime);l.locale(n.locale);let c=n.convertToUTC?n.currentTime.utc().format(n.format):n.currentTime.format(n.format),d=`
${n.dateModifiedKey}: ${c}`,u=o.test(t);if(u){let g=(0,Oe.moment)(t.match(o)[0].replace(n.dateModifiedKey+":","").trim(),n.format,n.locale,!0);(i||g==null||!g.isValid()||this.getTimeDifferenceInSeconds(g,l,n)>5)&&(t=t.replace(o,Xe(d)+`
`))}else if(s.test(t))t=t.replace(s,Xe(d)+`
2023-12-10 12:54:30 +08:00
`);else if(!u){let g=t.indexOf(`
2024-07-08 15:37:38 +08:00
---`);t=At(t,g,d)}return t}parseValueToCurrentFormatIfPossible(t,i,n,r){if(t==null)return null;let a=r?Oe.moment.utc(t,i,n,!0):(0,Oe.moment)(t,i,n,!0);if(a!=null&&a.isValid())return a;let s=(0,wc.default)(t);if(s!=null){let o=r?Oe.moment.utc(t,s):(0,Oe.moment)(t,s);o.locale(n);let l=r?o.utc().format(i):o.format(i);return(0,Oe.moment)(l,i,n,!0)}return null}getYAMLTimestampString(t,i,n){return t.match(i)[0].replace(n+":","").trim()}getTimeDifferenceInSeconds(t,i,n){let r=(0,Oe.moment)(i.format(n.format),n.format,n.locale,!0);return Math.abs(t.diff(r,"seconds"))}get exampleBuilders(){return[new y({description:"Adds a header with the date.",before:p`
2023-11-09 17:30:33 +08:00
# H1
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date created: Wednesday, January 1st 2020, 12:00:00 am
date modified: Thursday, January 2nd 2020, 12:00:05 am
---
# H1
2024-07-08 15:37:38 +08:00
`,options:{fileCreatedTime:"2020-01-01T00:00:00-00:00",fileModifiedTime:"2020-01-02T00:00:00-00:00",currentTime:(0,Oe.moment)("Thursday, January 2nd 2020, 12:00:05 am","dddd, MMMM Do YYYY, h:mm:ss a"),alreadyModified:!1}}),new y({description:"dateCreated option is false",before:p`
2023-11-09 17:30:33 +08:00
# H1
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
date modified: Thursday, January 2nd 2020, 12:00:05 am
---
# H1
2024-07-08 15:37:38 +08:00
`,options:{dateCreated:!1,fileCreatedTime:"2020-01-01T00:00:00-00:00",fileModifiedTime:"2020-01-01T00:00:00-00:00",currentTime:(0,Oe.moment)("Thursday, January 2nd 2020, 12:00:05 am","dddd, MMMM Do YYYY, h:mm:ss a"),alreadyModified:!1}}),new y({description:"Date Created Key is set",before:p`
2023-11-09 17:30:33 +08:00
# H1
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
created: Wednesday, January 1st 2020, 12:00:00 am
---
# H1
2024-07-08 15:37:38 +08:00
`,options:{dateCreated:!0,dateModified:!1,dateCreatedKey:"created",fileCreatedTime:"2020-01-01T00:00:00-00:00",currentTime:(0,Oe.moment)("Thursday, January 2nd 2020, 12:00:03 am","dddd, MMMM Do YYYY, h:mm:ss a"),alreadyModified:!1}}),new y({description:"Date Modified Key is set",before:p`
2023-11-09 17:30:33 +08:00
# H1
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
modified: Wednesday, January 1st 2020, 4:00:00 pm
---
# H1
2024-07-08 15:37:38 +08:00
`,options:{dateCreated:!1,dateModified:!0,dateModifiedKey:"modified",fileModifiedTime:"2020-01-01T00:00:00-00:00",currentTime:(0,Oe.moment)("Wednesday, January 1st 2020, 4:00:00 pm","dddd, MMMM Do YYYY, h:mm:ss a"),alreadyModified:!1}}),new y({description:"Header is set with convert to UTC option true",before:p`
# H1
`,after:p`
---
date created: 2020-01-01T14:00:00+00:00
date modified: 2020-01-02T02:00:05+00:00
---
# H1
`,options:{format:"YYYY-MM-DDTHH:mm:ssZ",fileCreatedTime:"2020-01-01T09:00:00-05:00",fileModifiedTime:"2020-01-01T21:00:00-05:00",currentTime:(0,Oe.moment)("2020-01-01T21:00:05-05:00","YYYY-MM-DDTHH:mm:ssZ"),alreadyModified:!1,convertToUTC:!0}}),new y({description:"dateCreated option is false with convert to UTC option true",before:p`
# H1
`,after:p`
---
date modified: 2020-01-02T02:00:05+00:00
---
# H1
`,options:{format:"YYYY-MM-DDTHH:mm:ssZ",dateCreated:!1,fileCreatedTime:"2020-01-01T09:00:00-05:00",fileModifiedTime:"2020-01-01T21:00:00-05:00",currentTime:(0,Oe.moment)("2020-01-01T21:00:05-05:00","YYYY-MM-DDTHH:mm:ssZ"),alreadyModified:!1,convertToUTC:!0}}),new y({description:"Date Created Key is set with convert to UTC option true",before:p`
# H1
`,after:p`
---
created: 2020-01-01T14:00:00+00:00
---
# H1
`,options:{format:"YYYY-MM-DDTHH:mm:ssZ",dateCreated:!0,dateModified:!1,dateCreatedKey:"created",fileCreatedTime:"2020-01-01T09:00:00-05:00",currentTime:(0,Oe.moment)("2020-01-01T21:00:05-05:00","YYYY-MM-DDTHH:mm:ssZ"),alreadyModified:!1,convertToUTC:!0}}),new y({description:"Date Modified Key is set with convert to UTC option true",before:p`
# H1
`,after:p`
---
modified: 2020-01-02T02:00:05+00:00
---
# H1
`,options:{format:"YYYY-MM-DDTHH:mm:ssZ",dateCreated:!1,dateModified:!0,dateModifiedKey:"modified",fileModifiedTime:"2020-01-01T21:00:00-05:00",currentTime:(0,Oe.moment)("2020-01-01T21:00:05-05:00","YYYY-MM-DDTHH:mm:ssZ"),alreadyModified:!1,convertToUTC:!0}})]}get optionBuilders(){return[new W({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.date-created.name",descriptionKey:"rules.yaml-timestamp.date-created.description",optionsKey:"dateCreated"}),new ke({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.date-created-key.name",descriptionKey:"rules.yaml-timestamp.date-created-key.description",optionsKey:"dateCreatedKey"}),new W({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.force-retention-of-create-value.name",descriptionKey:"rules.yaml-timestamp.force-retention-of-create-value.description",optionsKey:"forceRetentionOfCreatedValue"}),new W({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.date-modified.name",descriptionKey:"rules.yaml-timestamp.date-modified.description",optionsKey:"dateModified"}),new ke({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.date-modified-key.name",descriptionKey:"rules.yaml-timestamp.date-modified-key.description",optionsKey:"dateModifiedKey"}),new Ns({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.format.name",descriptionKey:"rules.yaml-timestamp.format.description",optionsKey:"format"}),new W({OptionsClass:Ue,nameKey:"rules.yaml-timestamp.convert-to-utc.name",descriptionKey:"rules.yaml-timestamp.convert-to-utc.description",optionsKey:"convertToUTC"})]}};pt=T([v.register],pt);var Si=class{constructor(){this.preserveExistingAliasesSectionStyle=!0;this.keepAliasThatMatchesTheFilename=!1;this.useYamlKeyToKeepTrackOfOldFilenameOrHeading=!0;this.aliasHelperKey=jl;this.aliasArrayStyle="multi-line";this.defaultEscapeCharacter='"';this.removeUnnecessaryEscapeCharsForMultiLineArrays=!1}};T([v.noSettingControl()],Si.prototype,"aliasArrayStyle",2),T([v.noSettingControl()],Si.prototype,"fileName",2),T([v.noSettingControl()],Si.prototype,"defaultEscapeCharacter",2),T([v.noSettingControl()],Si.prototype,"removeUnnecessaryEscapeCharsForMultiLineArrays",2);var xa=class extends v{constructor(){super({nameKey:"rules.yaml-title-alias.name",descriptionKey:"rules.yaml-title-alias.description",type:"YAML"})}get OptionsClass(){return Si}apply(t,i){t=Ci(t);let[n,r]=this.getTitleInfo(t,i.fileName,i.aliasArrayStyle,i.defaultEscapeCharacter),a=null,s=t.match(Je)[1],o=!i.keepAliasThatMatchesTheFilename&&n===i.fileName,l=s.replace(`---
2023-11-09 17:30:33 +08:00
`,"").replace(`
2024-07-08 15:37:38 +08:00
---`,""),c=oi(s),d=i.aliasHelperKey??jl;d.endsWith(":")&&(d=d.substring(0,d.length-1)),a=c[d]??null,a!=null&&(a=a+"",a=wi(a,i.defaultEscapeCharacter,this.forceEscape(a,i.aliasArrayStyle)));let u=null,g=Object.keys(c);for(let m of xi)if(g.includes(m)){u=m;break}if(u!=null){let m=pe(l,u),h="multi-line",x=m==="",b=!1;!m.includes(`
`)&&!(m==="[]"&&i.aliasArrayStyle==="multi-line")&&(m.match(/^\[.*\]/)===null?(h="single string to single-line",b=!0):h="single-line");let k=ot(Fe(m)),A=this.getNewAliasValue(k,o,r,a);A===""?l=Ct(l,u):i.preserveExistingAliasesSectionStyle?!x&&(b&&r==A||!b||k==A)?l=oe(l,u,we(A,h,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)):l=oe(l,u,we(A,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)):l=oe(l,u,we(A,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0))}else o||(l=oe(l,Yl,we(r,i.aliasArrayStyle,i.defaultEscapeCharacter,i.removeUnnecessaryEscapeCharsForMultiLineArrays,!0)));return!i.useYamlKeyToKeepTrackOfOldFilenameOrHeading||o?l=Ct(l,d):l=oe(l,d,` ${r}`),t=t.replace(`---
2023-11-09 17:30:33 +08:00
${s}---`,`---
2024-07-08 15:37:38 +08:00
${l}---`),t}getTitleInfo(t,i,n,r){let a=Ee([f.code,f.math,f.yaml,f.tag],t,Os);a=a||i;let s=wi(a,r,this.forceEscape(a,n));return[a,s]}forceEscape(t,i){return ss(t)||t.includes(",")&&(i==="single-line"||i==="single string to single-line"||i==="single string comma delimited")}getNewAliasValue(t,i,n,r){if(t==null)return i?"":n;if(typeof t=="string")i?t===n&&(t=""):r===t?t=n:t=[n,t];else if(r!==null){let a=t.indexOf(r);a===-1&&Tn(r)&&(a=t.indexOf(r.substring(1,r.length-1))),a!==-1?i?t.splice(a,1):t[a]=n:t=[n,...t]}else{let a=t.indexOf(n);a!==-1?i&&t.splice(a,1):i||(t=[n,...t])}return t===""||t.length===0?"":t}get exampleBuilders(){return[new y({description:"Adds a header with the title from heading.",before:p`
2023-11-09 17:30:33 +08:00
# Obsidian
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Obsidian
linter-yaml-title-alias: Obsidian
---
# Obsidian
2024-07-08 15:37:38 +08:00
`}),new y({description:"Adds a header with the title from heading without YAML key when the use of the YAML key is set to false.",before:p`
2023-11-09 17:30:33 +08:00
# Obsidian
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Obsidian
---
# Obsidian
2024-07-08 15:37:38 +08:00
`,options:{useYamlKeyToKeepTrackOfOldFilenameOrHeading:!1}}),new y({description:"Adds a header with the title.",before:p`
2023-11-09 17:30:33 +08:00
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Filename
linter-yaml-title-alias: Filename
---
${""}
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename",keepAliasThatMatchesTheFilename:!0}}),new y({description:"Adds a header with the title without YAML key when the use of the YAML key is set to false.",before:p`
2023-11-09 17:30:33 +08:00
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Filename
---
${""}
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename",keepAliasThatMatchesTheFilename:!0,useYamlKeyToKeepTrackOfOldFilenameOrHeading:!1}}),new y({description:"Replaces old filename with new filename when no header is present and filename is different than the old one listed in `linter-yaml-title-alias`.",before:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Old Filename
- Alias 2
linter-yaml-title-alias: Old Filename
---
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- Filename
- Alias 2
linter-yaml-title-alias: Filename
---
${""}
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename",keepAliasThatMatchesTheFilename:!0}}),new y({description:"Make sure that markdown and wiki links in first H1 get their values converted to text",before:p`
2023-11-09 17:30:33 +08:00
# This is a [Heading](markdown.md)
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
aliases:
- This is a Heading
linter-yaml-title-alias: This is a Heading
---
# This is a [Heading](markdown.md)
2024-07-08 15:37:38 +08:00
`,options:{aliasArrayStyle:"multi-line"}}),new y({description:"Using `title` as `Alias Helper Key` sets the value of `title` to the alias.",before:p`
2024-06-12 15:46:38 +08:00
${""}
`,after:p`
---
aliases:
- Filename
title: Filename
---
${""}
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename",keepAliasThatMatchesTheFilename:!0,aliasArrayStyle:"multi-line",aliasHelperKey:"title"}})]}get optionBuilders(){return[new W({OptionsClass:Si,nameKey:"rules.yaml-title-alias.preserve-existing-alias-section-style.name",descriptionKey:"rules.yaml-title-alias.preserve-existing-alias-section-style.description",optionsKey:"preserveExistingAliasesSectionStyle"}),new W({OptionsClass:Si,nameKey:"rules.yaml-title-alias.keep-alias-that-matches-the-filename.name",descriptionKey:"rules.yaml-title-alias.keep-alias-that-matches-the-filename.description",optionsKey:"keepAliasThatMatchesTheFilename"}),new W({OptionsClass:Si,nameKey:"rules.yaml-title-alias.use-yaml-key-to-keep-track-of-old-filename-or-heading.name",descriptionKey:"rules.yaml-title-alias.use-yaml-key-to-keep-track-of-old-filename-or-heading.description",optionsKey:"useYamlKeyToKeepTrackOfOldFilenameOrHeading"}),new ke({OptionsClass:Si,nameKey:"rules.yaml-title-alias.alias-helper-key.name",descriptionKey:"rules.yaml-title-alias.alias-helper-key.description",optionsKey:"aliasHelperKey"})]}};xa=T([v.register],xa);var Jt=class{constructor(){this.defaultEscapeCharacter='"';this.titleKey="title";this.mode="first-h1-or-filename-if-h1-missing"}};T([v.noSettingControl()],Jt.prototype,"fileName",2),T([v.noSettingControl()],Jt.prototype,"defaultEscapeCharacter",2);var wa=class extends v{constructor(){super({nameKey:"rules.yaml-title.name",descriptionKey:"rules.yaml-title.description",type:"YAML"})}get OptionsClass(){return Jt}apply(t,i){t=Ci(t);let n="";switch(i.mode){case"filename":n=i.fileName;break;case"first-h1":n=this.getFirstH1Header(t);break;default:n=this.getFirstH1Header(t),n=n||i.fileName}return n=wi(n,i.defaultEscapeCharacter),ye(t,r=>{let a=`
2023-11-09 17:30:33 +08:00
${i.titleKey}.*
2024-07-08 15:37:38 +08:00
`,s=new RegExp(a);if(s.test(r))r=r.replace(s,Xe(`
2023-11-09 17:30:33 +08:00
${i.titleKey}: ${n}
`));else{let o=r.indexOf(`
2024-06-12 15:46:38 +08:00
---`);r=At(r,o,`
2024-07-08 15:37:38 +08:00
${i.titleKey}: ${n}`)}return r})}getFirstH1Header(t){return Ee([f.code,f.math,f.yaml,f.tag],t,Os)}get exampleBuilders(){return[new y({description:"Adds a header with the title from heading when `mode = 'First H1 or Filename if H1 Missing'`.",before:p`
2023-11-09 17:30:33 +08:00
# Obsidian
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: Obsidian
---
# Obsidian
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename"}}),new y({description:"Adds a header with the title when `mode = 'First H1 or Filename if H1 Missing'`.",before:p`
2023-11-09 17:30:33 +08:00
${""}
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: Filename
---
${""}
2024-07-08 15:37:38 +08:00
`,options:{fileName:"Filename"}}),new y({description:"Make sure that markdown links in headings are properly copied to the YAML as just the text when `mode = 'First H1 or Filename if H1 Missing'`",before:p`
2023-11-09 17:30:33 +08:00
# This is a [Heading](test heading.md)
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: This is a Heading
---
# This is a [Heading](test heading.md)
2024-07-08 15:37:38 +08:00
`}),new y({description:"When `mode = 'First H1'`, title does not have a value if no H1 is present",before:p`
2023-11-09 17:30:33 +08:00
## This is a Heading
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: ""
---
## This is a Heading
2024-07-08 15:37:38 +08:00
`,options:{mode:"first-h1",fileName:"Filename"}}),new y({description:"When `mode = 'Filename'`, title uses the filename ignoring all H1s. Note: the filename is \"Filename\" in this example.",before:p`
2023-11-09 17:30:33 +08:00
# This is a Heading
2024-02-26 20:05:21 +08:00
`,after:p`
2023-11-09 17:30:33 +08:00
---
title: Filename
---
# This is a Heading
2024-07-08 15:37:38 +08:00
`,options:{mode:"filename",fileName:"Filename"}})]}get optionBuilders(){return[new ke({OptionsClass:Jt,nameKey:"rules.yaml-title.title-key.name",descriptionKey:"rules.yaml-title.title-key.description",optionsKey:"titleKey"}),new ie({OptionsClass:Jt,nameKey:"rules.yaml-title.mode.name",descriptionKey:"rules.yaml-title.mode.description",optionsKey:"mode",records:[{value:"first-h1-or-filename-if-h1-missing",description:"Uses the first H1 in the file or the filename of the file if there is not H1"},{value:"filename",description:"Uses the filename as the title"},{value:"first-h1",description:"Uses the first H1 in the file as the title"}]})]}};wa=T([v.register],wa);var sw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-cog">
2023-11-09 17:30:33 +08:00
<circle cx="6" cy="13" r="3"/>
<path d="m9.7 14.4-.9-.3"/>
<path d="m3.2 11.9-.9-.3"/>
<path d="m4.6 16.7.3-.9"/>
<path d="m7.6 16.7-.4-1"/>
<path d="m4.8 10.3-.4-1"/>
<path d="m2.3 14.6 1-.4"/>
<path d="m8.7 11.8 1-.4"/>
<path d="m7.4 9.3-.3.9"/>
<path d="M14 2v6h6"/>
<path d="M4 5.5V4a2 2 0 0 1 2-2h8.5L20 7.5V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-1.5"/>
2024-07-08 15:37:38 +08:00
</svg>`,ow=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-cog">
2023-11-09 17:30:33 +08:00
<circle cx="18" cy="18" r="3"/>
<path d="M10.5 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.5"/>
<path d="m21.7 19.4-.9-.3"/>
<path d="m15.2 16.9-.9-.3"/>
<path d="m16.6 21.7.3-.9"/>
<path d="m19.1 15.2.3-.9"/>
<path d="m19.6 21.7-.4-1"/>
<path d="m16.8 15.3-.4-1"/>
<path d="m14.3 19.6 1-.4"/>
<path d="m20.7 16.8 1-.4"/>
2024-07-08 15:37:38 +08:00
</svg>`,lw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-server-cog">
2023-11-09 17:30:33 +08:00
<circle cx="12" cy="12" r="3"/><path d="M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5"/>
<path d="M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5"/>
<path d="M6 6h.01"/><path d="M6 18h.01"/>
<path d="m15.7 13.4-.9-.3"/>
<path d="m9.2 10.9-.9-.3"/>
<path d="m10.6 15.7.3-.9"/>
<path d="m13.6 15.7-.4-1"/>
<path d="m10.8 9.3-.4-1"/>
<path d="m8.3 13.6 1-.4"/>
<path d="m14.7 10.8 1-.4"/>
<path d="m13.4 8.3-.3.9"/>
2024-07-08 15:37:38 +08:00
</svg>`,cw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pilcrow">
2023-11-09 17:30:33 +08:00
<path d="M13 4v16"/>
<path d="M17 4v16"/>
<path d="M19 4H9.5a4.5 4.5 0 0 0 0 9H13"/>
2024-07-08 15:37:38 +08:00
</svg>`,dw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-function-square">
2023-11-09 17:30:33 +08:00
<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/>
<path d="M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"/>
<path d="M9 11.2h5.7"/>
2024-07-08 15:37:38 +08:00
</svg>`,uw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-gantt-chart-square">
2023-11-09 17:30:33 +08:00
<rect width="18" height="18" x="3" y="3" rx="2"/>
<path d="M9 8h7"/>
<path d="M8 12h6"/>
<path d="M11 16h5"/>
2024-07-08 15:37:38 +08:00
</svg>`,pw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-list">
2023-11-09 17:30:33 +08:00
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
<path d="M12 11h4"/>
<path d="M12 16h4"/>
<path d="M8 11h.01"/>
<path d="M8 16h.01"/>
2024-07-08 15:37:38 +08:00
</svg>`,mw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-plus">
2023-11-09 17:30:33 +08:00
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20"/>
<path d="M9 10h6"/>
<path d="M12 7v6"/>
2024-07-08 15:37:38 +08:00
</svg>`,gw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-heading-1">
2023-11-09 17:30:33 +08:00
<path d="M4 12h8"/>
<path d="M4 18V6"/>
<path d="M12 18V6"/>
<path d="m17 12 3-2v8"/>
2024-07-08 15:37:38 +08:00
</svg>`,hw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript">
2023-11-09 17:30:33 +08:00
<path d="m4 19 8-8"/>
<path d="m12 19-8-8"/>
<path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"/>
2024-07-08 15:37:38 +08:00
</svg>`,fw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-code-2">
2023-11-09 17:30:33 +08:00
<path d="M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v4"/>
<polyline points="14 2 14 8 20 8"/>
<path d="m9 18 3-3-3-3"/>
<path d="m5 12-3 3 3 3"/>
2024-07-08 15:37:38 +08:00
</svg>`,yw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings">
2023-11-09 17:30:33 +08:00
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/>
<circle cx="12" cy="12" r="3"/>
2024-07-08 15:37:38 +08:00
</svg>`,bw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bug-play">
2023-11-09 17:30:33 +08:00
<path d="m8 2 1.88 1.88"/>
<path d="M14.12 3.88 16 2"/>
<path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/>
<path d="M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5"/>
<path d="M6.53 9C4.6 8.8 3 7.1 3 5"/>
<path d="M6 13H2"/>
<path d="M3 21c0-2.1 1.7-3.9 3.8-4"/>
<path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/>
<path d="m12 12 8 5-8 5Z"/>
2024-07-08 15:37:38 +08:00
</svg>`,vw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard">
2023-11-09 17:30:33 +08:00
<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/>
<path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>
2024-07-08 15:37:38 +08:00
</svg>`,xw=`<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check">
2023-11-09 17:30:33 +08:00
<polyline points="20 6 9 17 4 12"/>
2024-07-08 15:37:38 +08:00
</svg>`,Ce={folder:{id:"lint-folder",source:ow},file:{id:"lint-file",source:sw},vault:{id:"lint-vault",source:lw},whitespace:{id:"lint-whitespace",source:cw},math:{id:"lint-math",source:dw},content:{id:"lint-content",source:uw},paste:{id:"lint-paste",source:pw},custom:{id:"lint-custom",source:mw},heading:{id:"lint-heading",source:gw},footer:{id:"lint-footer",source:hw},yaml:{id:"lint-yaml",source:fw},general:{id:"lint-general",source:yw},debug:{id:"lint-debug",source:bw},clipboard:{id:"linter-clipboard",source:vw},success:{id:"linter-success",source:xw}};var Bn=require("obsidian");var uo=class{constructor(){this.disabledRules=[]}lintText(t){this.skipFile=!1;let i=t.oldText;if([this.disabledRules,this.skipFile]=Rs(i),this.skipFile)return i;St(E("logs.rule-running"));let n=E("logs.pre-rules");St(n);let r=this.runBeforeRegularRules(t);Ji(n);let a=E("logs.disabled-text");for(let o of Ii){if(this.disabledRules.includes(o.alias)){ri(o.alias+" "+a);continue}else if(o.hasSpecialExecutionOrder||o.type==="Paste")continue;[r]=ct.applyIfEnabledBase(o,r,t.settings,{fileCreatedTime:t.fileInfo.createdAtFormatted,fileModifiedTime:t.fileInfo.modifiedAtFormatted,fileName:t.fileInfo.name,locale:t.momentLocale,minimumNumberOfDollarSignsToBeAMathBlock:t.settings.commonStyles.minimumNumberOfDollarSignsToBeAMathBlock,aliasArrayStyle:t.settings.commonStyles.aliasArrayStyle,tagArrayStyle:t.settings.commonStyles.tagArrayStyle,defaultEscapeCharacter:t.settings.commonStyles.escapeCharacter,removeUnnecessaryEscapeCharsForMultiLineArrays:t.settings.commonStyles.removeUnnecessaryEscapeCharsForMultiLineArrays})}let s=E("logs.custom-regex");return St(s),r=this.runCustomRegexReplacement(t.settings.customRegexes,r),Ji(s),t.oldText=r,this.runAfterRegularRules(i,t)}runBeforeRegularRules(t){let i=t.oldText;return[i]=Kt.applyIfEnabled(i,t.settings,this.disabledRules),[i]=Rt.applyIfEnabled(i,t.settings,this.disabledRules,{defaultEscapeCharacter:t.settings.commonStyles.escapeCharacter}),[i]=Nt.applyIfEnabled(i,t.settings,this.disabledRules,{minimumNumberOfDollarSignsToBeAMathBlock:t.settings.commonStyles.minimumNumberOfDollarSignsToBeAMathBlock}),i}runAfterRegularRules(t,i){let n=i.oldText,r=E("logs.post-rules");St(r),[n]=_t.applyIfEnabled(n,i.settings,this.disabledRules),[n]=It.applyIfEnabled(n,i.settings,this.disabledRules),[n]=Dt.applyIfEnabled(n,i.settings,this.disabledRules,{defaultEscapeCharacter:i.settings.commonStyles.escapeCharacter}),[n]=Qt.applyIfEnabled(n,i.settings,this.disabledRules);let a=i.getCurrentTime(),s;[n,s]=pt.applyIfEnabled(n,i.settings,this.disabledRules,{fileCreatedTime:i.fileInfo.createdAtFormatted,fileModifiedTime:i.fileInfo.modifiedAtFormatted,currentTime:a,alreadyModified:t!=n,locale:i.momentLocale});let o=pt.getRuleOptions(i.settings);return a=i.getCurrentTime(),o.convertToUTC&&(a=a.utc()),[n]=Zt.applyIfEnabled(n,i.settings,this.disabledRules,{currentTimeFormatted:a.format(o.format.trimEnd()),yamlTimestampDateModifiedEnabled:s&&o.dateModified,dateModifiedKey:o.dateModifiedKey}),Ji(r),Ji(E("logs.rule-running")),n}runCustomCommands(t,i){if(this.skipFile)return;ri(E("logs.running-custom-lint-command"));let n=new Set;for(let r of t){if(r.id){if(n.has(r.id)){kt(E("logs.custom-lint-duplicate-warning").replace("{COMMAND_NAME}",r.name));continue}}else continue;try{n.add(r.id),i.executeCommandById(r.id)}catch(a){Ds(a,`${E("logs.custom-lint-error-message")} ${r.id}`)}}}runCustomRegexReplacement(t,i){return Ee([f.customIgnore],i,n=>{ri(E("logs.running-custom-regex"));let r=n,a=n;for(let s of t){let o=s.find===void 0||s.find==""||s.find===null,l=s.replace===void 0||s.replace===null;if(o||l)continue;let c=s.label;c&&c.trim()!=""&&(c+=`:
`),c+=`/${s.find}/${s.flags}/${s.replace}/`,ri(c);let d=new RegExp(`${s.find}`,s.flags);r=r.replace(d,lu(s.replace)),a!=r&&ri(r),a=r}return r})}runPasteLint(t,i,n){let r=n.oldText;return[r]=$t.applyIfEnabled(r,n.settings,[]),[r]=Vt.applyIfEnabled(r,n.settings,[]),[r]=Ut.applyIfEnabled(r,n.settings,[]),[r]=Pt.applyIfEnabled(r,n.settings,[]),[r]=Wt.applyIfEnabled(r,n.settings,[]),[r]=Yt.applyIfEnabled(r,n.settings,[],{lineContent:t,selectedText:i}),[r]=jt.applyIfEnabled(r,n.settings,[],{lineContent:t,selectedText:i}),[r]=Bt.applyIfEnabled(r,n.settings,[],{lineContent:t}),r}};function ka(e,t=null,i,n){let r=t?(0,Bn.moment)(t.stat.ctime):(0,Bn.moment)();r.locale(i);let a=t?(0,Bn.moment)(t.stat.mtime):(0,Bn.moment)();a.locale(i);let s=a.format(),o=r.format();return{oldText:e,fileInfo:{name:t?t.basename:"",createdAtFormatted:o,modifiedAtFormatted:s},settings:n,momentLocale:i,getCurrentTime:()=>{let l=(0,Bn.moment)();return l.locale(i),l}}}var po=require("obsidian");var Sa=class extends po.Modal{constructor(t,i,n,r,a,s=!1){super(t),this.modalEl.addClass("confirm-modal"),this.contentEl.createEl("h3",{text:E("warning-text")}).style.textAlign="center",s&&(this.contentEl.createEl("p",{text:E("custom-command-warning")}).style.fontWeight="bold"),this.contentEl.createEl("p",{text:i+" "+E("file-backup-text")}).id="confirm-dialog",this.contentEl.createDiv("modal-button-container",o=>{o.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close());let l=o.createEl("button",{attr:{type:"submit"},cls:"mod-cta",text:n});l.addEventListener("click",async c=>{new po.Notice(r),this.close(),await a()}),setTimeout(()=>{l.focus()},50)})}};var ft=require("obsidian");var Wp=require("obsidian");var ww={General:Ce.general.id,Custom:Ce.custom.id,YAML:Ce.yaml.id,Heading:Ce.heading.id,Footnote:Ce.footer.id,Content:Ce.content.id,Spacing:Ce.whitespace.id,Paste:Ce.paste.id,Debug:Ce.debug.id},kw={General:"tabs.names.general",Custom:"tabs.names.custom",YAML:"tabs.names.yaml",Heading:"tabs.names.heading",Footnote:"tabs.names.footnote",Content:"tabs.names.content",Spacing:"tabs.names.spacing",Paste:"tabs.names.paste",Debug:"tabs.names.debug"},Bi=class{constructor(t,i,n,r,a){this.name=n;this.isMobile=r;this.plugin=a;this.searchSettingInfo=[];this.navButton=t.createDiv("linter-navigation-item");let s="linter-desktop";r&&(s="linter-mobile"),this.navButton.addClass(s),(0,Wp.setIcon)(this.navButton.createSpan({cls:"linter-navigation-item-icon"}),ww[n]);let o=E(kw[n]);this.navButton.createSpan().setText(o),this.contentEl=i.createDiv("linter-tab-settings"),this.contentEl.id=n.toLowerCase().replace(" ","-"),this.headingEl=this.contentEl.createEl("h2",{text:o}),pi(this.headingEl)}addSettingSearchInfo(t,i="",n="",r=null,a=null){this.searchSettingInfo.push({containerEl:t,name:i.toLowerCase(),description:n.toLowerCase(),options:r,alias:a})}addSettingSearchInfoForGeneralSettings(t){this.searchSettingInfo.push({containerEl:t.containerEl,name:t.name.toLowerCase(),description:t.description.toLowerCase(),options:null,alias:null})}updateTabDisplayMode(t,i="the status is still the same"){switch(t?(this.navButton.addClass("linter-navigation-item-selected"),qi(this.contentEl)):(this.navButton.removeClass("linter-navigation-item-selected"),pi(this.contentEl)),i){case"entering search mode by focusing on the search input box":qi(this.contentEl),qi(this.headingEl);for(let n of this.searchSettingInfo)qi(n.containerEl);break;case"leaving search mode by selecting a tab":pi(this.headingEl);for(let n of this.searchSettingInfo)qi(n.containerEl);break}}};var km=require("obsidian");var Up=require("obsidian");var Aa={ruleConfigs:{},lintOnSave:!1,recordLintOnSaveLogs:!1,displayChanged:!0,lintOnFileChange:!1,displayLintOnFileChangeNotice:!1,settingsConvertedToConfigKeyValues:!1,foldersToIgnore:[],filesToIgnore:[],linterLocale:"system-default",logLevel:"ERROR",lintCommands:[],customRegexes:[],commonStyles:{aliasArrayStyle:"single-line",tagArrayStyle:"single-line",minimumNumberOfDollarSignsToBeAMathBlock:2,escapeCharacter:'"',removeUnnecessaryEscapeCharsForMultiLineArrays:!1}};var
`," "));let m=this.contentEl.createDiv(),h=new wo(m,this.plugin.settingsTab.component,this.plugin.settings.filesToIgnore,()=>{this.plugin.saveSettings()});this.addSettingSearchInfo(m,h.name,h.description.replaceAll(`
`," "))}};var So=class extends Bi{constructor(i,n,r,a,s,o){super(i,n,r,s,o);this.rules=a;this.display()}display(){for(let i of this.rules){let n=this.contentEl.createDiv();n.id=i.alias,n.createEl(this.isMobile?"h4":"h3",{},a=>{a.innerHTML=`<a href="${i.getURL()}">${i.getName()}</a>`});let r=[];for(let a of i.options)a.display(n,this.plugin.settings,this.plugin),r.push(a.getSearchInfo());this.addSettingSearchInfo(n,i.getName().toLowerCase(),i.getDescription().toLowerCase(),r,n.id)}}};var Sm=require("obsidian");var qa=class extends Nn{constructor(i,n,r=[]){super(i,n);this.app=i;this.inputEl=n;this.valuesToExclude=r}getSuggestions(i){let n=this.app.commands.listCommands();if(!n)return[];let r=n.filter(o=>{for(let l of this.valuesToExclude)if(l.id==o.id&&!(this.inputEl.hasAttribute("commandId")&&this.inputEl.getAttribute("commandId")==o.id))return!1;return!0}),a=[],s=i.toLowerCase();return r.forEach(o=>{(o.id.contains(s)||o.name.toLowerCase().contains(s))&&a.push(o)}),a}renderSuggestion(i,n){n.setText(i.name)}selectSuggestion(i){this.inputEl.value=i.name,this.inputEl.setAttribute("commandId",i.id),this.inputEl.trigger("input"),this.close()}};var Ao=class extends _i{constructor(i,n,r,a,s){super(i,n,E("options.custom-command.name"),E("options.custom-command.description"),E("options.custom-command.warning"),E("options.custom-command.add-input-button-text"),s,()=>{let o={id:"",name:""};this.lintCommands.push(o),this.saveSettings(),this.addCommand(o,this.lintCommands.length-1,!0)});this.lintCommands=r;this.app=a;this.display()}showInputEls(){this.lintCommands.forEach((i,n)=>{this.addCommand(i,n)})}addCommand(i,n,r=!1){new Sm.Setting(this.inputElDiv).addSearch(a=>{new qa(this.app,a.inputEl,this.lintCommands),a.setPlaceholder(E("options.custom-command.command-search-placeholder-text")).setValue(i.name).onChange(s=>{let o={id:a.inputEl.getAttribute("commandId"),name:s};o.name&&o.id?(this.lintCommands[n]=o,this.saveSettings()):!o.name&&!o.id&&(this.lintCommands[n]=o,this.saveSettings())}),a.inputEl.setAttr("tabIndex",n),a.inputEl.addClass("linter-custom-command"),r&&a.inputEl.focus()}).addExtraButton(a=>{a.setIcon("up-chevron-glyph").setTooltip(E("options.custom-command.move-up-tooltip")).onClick(()=>{this.arrayMove(n,n-1),this.saveSettings(),this.resetInputEls()})}).addExtraButton(a=>{a.setIcon("down-chevron-glyph").setTooltip(E("options.custom-command.move-down-tooltip")).onClick(()=>{this.arrayMove(n,n+1),this.saveSettings(),this.resetInputEls()})}).addExtraButton(a=>{a.setIcon("cross").setTooltip(E("options.custom-command.delete-tooltip")).onClick(()=>{this.lintCommands.splice(n,1),this.saveSettings(),this.resetInputEls()})})}arrayMove(i,n){if(n<0||n===this.lintCommands.length)return;let r=this.lintCommands[i];this.lintCommands[i]=this.lintCommands[n],this.lintCommands[n]=r}};var Rc=require("obsidian");var rk="gm",To=class extends _i{constructor(i,n,r,a){super(i,n,E("options.custom-replace.name"),E("options.custom-replace.description"),E("options.custom-replace.warning"),E("options.custom-replace.add-input-button-text"),a,()=>{let s={label:"",find:"",replace:"",flags:rk};this.regexes.push(s),this.saveSettings(),this.addRegex(s,this.regexes.length-1,!0)});this.regexes=r;this.display(),this.inputElDiv.addClass("linter-custom-regex-replacement-container")}showInputEls(){this.regexes.forEach((i,n)=>{this.addRegex(i,n)})}addRegex(i,n,r=!1){let a=this.inputElDiv.createDiv({cls:"linter-custom-regex-replacement"}),s=a.createDiv(),o=new Rc.Setting(s).addText(d=>{d.setPlaceholder(E("options.custom-replace.label-placeholder-text")).setValue(i.label).onChange(u=>{this.regexes[n].label=u,this.saveSettings()}),d.inputEl.setAttr("inputIndex",n),d.inputEl.addClass("linter-custom-regex-replacement-label-input"),r&&d.inputEl.focus()});o.controlEl.addClass("linter-custom-regex-replacement-label"),o.descEl.remove(),o.infoEl.remove(),o.nameEl.remove();let l=a.createDiv();new Rc.Setting(l).addText(d=>{d.setPlaceholder(E("options.custom-replace.regex-to-find-placeholder-text")).setValue(i.find).onChange(u=>{this.regexes[n].find=u,this.saveSettings()})
2023-11-09 17:30:33 +08:00
`," ")+n.warning.replaceAll(`
2024-07-08 15:37:38 +08:00
`," "));let r=this.contentEl.createDiv(),a=new To(r,this.plugin.settingsTab.component,this.plugin.settings.customRegexes,()=>{this.plugin.saveSettings()});this.addSettingSearchInfo(r,a.name,a.description.replaceAll(`
2023-11-09 17:30:33 +08:00
`," ")+a.warning.replaceAll(`
2024-07-08 15:37:38 +08:00
`," "))}};var Am=require("obsidian");var Lo=class{constructor(t,i,n,r){this.containerEl=t;this.searchZeroState=i;this.tabNameToTab=n;this.onFocus=r;this.searchSettingInfo=new Map;for(let[a,s]of n)this.searchSettingInfo.set(a,s.searchSettingInfo);this.display()}display(){let t=new Am.Setting(this.containerEl);t.settingEl.style.border="none",t.addSearch(i=>{this.search=i}),this.search.setPlaceholder(E("tabs.default-search-bar-text")),this.search.inputEl.onfocus=()=>{this.onFocus()},this.search.onChange(i=>{this.searchSettings(i.toLowerCase())})}searchSettings(t){let i=new Set,n=function(r,a){qi(r),i.has(a)||i.add(a)};for(let[r,a]of this.searchSettingInfo)for(let s of a)if(t.trim()===""||s.alias?.includes(t)||s.description.includes(t)||s.name.includes(t))n(s.containerEl,r);else if(s.options)for(let o of s.options){if(o.description.toLowerCase().includes(t)||o.name.toLowerCase().includes(t)){n(s.containerEl,r);break}else if(o.options){for(let l of o.options)if(l.description.toLowerCase().includes(t)||l.value.toLowerCase().includes(t)){n(s.containerEl,r);break}}pi(s.containerEl)}else pi(s.containerEl);for(let[r,a]of this.tabNameToTab)i.has(r)?qi(a.headingEl):pi(a.headingEl);i.size===0?qi(this.searchZeroState):pi(this.searchZeroState)}focusOnInput(){this.search.inputEl.focus()}};var Tm=pn(Va());var Yn=require("obsidian");var Ia=class{constructor(t,i,n,r=!0){this.containerEl=t;this.name=i;this.description=n;this.disabled=r;this.display()}display(){let t=this.containerEl.createDiv(),i=t.createDiv("setting-item-info");this.nameEl=i.createDiv("setting-item-name"),this.nameEl.setText(this.name),this.descEl=i.createDiv("setting-item-description"),this.descEl.setText(this.description),this.inputContainerEl=t.createDiv("full-width-textbox-input-wrapper"),this.inputContainerEl.onmouseover=()=>{this.getInput().trim()!=""&&this.copyEl.removeClass("linter-visually-hidden")},this.inputContainerEl.onmouseleave=()=>{this.copyEl.addClass("linter-visually-hidden")},this.inputEl=this.inputContainerEl.createEl("textarea",{cls:"full-width"}),this.inputEl.spellcheck=!1,this.inputEl.disabled=this.disabled,this.copyEl=this.inputContainerEl.createDiv({cls:"settings-copy-button linter-visually-hidden ",attr:{"aria-label":E("copy-aria-label")}}),this.copyIconEl=this.copyEl.createSpan(),(0,Yn.setIcon)(this.copyIconEl,"linter-clipboard"),this.copyIconEl.onclick=()=>{this.handleCopy(this.copyIconEl)}}getInput(){return this.inputEl.value}handleCopy(t){navigator.clipboard.writeText(this.getInput()).then(()=>{(0,Yn.setIcon)(t,"linter-success"),setTimeout(()=>{(0,Yn.setIcon)(t,"linter-clipboard")},1500)},i=>{new Yn.Notice(`${E("notice-text.copy-to-clipboard-failed")+i}`,0)})}};var ak=Object.keys(Tm.default.levels),Eo=class extends Bi{constructor(t,i,n,r){super(t,i,"Debug",n,r),this.display()}display(){let t=this.contentEl.createDiv(),i={isForEnum:!0,values:ak,descriptions:[]};this.addSettingSearchInfoForGeneralSettings(new $i(t,"tabs.debug.log-level.name","tabs.debug.log-level.description","logLevel",this.plugin,i,async()=>{Ja(this.plugin.settings.logLevel)})),t=this.contentEl.createDiv();let n=E("tabs.debug.linter-config.name"),r=E("tabs.debug.linter-config.description");new Ia(t,n,r).inputEl.setText(JSON.stringify(this.plugin.settings,null,2)),this.addSettingSearchInfo(t,n,r),t=this.contentEl.createDiv(),this.addSettingSearchInfoForGeneralSettings(new Fi(t,"tabs.debug.log-collection.name","tabs.debug.log-collection.description","recordLintOnSaveLogs",this.plugin)),t=this.contentEl.createDiv(),n=E("tabs.debug.linter-logs.name"),r=E("tabs.debug.linter-logs.description");let s=new Ia(t,n,"");s.inputEl.setText(Qa.join(`
`)),Mi(r,s.descEl,this.plugin.settingsTab.component),this.addSettingSearchInfo(t,n,r)}};var Oo=class extends ft.PluginSettingTab{constructor(i,n){super(i,n);this.plugin=n;this.tabNameToTab=new Map;this.selectedTab="General";this.component=new ft.Component}display(){let{containerEl:i}=this;this.component.load(),i.empty();let n=i.createDiv("linter-setting-title");ft.Platform.isMobile?n.addClass("linter-mobile"):n.createEl("h1").setText(E("linter-title")),this.navContainer=i.createEl("nav",{cls:"linter-setting-header"}),this.tabNavEl=this.navContainer.createDiv("linter-setting-tab-group"),this.settingsContentEl=i.createDiv("linter-setting-content"),this.addTabs(ft.Platform.isMobile),this.createSearchZeroState(ft.Platform.isMobile),this.generateSearchBar(n),this.selectedTab==""&&this.tabSearcher.focusOnInput()}hide(){this.component.unload()}addTabs(i){this.addTab(new ko(this.tabNavEl,this.settingsContentEl,i,this.plugin,this.app));for(let n of Object.values(D))this.addTab(new So(this.tabNavEl,this.settingsContentEl,n,qt.get(n),i,this.plugin));this.addTab(new zo(this.tabNavEl,this.settingsContentEl,i,this.app,this.plugin)),this.addTab(new Eo(this.tabNavEl,this.settingsContentEl,i,this.plugin))}generateSearchBar(i){this.tabSearcher=new Lo(i,this.searchZeroState,this.tabNameToTab,()=>{for(let n of this.tabNameToTab.values()){n.updateTabDisplayMode(!1,"entering search mode by focusing on the search input box");let r=this.tabSearcher.search.getValue();this.selectedTab==""&&r.trim()!=""&&this.tabSearcher.searchSettings(r.toLowerCase()),this.selectedTab=""}})}createSearchZeroState(i){this.searchZeroState=this.settingsContentEl.createDiv(),pi(this.searchZeroState),this.searchZeroState.createEl(i?"h3":"h2",{text:E("empty-search-results-text")}).style.textAlign="center"}addTab(i){i.navButton.onclick=()=>{this.onTabClick(i.name)},i.updateTabDisplayMode(this.selectedTab===i.name,"the status is still the same"),this.tabNameToTab.set(i.name,i)}onTabClick(i){if(this.selectedTab!==i){if(this.selectedTab=="")for(let[n,r]of this.tabNameToTab)r.updateTabDisplayMode(n===i,"leaving search mode by selecting a tab");else pi(this.searchZeroState),this.tabNameToTab.get(i).updateTabDisplayMode(!0),this.tabNameToTab.get(this.selectedTab).updateTabDisplayMode(!1);this.selectedTab=i}}};var Lm=require("obsidian");var sk=/^---\n/gm,zm=`${Sn}:`,Co=class extends Lm.EditorSuggest{constructor(i){super(i.app);this.plugin=i;this.inline=!1;let n=E("all-rules-option");this.ruleInfo=[{displayName:n,name:n.toLowerCase(),alias:"all"}];for(let r of Ii){let a=r.getName();this.ruleInfo.push({displayName:a,name:a.toLowerCase(),alias:r.alias})}}onTrigger(i,n,r){let a=n.getLine(i.line).toLowerCase();if(a.startsWith(zm)||this.disabledRulesIsEndOfStartOfFileToCursor(n.getRange({line:0,ch:0},i))){this.inline=a.startsWith(zm);let o=n.getLine(i.line).substring(0,i.ch),l=o.match(/(\S+)$/)?.first().replaceAll("[","").replaceAll("]","");if(l)return{end:i,start:{ch:o.lastIndexOf(l),line:i.line},query:l}}return null}getSuggestions(i){let[n,r]=Rs(i.editor.getValue());if(r)return[];let a=i.query.toLowerCase();return this.ruleInfo.filter(o=>(o.name.contains(a)||o.alias.contains(a))&&!n.includes(o.alias))}renderSuggestion(i,n){n.addClass("mod-complex");let r=n.createDiv({cls:"suggestion-content"});r.createDiv({cls:"suggestion-title"}).setText(`${i.displayName}`),r.createDiv({cls:"suggestion-note"}).setText(`${i.alias}`)}selectSuggestion(i){if(this.context){let n=i.alias;this.inline?n=`${n},`:n=`${n}
-`,this.context.editor.replaceRange(`${n} `,this.context.start,this.context.end)}}disabledRulesIsEndOfStartOfFileToCursor(i){if(!i||!i.length||i.match(sk)?.length!=1)return!1;let n=pe(i+`
`,Sn)?.trimEnd();return n===null?!1:i.trimEnd().endsWith(n)}};var qm=pn(Mm()),Im=pn(Va()),ok={en:"en-gb",zh:"zh-cn","zh-TW":"zh-tw",ru:"ru",ko:"ko",it:"it",id:"id",ro:"ro","pt-BR":"pt-br",cz:"cs",da:"da",de:"de",es:"es",fr:"fr",no:"nn",pl:"pl",pt:"pt",tr:"tr",hi:"hi",nl:"nl",ar:"ar",ja:"ja"},yt=0,qo=class extends re.Plugin{constructor(){super(...arguments);this.eventRefs=[];this.isEnabled=!0;this.rulesRunner=new uo;this.overridePaste=!1;this.hasCustomCommands=!1;this.customCommandsLock=new qm.default;this.originalSaveCallback=null;this.editorLintFiles=[];this.fileLintFiles=new Set;this.customCommandsCallback=null;this.currentlyOpeningSidebar=!1}async onload(){is(window.localStorage.getItem("language")),yn(E("logs.plugin-load")),this.isEnabled=!0;for(let i in Ce){let n=Ce[i];(0,re.addIcon)(n.id,n.source)}await this.loadSettings(),this.addCommands(),this.registerEventsAndSaveCallback(),this.registerEditorSuggest(new Co(this)),this.settingsTab=new Oo(this.app,this),this.addSettingTab(this.settingsTab)}async onunload(){yn(E("logs.plugin-unload")),this.isEnabled=!1;for(let n of this.eventRefs)this.app.workspace.offref(n);let i=this.app.commands?.commands?.["editor:save-file"];i&&i.callback&&this.originalSaveCallback&&(i.callback=this.originalSaveCallback)}async loadSettings(){let i=await this.loadData();this.settings=Object.assign({},Aa,i),typeof this.settings.logLevel=="number"&&(this.settings.logLevel=Id(this.settings.logLevel)),Ja(this.settings.logLevel),this.setOrUpdateMomentInstance(),this.settings.settingsConvertedToConfigKeyValues||this.moveConfigValuesToKeyBasedFormat();for(let n of Ii)if(this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]=n.getDefaultOptions()),n.alias=="space-between-chinese-japanese-or-korean-and-english-or-numbers"){let r=n.getDefaultOptions();"english-symbols-punctuation-before"in this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]["english-symbols-punctuation-before"]=r["english-symbols-punctuation-before"]),"english-symbols-punctuation-after"in this.settings.ruleConfigs[n.alias]||(this.settings.ruleConfigs[n.alias]["english-symbols-punctuation-after"]=r["english-symbols-punctuation-after"])}this.updatePasteOverrideStatus(),this.updateHasCustomCommandStatus()}async saveSettings(){await this.saveData(this.settings),this.updatePasteOverrideStatus(),this.updateHasCustomCommandStatus()}addCommands(){let i=this;this.addCommand({id:"lint-file",name:E("commands.lint-file.name"),editorCheckCallback(n,r,a){if(n)return i.isMarkdownFile(a.file);i.runLinterEditor(r)},icon:Ce.file.id,hotkeys:[{modifiers:["Mod","Alt"],key:"L"}]}),this.addCommand({id:"lint-file-unless-ignored",name:E("commands.lint-file-unless-ignored.name"),editorCheckCallback(n,r,a){if(n)return i.isMarkdownFile(a.file);i.shouldIgnoreFile(a.file)||i.runLinterEditor(r)},icon:Ce.file.id}),this.addCommand({id:"lint-all-files",name:E("commands.lint-all-files.name"),icon:Ce.vault.id,callback:()=>{let n=E("commands.lint-all-files.start-message"),r=E("commands.lint-all-files.submit-button-text"),a=E("commands.lint-all-files.submit-button-notice-text");new Sa(this.app,n,r,a,()=>this.runLinterAllFiles(this.app),this.settings.lintCommands&&this.settings.lintCommands.length>0).open()}}),this.addCommand({id:"lint-all-files-in-folder",name:E("commands.lint-all-files-in-folder.name"),icon:Ce.folder.id,editorCheckCallback:(n,r,a)=>{if(n)return!a.file.parent.isRoot();this.createFolderLintModal(a.file.parent)}}),this.addCommand({id:"paste-as-plain-text",name:E("commands.paste-as-plain-text.name"),editorCheckCallback:(n,r)=>{if(n)return this.overridePaste;this.pasteAsPlainText(r)}})}registerEventsAndSaveCallback(){let i=this.app.workspace.on("editor-paste",a=>{a.defaultPrevented||!this.overridePaste||this.modifyPasteEvent(a)});this.registerEvent(i),this.eventRefs.push(i),i=this.app.workspace.on("file-menu",(a,s,o)=>this.onMenuOpenCallback(a,s,o)),this.registerEvent(i),this.eventRefs.push(i),this.lastActiveFile=this.app.workspace.getActiveFile(),i=this.app.workspace.on("active-leaf-change",()=>this.onActiveLeafChange()),
${x.frontmatter}---`:(b=x.frontmatter,k+=3),i.replaceRange(b,i.offsetToPos(h.from),i.offsetToPos(h.to)),d=h.from+b.length+k}}let u=!1;l.forEach(h=>{let[x,b]=h;if(u=c.length<d,u&&c.length+b.length>=d&&x==bt.default.DIFF_INSERT){let k=d-c.length;c=b.substring(0,k),b=b.substring(k),u=!1}if(!u){if(x==bt.default.DIFF_INSERT)i.replaceRange(b,this.endOfDocument(c));else if(x==bt.default.DIFF_DELETE){let k=this.endOfDocument(c),A=c;A+=b;let L=this.endOfDocument(A);i.replaceRange("",k,L)}}x!=bt.default.DIFF_DELETE&&(c+=b)});let g=l.map(h=>h[0]==bt.default.DIFF_INSERT?h[1].length:0).reduce((h,x)=>h+x,0),m=l.map(h=>h[0]==bt.default.DIFF_DELETE?h[1].length:0).reduce((h,x)=>h+x,0);this.displayChangedMessage(g,m),!g&&!m?this.runCustomCommands(n):this.editorLintFiles.push(n),Jo(!1)}async setOrUpdateMomentInstance(){let i=localStorage.getItem("language")||"en",n=navigator.language?.toLowerCase(),r=ok[i];this.settings.linterLocale!=="system-default"?r=this.settings.linterLocale:n.startsWith(i)&&(r=n),this.momentLocale=r;let a=Mo.moment.locale(),s=Mo.moment.locale(r);ri(E("logs.moment-locale-not-found").replace("{MOMENT_LOCALE}",r).replace("{CURRENT_LOCALE}",s)),Mo.moment.locale(a)}displayChangedMessage(i,n){if(this.settings.displayChanged){let r=p`
2023-11-09 17:30:33 +08:00
${i} ${E("notice-text.characters-added")}
${n} ${E("notice-text.characters-removed")}
2024-06-12 15:46:38 +08:00
`;new re.Notice(r)}}handleLintError(i,n,r,a=!0){let s=r.replace("{FILE_PATH}",i.path),o=E("logs.see-console");n instanceof En?a?new re.Notice(`${s} ${n.message}.
${o}`,yt):new re.Notice(`${n.message}.
2024-07-08 15:37:38 +08:00
${o}`,yt):new re.Notice(`${E("logs.unknown-error")} ${o}`,yt),Md(s,n)}async modifyPasteEvent(i){let n=this.getEditor();if(!n)return;let r=i.clipboardData.getData("text/plain");if(!r)return;if(kn.test(r.trim())){kt(E("logs.paste-link-warning"));return}if(i.stopPropagation(),i.preventDefault(),!i.defaultPrevented)return;let a=this.app.vault.getConfig("autoConvertHtml"),s=i.clipboardData.getData("text/html"),o=s&&a?(0,re.htmlToMarkdown)(s):r,l=n.listSelections();if(l.length===1){let c=l[0];o=this.rulesRunner.runPasteLint(this.getLineContent(n,c),n.getSelection()??"",ka(o,null,this.momentLocale,this.settings)),n.replaceSelection(o)}else this.handleMultiCursorPaste(n,l,o)}handleMultiCursorPaste(i,n,r){let a=this.convertContentIntoProperPasteContent(n,r),s=[];n.forEach((o,l)=>{r=this.rulesRunner.runPasteLint(this.getLineContent(i,o),i.getRange(o.anchor,o.head)??"",ka(a[l],null,this.momentLocale,this.settings)),s.push({text:r,from:o.anchor,to:o.head})}),i.transaction({changes:s})}convertContentIntoProperPasteContent(i,n){let r=n.split(`
`),a=[];if(r.length%i.length!==0)for(let s=0;s<i.length;s++)a.push(n);else{let s=r.length/i.length,o="";for(let l=0;l<r.length;l++)o+=r[l],(l+1===i.length||(l+1)%s===0)&&(a.push(o),o="")}return a}async pasteAsPlainText(i){let n=await navigator.clipboard.readText();if(!n){new re.Notice(E("notice-text.empty-clipboard"),yt);return}i.replaceSelection(n)}setCustomCommandCallback(i){(0,Im.warn)(E("logs.custom-command-callback-warning")),this.customCommandsCallback=i}async runCustomCommandsInSidebar(i){if(!this.settings.lintCommands||this.settings.lintCommands.length==0||!this.hasCustomCommands)return;let n=this.app.workspace.getRightLeaf(!1),r=this.getEditor();await this.customCommandsLock.acquire("command",async()=>{this.currentlyOpeningSidebar=!0,await n.openFile(i),this.rulesRunner.runCustomCommands(this.settings.lintCommands,this.app.commands),this.customCommandsCallback&&await this.customCommandsCallback(i)}),n.detach(),r&&r.focus(),this.currentlyOpeningSidebar=!1}async runCustomCommands(i){!this.settings.lintCommands||this.settings.lintCommands.length==0||!this.hasCustomCommands||await this.customCommandsLock.acquire("command",async()=>{try{this.rulesRunner.runCustomCommands(this.settings.lintCommands,this.app.commands)}catch(n){this.handleLintError(i,n,E("commands.lint-file.error-message")+" '{FILE_PATH}'",!1)}this.customCommandsCallback&&await this.customCommandsCallback(i)})}getEditor(){let i=this.app.workspace.getActiveViewOfType(re.MarkdownView);return i?i.editor:null}getCurrentMode(){let i=this.app.workspace.getActiveFileView();if(!i)return;let n=i.getState();return Object.hasOwn(n,"source")?n.source?"source":"preview":null}getLineContent(i,n){return i.getLine(n.anchor.line)}moveConfigValuesToKeyBasedFormat(){is("en");for(let i of Ii){let n=E("rules."+i.alias+".name"),r=this.settings.ruleConfigs[n];if(r!=null){let a=E("rules."+i.alias+".description"),s={enabled:r[a]??!1};for(let o of i.options){if(o.configKey==="enabled")continue;let l=E("rules."+i.alias+"."+o.configKey+".name");s[o.configKey]=r[l]??o.defaultValue}this.settings.ruleConfigs[i.alias]=s,delete this.settings.ruleConfigs[n]}}this.settings.settingsConvertedToConfigKeyValues=!0,this.saveSettings(),is(window.localStorage.getItem("language"))}getAllFilesInFolder(i){let n=[],r=[i];for(let a of r)for(let s of a.children)s instanceof re.TFile&&this.isMarkdownFile(s)?n.push(s):s instanceof re.TFolder&&r.push(s);return n}updatePasteOverrideStatus(){for(let i of qt.get("Paste"))if(i.getOptions(this.settings).enabled){this.overridePaste=!0;return}this.overridePaste=!1}updateHasCustomCommandStatus(){for(let i of this.settings.lintCommands)if(i.id&&i.id.trim()!=""){this.hasCustomCommands=!0;return}this.hasCustomCommands=!1}endOfDocument(i){let n=i.split(`
2024-06-12 15:46:38 +08:00
`);return{line:n.length-1,ch:n[n.length-1].length}}};
2023-11-09 17:30:33 +08:00
/*! Bundled license information:
js-yaml/dist/js-yaml.mjs:
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
*/