You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
191 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
3 years ago
2 months ago
var Yi=Object.create;var ir=Object.defineProperty;var Li=Object.getOwnPropertyDescriptor;var Hi=Object.getOwnPropertyNames;var Gi=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var kn=r=>ir(r,"__esModule",{value:!0});var Wi=(r,e)=>{kn(r);for(var t in e)ir(r,t,{get:e[t],enumerable:!0})},Ki=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Hi(e))!Vi.call(r,n)&&n!=="default"&&ir(r,n,{get:()=>e[n],enumerable:!(t=Li(e,n))||t.enumerable});return r},G=r=>Ki(kn(ir(r!=null?Yi(Gi(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Tn=(()=>{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 A=r[t.charCodeAt(s++)],p=r[t.charCodeAt(s++)],g=r[t.charCodeAt(s++)],f=r[t.charCodeAt(s++)];o[l++]=A<<2|p>>4,o[l++]=p<<4|g>>2,o[l++]=g<<6|f}return o}})();Wi(exports,{default:()=>dn});var _r=G(require("obsidian"));var M=G(require("obsidian"));var Fn=G(require("obsidian"));function K(r){let e=new Fn.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 ye(r,e){try{return await r()}catch(t){return t instanceof w?K(t):K(new w(e,t.message)),null}}function pe(r,e){try{return r()}catch(t){return K(new w(e,t.message)),null}}var Ie=G(require("obsidian"));function or(r){return new Promise(e=>setTimeout(e,r))}function Mn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pn(){return/(<%(?:-|_)?\s*[*~]{0,1})\+((?:.|\s)*?%>)/g}function Ui(r){r=(0,Ie.normalizePath)(r);let e=app.vault.getAbstractFileByPath(r);if(!e)throw new w(`Folder "${r}" doesn't exist`);if(!(e instanceof Ie.TFolder))throw new w(`${r} is a file, not a folder`);return e}function at(r){r=(0,Ie.normalizePath)(r);let e=app.vault.getAbstractFileByPath(r);if(!e)throw new w(`File "${r}" doesn't exist`);if(!(e instanceof Ie.TFile))throw new w(`${r} is a folder, not a file`);return e}function Ce(r){let e=Ui(r),t=[];return Ie.Vault.recurseChildren(e,n=>{n instanceof Ie.TFile&&t.push(n)}),t.sort((n,o)=>n.path.localeCompare(o.path)),t}function lt(r,e,t){if(t<0||t===r.length)return;let n=r[e];r[e]=r[t],r[t]=n}function yt(r){return r.workspace.activeEditor?.file??r.workspace.getActiveFile()}function Bn(r){let e=r.lastIndexOf("/");return e!==-1?r.slice(0,e):""}var ti=G(require("obsidian"));var Zn=G(require("obsidian"));var W="top",Z="bottom",Q="right",U="left",sr="auto",Ze=[W,Z,Q,U],We="start",ct="end",On="clippingParents",ar="viewport",xt="popper",qn="reference",Er=Ze.reduce(function(r,e){return r.concat([e+"-"+We,e+"-"+ct])},[]),lr=[].concat(Ze,[sr]).reduce(function(r,e){return r.concat([e,e+"-"+We,e+"-"+ct])},[]),zi="beforeRead",Ji="read",Xi="afterRead",Qi="beforeMain",Zi="main",eo="afterMain",to="beforeWrite",ro="write",no="afterWrite",In=[zi,Ji,Xi,Qi,Zi,eo,to,ro,no];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 Et(r){if(typeof ShadowRoot=="undefined")return!1;var e=Y(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function io(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 A=o[l];A===!1?s.removeAttribute(l):s.setAttribute(l,A===!0?"":A)}))})}function oo(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]),A=l.reduce(function(p,g){return p[g]="",p},{});!ee(o)||!te(o)||(Object.assign(o.style,A),Object.keys(s).forEach(function(p){o.removeAttribute(p)}))})}}var Cn={name:"applyStyles",enabled:!0,phase:"write",fn:io,effect:oo,requires:["computeStyles"]};function re(r){return r.split("-")[0]}var xe=Math.max,pt=Math.min,Ke=Math.round;function kt(){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 St(){return!/^((?!chrome|android).)*safari/i.test(kt())}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,A=l.visualViewport,p=!St()&&t,g=(n.left+(p&&A?A.offsetLeft:0))/o,f=(n.top+(p&&A?A.offsetTop:0))/s,b=n.width/o,k=n.he
> \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,A]=e.split("x");s=s.concat(`&w=${l}&h=${A}`)}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 Gr=class extends ue{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 or(1),e()});t&&this.event_refs.push(t)}}};var Vr=class extends ue{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 Se=G(require("obsidian"));var Wr=class extends Se.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 Se.TextAreaComponent(e);let n=this.contentEl.createDiv();n.addClass("templater-button-div");let o=new Se.ButtonComponent(n);o.buttonEl.addClass("mod-cta"),o.setButtonText("Submit").onClick(s=>{this.resolveAndClose(s)})}else t=new Se.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.focus(),t.inputEl.addEventListener("keydown",n=>this.enterCallback(n))}enterCallback(e){e.isComposing||e.keyCode===229||(this.multi_line?Se.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 li=G(require("obsidian")),Kr=class extends li.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 Ur=class extends ue{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 Wr(e,t,o),l=new Promise(
2 months ago
})`)(n,s,o)}catch(p){throw new w(`Failed to load user script at "${e.path}".`,p.message)}let A=o.default||s.exports;if(!A)throw new w(`Failed to load user script at "${e.path}". No exports detected.`);if(!(A instanceof Function))throw new w(`Failed to load user script at "${e.path}". Default export is not a function.`);t.set(`${e.basename}`,A)}async generate_object(){let e=await this.generate_user_script_functions();return Object.fromEntries(e)}};var Zr=class{constructor(e){this.plugin=e;this.user_system_functions=new Xr(e),this.user_script_functions=new Qr(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 Po=G(require("obsidian")),De;(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.USER_INTERNAL=1]="USER_INTERNAL"})(De||(De={}));var en=class{constructor(e){this.plugin=e;this.internal_functions=new Jr(this.plugin),this.user_functions=new Zr(this.plugin)}async init(){await this.internal_functions.init()}async teardown(){await this.internal_functions.teardown()}additional_functions(){return{obsidian:Po}}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 Ro={},v,Fe=new Array(32).fill(void 0);Fe.push(void 0,null,!0,!1);function de(r){return Fe[r]}var Vt=Fe.length;function Bo(r){r<36||(Fe[r]=Vt,Vt=r)}function tn(r){let e=de(r);return Bo(r),e}var Ai=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Ai.decode();var mr=new Uint8Array;function fr(){return mr.byteLength===0&&(mr=new Uint8Array(v.memory.buffer)),mr}function tt(r,e){return Ai.decode(fr().subarray(r,r+e))}function rt(r){Vt===Fe.length&&Fe.push(Fe.length+1);let e=Vt;return Vt=Fe[e],Fe[e]=r,e}var Me=0,dr=new TextEncoder("utf-8"),Oo=typeof dr.encodeInto=="function"?function(r,e){return dr.encodeInto(r,e)}:function(r,e){let t=dr.encode(r);return e.set(t),{read:r.length,written:t.length}};function ze(r,e,t){if(t===void 0){let A=dr.encode(r),p=e(A.length);return fr().subarray(p,p+A.length).set(A),Me=A.length,p}let n=r.length,o=e(n),s=fr(),l=0;for(;l<n;l++){let A=r.charCodeAt(l);if(A>127)break;s[o+l]=A}if(l!==n){l!==0&&(r=r.slice(l)),o=t(o,n,n=l+r.length*3);let A=fr().subarray(o+l,o+n);l+=Oo(r,A).written}return Me=l,o}function qo(r){return r==null}var gr=new Int32Array;function ge(){return gr.byteLength===0&&(gr=new Int32Array(v.memory.buffer)),gr}function rn(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+=rn(r[0]));for(let l=1;l<o;l++)s+=", "+rn(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 Io(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`);return r.ptr}var hr=32;function Co(r){if(hr==1)throw new Error("out of js stack");return Fe[--hr]=r,hr}function nn(r,e){try{return r.apply(this,e)}catch(t){v.__wbindgen_exn_store(rt(t))}}var ht=class{static __wrap(e){let t=Object.create(ht.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,A){let p=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),g=Me,f=ze(t,v.__wbindgen_malloc,v.__wbindgen_realloc),b=Me,k=ze(A,v.__wbindgen_malloc,v.__wbindgen_realloc),x=Me,q=v.parserconfig_new(p,g,f,b,n.codePointAt(0),o.codePointAt(0),s.codePointAt(0),l.codePointAt(0),k,x);return ht.__wrap(q)}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=Me;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=Me;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=Me;v.parserconfig_set_global_var(this.ptr,t,n)}},Bt=class{static __wrap(e){let t=Object.create(Bt.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){Io(e,ht);var t=e.ptr;e.ptr=0;let n=v.renderer_new(t);return Bt.__wrap(n)}render_content(e,t){try{let l=v.__wbindgen_add_to_stack_pointer(-16),A=ze(e,v.__wbindgen_malloc,v.__wbindgen_realloc),p=Me;v.renderer_render_content(l,this.ptr,A,p,Co(t));var n=ge()[l/4+0],o=ge()[l/4+1],s=ge()[l/4+2];if(s)throw tn(o);return tn(n)}finally{v.__wbindgen_add_to_stack_pointer(16),Fe[hr++]=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 Do(){let r={};return r.wbg={},r.wbg.__wbindgen_object_drop_ref=function(e){tn(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
2 months ago
`,l+1))!==-1;o++,s=l);s+=1;let A=e.slice(s,t).length;return{line:o,ch:A}}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((p,g)=>Number(p.groups&&p.groups.order)-Number(g.groups&&g.groups.order));let s=t[0][0];t=t.filter(p=>p[0]===s);let l=[],A=0;for(let p of t){let g=p.index-A;if(l.push(this.get_editor_position_from_index(e,g)),e=e.replace(new RegExp(Mn(p[0])),""),A+=p[0].length,p[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 vi=G(require("obsidian"));var Lo={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(absolute: boolean = false)",args:[{name:"absolute",description:"If set to `true`, returns the vault-absolute path of the folder. If `false`, only returns the basename of the folder (the last part). Defaults to `false`."}],examples:[{name:"File folder (Folder)",example:"<% tp.file.folder() %>"},{name:"File folder with vault-absolute 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