1
0
Fork 0
EdikoyoWiki-n04/Edikoyo/.obsidian/plugins/templater-obsidian/main.js

20 lines
187 KiB
JavaScript
Raw Normal View History

2024-09-07 02:52:30 +00:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var Ri=Object.create;var ir=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var Hi=Object.getPrototypeOf,Gi=Object.prototype.hasOwnProperty;var En=r=>ir(r,"__esModule",{value:!0});var Vi=(r,e)=>{En(r);for(var t in e)ir(r,t,{get:e[t],enumerable:!0})},Wi=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Li(e))!Gi.call(r,n)&&n!=="default"&&ir(r,n,{get:()=>e[n],enumerable:!(t=Yi(e,n))||t.enumerable});return r},V=r=>Wi(En(ir(r!=null?Ri(Hi(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var kn=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var n=t.length,o=new Uint8Array((n-(t[n-1]=="=")-(t[n-2]=="="))*3/4|0),s=0,l=0;s<n;){var p=r[t.charCodeAt(s++)],A=r[t.charCodeAt(s++)],g=r[t.charCodeAt(s++)],f=r[t.charCodeAt(s++)];o[l++]=p<<2|A>>4,o[l++]=A<<4|g>>2,o[l++]=g<<6|f}return o}})();Vi(exports,{default:()=>fn});var jr=V(require("obsidian"));var I=V(require("obsidian"));var Tn=V(require("obsidian"));function K(r){let e=new Tn.Notice("",8e3);r instanceof w&&r.console_msg?(e.noticeEl.innerHTML=`<b>Templater Error</b>:<br/>${r.message}<br/>Check console for more information`,console.error("Templater Error:",r.message,`
`,r.console_msg)):e.noticeEl.innerHTML=`<b>Templater Error</b>:<br/>${r.message}`}var w=class extends Error{constructor(e,t){super(e);this.console_msg=t;this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}};async function Oe(r,e){try{return await r()}catch(t){return t instanceof w?K(t):K(new w(e,t.message)),null}}function me(r,e){try{return r()}catch(t){return K(new w(e,t.message)),null}}var Xn=V(require("obsidian"));var zn=V(require("obsidian"));var W="top",Z="bottom",Q="right",U="left",or="auto",Ze=[W,Z,Q,U],We="start",at="end",Fn="clippingParents",sr="viewport",wt="popper",Mn="reference",xr=Ze.reduce(function(r,e){return r.concat([e+"-"+We,e+"-"+at])},[]),ar=[].concat(Ze,[or]).reduce(function(r,e){return r.concat([e,e+"-"+We,e+"-"+at])},[]),Ki="beforeRead",Ui="read",zi="afterRead",Ji="beforeMain",Xi="main",Qi="afterMain",Zi="beforeWrite",eo="write",to="afterWrite",Pn=[Ki,Ui,zi,Ji,Xi,Qi,Zi,eo,to];function te(r){return r?(r.nodeName||"").toLowerCase():null}function Y(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function he(r){var e=Y(r).Element;return r instanceof e||r instanceof Element}function ee(r){var e=Y(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function bt(r){if(typeof ShadowRoot=="undefined")return!1;var e=Y(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function ro(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},o=e.attributes[t]||{},s=e.elements[t];!ee(s)||!te(s)||(Object.assign(s.style,n),Object.keys(o).forEach(function(l){var p=o[l];p===!1?s.removeAttribute(l):s.setAttribute(l,p===!0?"":p)}))})}function no(r){var e=r.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(n){var o=e.elements[n],s=e.attributes[n]||{},l=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),p=l.reduce(function(A,g){return A[g]="",A},{});!ee(o)||!te(o)||(Object.assign(o.style,p),Object.keys(s).forEach(function(A){o.removeAttribute(A)}))})}}var Bn={name:"applyStyles",enabled:!0,phase:"write",fn:ro,effect:no,requires:["computeStyles"]};function re(r){return r.split("-")[0]}var ye=Math.max,lt=Math.min,Ke=Math.round;function yt(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function qt(){return!/^((?!chrome|android).)*safari/i.test(yt())}function je(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),o=1,s=1;e&&ee(r)&&(o=r.offsetWidth>0&&Ke(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ke(n.height)/r.offsetHeight||1);var l=he(r)?Y(r):window,p=l.visualViewport,A=!qt()&&t,g=(n.left+(A&&p?p.offsetLeft:0))/o,f=(n.top+(A&&p?p.offsetTop:0))/s,b=n.width/o,k=n.height/s;return{width:b,height:k,top:f,right:g+b,bottom:f+k,left:g,x:g,y:f}}function ct(r){var e=je(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function It(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&bt(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ae(r){return Y(r).getComputedStyle(r)}function Er(r){return["table","td","th"].indexOf(te(r))>=0}function ne(r){return((he(r)?r.ownerDocument:r.document)||window.document).documentElement}function Ue(r){return te(r)==="html"?r:r.assignedSlot||r.parentNode||(bt(r)?r.host:null)||ne(r)}function On(r){return!ee(r)||Ae(r).position==="fixed"?null:r.offsetParent}function io(r){var e=/firefox/i.test(yt()),t=/Trident/i.test(yt());if(t&&ee(r)){var n=Ae(r);if(n.position==="fixed")return null}var o=Ue(r);for(bt(o)&&(o=o.host);ee(o)&&["html","body"].indexOf(te(o))<0;){va
> \u2014 ${n}`}catch{return new w("Error generating daily quote"),"Error generating daily quote"}}}generate_random_picture(){return async(e,t,n=!1)=>{try{let o=await this.getRequest(`https://templater-unsplash-2.fly.dev/${t?"?q="+t:""}`).then(l=>l.json()),s=o.full;if(e&&!n)if(e.includes("x")){let[l,p]=e.split("x");s=s.concat(`&w=${l}&h=${p}`)}else s=s.concat(`&w=${e}`);return n?`![photo by ${o.photog}(${o.photogUrl}) on Unsplash|${e}](${s})`:`![photo by ${o.photog}(${o.photogUrl}) on Unsplash](${s})`}catch{return new w("Error generating random picture"),"Error generating random picture"}}}generate_request(){return async(e,t)=>{try{let o=await(await this.getRequest(e)).json();return t&&o?t.split(".").reduce((s,l)=>{if(s&&s.hasOwnProperty(l))return s[l];throw new Error(`Path ${t} not found in the JSON response`)},o):o}catch(n){throw console.error(n),new w("Error fetching and extracting value")}}}};var Hr=class extends pe{constructor(){super(...arguments);this.name="hooks";this.event_refs=[]}async create_static_templates(){this.static_functions.set("on_all_templates_executed",this.generate_on_all_templates_executed())}async create_dynamic_templates(){}async teardown(){this.event_refs.forEach(e=>{e.e.offref(e)}),this.event_refs=[]}generate_on_all_templates_executed(){return e=>{let t=app.workspace.on("templater:all-templates-executed",async()=>{await pr(1),e()});t&&this.event_refs.push(t)}}};var Gr=class extends pe{constructor(){super(...arguments);this.name="frontmatter"}async create_static_templates(){}async create_dynamic_templates(){let e=app.metadataCache.getFileCache(this.config.target_file);this.dynamic_functions=new Map(Object.entries(e?.frontmatter||{}))}async teardown(){}};var Ce=V(require("obsidian"));var Vr=class extends Ce.Modal{constructor(e,t,n){super(app);this.prompt_text=e;this.default_value=t;this.multi_line=n;this.submitted=!1}onOpen(){this.titleEl.setText(this.prompt_text),this.createForm()}onClose(){this.contentEl.empty(),this.submitted||this.reject(new w("Cancelled prompt"))}createForm(){let e=this.contentEl.createDiv();e.addClass("templater-prompt-div");let t;if(this.multi_line){t=new Ce.TextAreaComponent(e);let n=this.contentEl.createDiv();n.addClass("templater-button-div");let o=new Ce.ButtonComponent(n);o.buttonEl.addClass("mod-cta"),o.setButtonText("Submit").onClick(s=>{this.resolveAndClose(s)})}else t=new Ce.TextComponent(e);this.value=this.default_value??"",t.inputEl.addClass("templater-prompt-input"),t.setPlaceholder("Type text here"),t.setValue(this.value),t.onChange(n=>this.value=n),t.inputEl.addEventListener("keydown",n=>this.enterCallback(n))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Ce.Platform.isDesktop&&e.key==="Enter"&&!e.shiftKey&&this.resolveAndClose(e):e.key==="Enter"&&this.resolveAndClose(e))}resolveAndClose(e){this.submitted=!0,e.preventDefault(),this.resolve(this.value),this.close()}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var ai=V(require("obsidian")),Wr=class extends ai.FuzzySuggestModal{constructor(e,t,n,o){super(app);this.text_items=e;this.items=t;this.submitted=!1;this.setPlaceholder(n),o&&(this.limit=o)}getItems(){return this.items}onClose(){this.submitted||this.reject(new w("Cancelled prompt"))}selectSuggestion(e,t){this.submitted=!0,this.close(),this.onChooseSuggestion(e,t)}getItemText(e){return this.text_items instanceof Function?this.text_items(e):this.text_items[this.items.indexOf(e)]||"Undefined Text Item"}onChooseItem(e){this.resolve(e)}async openAndGetValue(e,t){this.resolve=e,this.reject=t,this.open()}};var Kr=class extends pe{constructor(){super(...arguments);this.name="system"}async create_static_templates(){this.static_functions.set("clipboard",this.generate_clipboard()),this.static_functions.set("prompt",this.generate_prompt()),this.static_functions.set("suggester",this.generate_suggester())}async create_dynamic_templates(){}async teardown(){}generate_clipboard(){return async()=>await navigator.clipboard.readText()}generate_prompt(){return async(e,t,n=!1,o=!1)=>{let s=new Vr(e,t,o),l=new Promise((p,A)=>s.openA
})`)(n,s,o)}catch(A){throw new w(`Failed to load user script at "${e.path}".`,A.message)}let p=o.default||s.exports;if(!p)throw new w(`Failed to load user script at "${e.path}". No exports detected.`);if(!(p instanceof Function))throw new w(`Failed to load user script at "${e.path}". Default export is not a function.`);t.set(`${e.basename}`,p)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var Qr=class{constructor(e){this.plugin=e;this.user_system_functions=new Jr(e),this.user_script_functions=new Xr(e)}async generate_object(e){let t={},n={};return this.plugin.settings.enable_system_commands&&(t=await this.user_system_functions.generate_object(e)),this.plugin.settings.user_scripts_folder&&(n=await this.user_script_functions.generate_object()),{...t,...n}}};var Mo=V(require("obsidian")),De;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(De||(De={}));var Zr=class{constructor(e){this.plugin=e;this.internal_functions=new zr(this.plugin),this.user_functions=new Qr(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{obsidian:Mo}}async generate_object(e,t=1){let n={},o=this.additional_functions(),s=await this.internal_functions.generate_object(e),l={};switch(Object.assign(n,o),t){case 0:Object.assign(n,s);break;case 1:l=await this.user_functions.generate_object(e),Object.assign(n,{...s,user:l});break}return n}};var No={},v,ke=new Array(32).fill(void 0);ke.push(void 0,null,!0,!1);function de(r){return ke[r]}var Vt=ke.length;function Po(r){r<36||(ke[r]=Vt,Vt=r)}function en(r){let e=de(r);return Po(r),e}var Ai=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Ai.decode();var ur=new Uint8Array;function mr(){return ur.byteLength===0&&(ur=new Uint8Array(v.memory.buffer)),ur}function tt(r,e){return Ai.decode(mr().subarray(r,r+e))}function rt(r){Vt===ke.length&&ke.push(ke.length+1);let e=Vt;return Vt=ke[e],ke[e]=r,e}var Te=0,fr=new TextEncoder("utf-8"),Bo=typeof fr.encodeInto=="function"?function(r,e){return fr.encodeInto(r,e)}:function(r,e){let t=fr.encode(r);return e.set(t),{read:r.length,written:t.length}};function ze(r,e,t){if(t===void 0){let p=fr.encode(r),A=e(p.length);return mr().subarray(A,A+p.length).set(p),Te=p.length,A}let n=r.length,o=e(n),s=mr(),l=0;for(;l<n;l++){let p=r.charCodeAt(l);if(p>127)break;s[o+l]=p}if(l!==n){l!==0&&(r=r.slice(l)),o=t(o,n,n=l+r.length*3);let p=mr().subarray(o+l,o+n);l+=Bo(r,p).written}return Te=l,o}function Oo(r){return r==null}var dr=new Int32Array;function ge(){return dr.byteLength===0&&(dr=new Int32Array(v.memory.buffer)),dr}function tn(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let o=r.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){let o=r.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(r)){let o=r.length,s="[";o>0&&(s+=tn(r[0]));for(let l=1;l<o;l++)s+=", "+tn(r[l]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
${r.stack}`:n}function qo(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`);return r.ptr}var gr=32;function Io(r){if(gr==1)throw new Error("out of js stack");return ke[--gr]=r,gr}function rn(r,e){try{return r.apply(this,e)}catch(t){v.__wbindgen_exn_store(rt(t))}}var dt=class{static __wrap(e){let t=Object.create(dt.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();v.__wbg_parserconfig_free(e)}get interpolate(){let e=v.__wbg_get_parserconfig_interpolate(this.ptr);return String.fromCodePoint(e)}set interpolate(e){v.__wbg_set_parserconfig_interpolate(this.ptr,e.codePointAt(0))}get execution(){let e=v.__wbg_get_parserconfig_execution(this.ptr);return String.fromCodePoint(e)}set execution(e){v.__wbg_set_parserconfig_execution(this.ptr,e.codePointAt(0))}get single_whitespace(){let e=v.__wbg_get_parserconfig_single_whitespace(this.ptr);return String.fromCodePoint(e)}set single_whitespace(e){v.__wbg_set_parserconfig_single_whitespace(this.ptr,e.codePointAt(0))}get multiple_whitespace(){let e=v.__wbg_get_parserconfig_multiple_whitespace(this.ptr);return String.fromCodePoint(e)}set multiple_whitespace(e){v.__wbg_set_parserconfig_multiple_whitespace(this.ptr,e.codePointAt(0))}constructor(e,t,n,o,s,l,p){let A=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),g=Te,f=ze(t,v.__wbindgen_malloc,v.__wbindgen_realloc),b=Te,k=ze(p,v.__wbindgen_malloc,v.__wbindgen_realloc),x=Te,O=v.parserconfig_new(A,g,f,b,n.codePointAt(0),o.codePointAt(0),s.codePointAt(0),l.codePointAt(0),k,x);return dt.__wrap(O)}get opening_tag(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_opening_tag(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return tt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set opening_tag(e){let t=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Te;v.parserconfig_set_opening_tag(this.ptr,t,n)}get closing_tag(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_closing_tag(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return tt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set closing_tag(e){let t=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Te;v.parserconfig_set_closing_tag(this.ptr,t,n)}get global_var(){try{let n=v.__wbindgen_add_to_stack_pointer(-16);v.parserconfig_global_var(n,this.ptr);var e=ge()[n/4+0],t=ge()[n/4+1];return tt(e,t)}finally{v.__wbindgen_add_to_stack_pointer(16),v.__wbindgen_free(e,t)}}set global_var(e){let t=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),n=Te;v.parserconfig_set_global_var(this.ptr,t,n)}},Ft=class{static __wrap(e){let t=Object.create(Ft.prototype);return t.ptr=e,t}__destroy_into_raw(){let e=this.ptr;return this.ptr=0,e}free(){let e=this.__destroy_into_raw();v.__wbg_renderer_free(e)}constructor(e){qo(e,dt);var t=e.ptr;e.ptr=0;let n=v.renderer_new(t);return Ft.__wrap(n)}render_content(e,t){try{let l=v.__wbindgen_add_to_stack_pointer(-16),p=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),A=Te;v.renderer_render_content(l,this.ptr,p,A,Io(t));var n=ge()[l/4+0],o=ge()[l/4+1],s=ge()[l/4+2];if(s)throw en(o);return en(n)}finally{v.__wbindgen_add_to_stack_pointer(16),ke[gr++]=void 0}}};async function So(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=await r.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}}function Co(){let r={};return r.wbg={},r.wbg.__wbindgen_object_drop_ref=function(e){en(e)},r.wbg.__wbindgen_string_new=function(e,t){let n=tt(e,t);return rt(n)},r.wbg.__wbindgen_string_get=function(e,t){let n=de
`,l+1))!==-1;o++,s=l);s+=1;let p=e.slice(s,t).length;return{line:o,ch:p}}replace_and_get_cursor_positions(e){let t=[],n,o=new RegExp("<%\\s*tp.file.cursor\\((?<order>[0-9]*)\\)\\s*%>","g");for(;(n=o.exec(e))!=null;)t.push(n);if(t.length===0)return{};t.sort((A,g)=>Number(A.groups&&A.groups.order)-Number(g.groups&&g.groups.order));let s=t[0][0];t=t.filter(A=>A[0]===s);let l=[],p=0;for(let A of t){let g=A.index-p;if(l.push(this.get_editor_position_from_index(e,g)),e=e.replace(new RegExp(Qn(A[0])),""),p+=A[0].length,A[1]==="")break}return{new_content:e,positions:l}}set_cursor_location(e){let t=app.workspace.activeEditor;if(!t||!t.editor)return;let n=t.editor,o=[];for(let l of e)o.push({from:l});let s={selections:o};n.transaction(s)}};var _i=V(require("obsidian"));var Yo={config:{name:"config",description:`This module exposes Templater's running configuration.
This is mostly useful when writing scripts requiring some context information.
`,functions:{template_file:{name:"template_file",description:"The `TFile` object representing the template file.",definition:"tp.config.template_file"},target_file:{name:"target_file",description:"The `TFile` object representing the target file where the template will be inserted.",definition:"tp.config.target_file"},run_mode:{name:"run_mode",description:"The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...).",definition:"tp.config.run_mode"},active_file:{name:"active_file",description:"The active file (if existing) when launching Templater.",definition:"tp.config.active_file?"}}},date:{name:"date",description:"This module contains every internal function related to dates.",functions:{now:{name:"now",description:"Retrieves the date.",definition:'tp.date.now(format: string = "YYYY-MM-DD", offset?: number\u23AEstring, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"offset",description:"Duration to offset the date from. If a number is provided, duration will be added to the date in days. You can also specify the offset as a string using the ISO 8601 format."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"Date now",example:"<% tp.date.now() %>"},{name:"Date now with format",example:'<% tp.date.now("Do MMMM YYYY") %>'},{name:"Last week",example:'<% tp.date.now("YYYY-MM-DD", -7) %>'},{name:"Next week",example:'<% tp.date.now("YYYY-MM-DD", 7) %>'},{name:"Last month",example:'<% tp.date.now("YYYY-MM-DD", "P-1M") %>'},{name:"Next year",example:'<% tp.date.now("YYYY-MM-DD", "P1Y") %>'},{name:"File's title date + 1 day (tomorrow)",example:'<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>'},{name:"File's title date - 1 day (yesterday)",example:'<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>'}]},tomorrow:{name:"tomorrow",description:"Retrieves tomorrow's date.",definition:'tp.date.tomorrow(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date tomorrow",example:"<% tp.date.tomorrow() %>"},{name:"Date tomorrow with format",example:'<% tp.date.tomorrow("Do MMMM YYYY") %>'}]},yesterday:{name:"yesterday",description:"Retrieves yesterday's date.",definition:'tp.date.yesterday(format: string = "YYYY-MM-DD")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"Date yesterday",example:"<% tp.date.yesterday() %>"},{name:"Date yesterday with format",example:'<% tp.date.yesterday("Do MMMM YYYY") %>'}]},weekday:{name:"weekday",description:"",definition:'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'},{name:"weekday",description:"Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day."},{name:"reference",description:"The date referential, e.g. set this to the note's title."},{name:"reference_format",description:"The format for the reference date. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/)."}],examples:[{name:"This week's Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0) %>'},{name:"Next Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 7) %>'},{name:"File's title Monday",example:'<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>'},{nam
You can navigate between the different cursors using the configured hotkey in Obsidian settings.
`,definition:"tp.file.cursor(order?: number)",args:[{name:"order",description:`The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.
If you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.
`}],examples:[{name:"File cursor",example:"<% tp.file.cursor() %>"},{name:"File multi-cursor",example:"<% tp.file.cursor(1) %>Content<% tp.file.cursor(1) %>"}]},cursor_append:{name:"cursor_append",description:"Appends some content after the active cursor in the file.",definition:"tp.file.cursor_append(content: string)",args:[{name:"content",description:"The content to append after the active cursor."}],examples:[{name:"File cursor append",example:'<% tp.file.cursor_append("Some text") %>'}]},exists:{name:"exists",description:"Check to see if a file exists by it's file path. The full path to the file, relative to the Vault and containing the extension, must be provided.",definition:"tp.file.exists(filepath: string)",args:[{name:"filepath",description:"The full file path of the file we want to check existence for."}],examples:[{name:"File existence",example:'<% await tp.file.exists("MyFolder/MyFile.md") %>'},{name:"File existence of current file",example:'<% await tp.file.exists(tp.file.folder(true) + "/" + tp.file.title + ".md") %>'}]},find_tfile:{name:"find_tfile",description:"Search for a file and returns its `TFile` instance.",definition:"tp.file.find_tfile(filename: string)",args:[{name:"filename",description:"The filename we want to search and resolve as a `TFile`."}],examples:[{name:"File find TFile",example:'<% tp.file.find_tfile("MyFile").basename %>'}]},folder:{name:"folder",description:"Retrieves the file's folder name.",definition:"tp.file.folder(relative: boolean = false)",args:[{name:"relative",description:"If set to `true`, appends the vault relative path to the folder name. If `false`, only retrieves name of folder. Defaults to `false`."}],examples:[{name:"File folder (Folder)",example:"<% tp.file.folder() %>"},{name:"File folder with relative path (Path/To/Folder)",example:"<% tp.file.folder(true) %>"}]},include:{name:"include",description:"Includes the file's link content. Templates in the included content will be resolved.",definition:"tp.file.include(include_link: string \u23AE TFile)",args:[{name:"include_link",description:'The link to the file to include, e.g. `"[[MyFile]]"`, or a TFile object. Also supports sections or blocks inclusions.'}],examples:[{name:"File include",example:'<% tp.file.include("[[Template1]]") %>'},{name:"File include TFile",example:'<% tp.file.include(tp.file.find_tfile("MyFile")) %>'},{name:"File include section",example:'<% tp.file.include("[[MyFile#Section1]]") %>'},{name:"File include block",example:'<% tp.file.include("[[MyFile#^block1]]") %>'}]},last_modified_date:{name:"last_modified_date",description:"Retrieves the file's last modification date.",definition:'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")',args:[{name:"format",description:'The format for the date. Defaults to `"YYYY-MM-DD HH:mm"`. Refer to [format reference](https://momentjs.com/docs/#/displaying/format/).'}],examples:[{name:"File last modified date",example:"<% tp.file.last_modified_date() %>"},{name:"File last modified date with format",example:'<% tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm") %>'}]},move:{name:"move",description:"Moves the file to the desired vault location.",definition:"tp.file.move(new_path: string, file_to_move?: TFile)",args:[{name:"new_path",description:'The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. `"/Notes/MyNote"`.'},{name:"file_to_move",description:"The file to move, defaults to the current file."}],examples:[{name:"File move",example:'<% await tp.file.move("/A/B/" + tp.file.title) %>'},{name:"File move and rename",example:'<% await tp.file.move("/A/B/NewTitle") %>'}]},path:{name:"path",description:"Retrieves the file's absolute path on the system.",definition:"tp.file.path(relative: boolean = false)",args:[{name:"relative",description:"If set to `true`, only retrieves the vault's relative path."}],examples:[{name:"File path",example:"<% tp.file.path() %>"},{name:"File relative path (relative to vault root)",example:"<% tp.file.path(true) %>"}]},rename:{name: