模板
链接:视频链接
一Books (Templater Advanced Version)
---
<%*
let title = tp.file.title;
if (title.startsWith("Untitled")) {
title = await tp.system.prompt("Enter the title of the book");
if(!title) return;
}
if (title == "") {
title = "Untitled";
} else {
await tp.file.rename(title);
}
await tp.file.move("/books/" + title)
-%>
type: books
title: "[[<% title %>]]"
cover:
author: '[[<% tp.system.prompt("Enter the author of the book")%>]]'
genre: <% tp.system.suggester(["fiction", "non-fiction"], ["fiction", "non-fiction"], true, 'genre')%>
status: <% tp.system.suggester(["done", "reading", "to-read"], ["done", "reading", "to-read"], true, 'status')%>
rating:
myRating:
summary:
date_creation: <% tp.file.creation_date("YYYY-MM-DD") %>
date_start:
date_finish:
---
## 3 sentences to describe the book
1. <% tp.file.cursor() %>
2.
3.
## 5 take aways
1.
2.
3.
4.
5.
## Review
## Related
## Reference
二Books (Templater Basic Version)
--- type: books title: "[[<% tp.file.title %>]]" cover: author: - '[[<% tp.system.prompt("请输入作者")%>]]' genre: <% tp.system.suggester(["fiction", "non-fiction"], ["fiction", "non-fiction"], true, 'genre')%> status: <% tp.system.suggester(["to-read", "reading", "done"], ["to-read", "reading", "done"], true, 'status')%> rating: myRating: summary: date_creation: <% tp.file.creation_date("YYYY-MM-DD") %> date_start: date_finish: --- ## 3 sentences to describe the book 1. 2. 3. ## 5 take aways 1. 2. 3. 4. 5. ## Review <% tp.file.cursor() %> ## Related ## Reference
三Books (Templates Version)
--- type: books title: cover: author: genre: status: rating: myRating: summary: date_creation: {{date:}} date_start: date_finish: --- ## 3 sentences to describe the book 1. 2. 3. ## 5 take aways 1. 2. 3. 4. 5. ## Review ## Related ## Reference
四Capture
<%* const file = tp.file.find_tfile(tp.date.now("YYYY-MM-DD")) if (file) { const loggedItem = await tp.system.prompt("What's Up?") const time = tp.date.now("HH:mm") const content = (await app.vault.read(file)).split("\n") const index = content.indexOf("### What happened today?") content.splice(index + 1, 0, `- ${time} - ${loggedItem}`) await app.vault.modify(file, content.join("\n")) } else { new Notification("No Daily Note Found!") } -%>
五Insert Callouts
<%* const callouts = { note: '🔵 ✏ Note', info: '🔵 ℹ Info', todo: '🔵 🔳 Todo', tip: '🌐 🔥 Tip / Hint / Important', abstract: '🌐 📋 Abstract / Summary / TLDR', question: '🟡 ❓ Question / Help / FAQ', quote: '🔘 💬 Quote / Cite', example: '🟣 📑 Example', success: '🟢 ✔ Success / Check / Done', warning: '🟠 ⚠ Warning / Caution / Attention', failure: '🔴 ❌ Failure / Fail / Missing', danger: '🔴 ⚡ Danger / Error', bug: '🔴 🐞 Bug', }; const type = await tp.system.suggester(Object.values(callouts), Object.keys(callouts), true, 'Select callout type.'); const fold = await tp.system.suggester(['None', 'Expanded', 'Collapsed'], ['', '+', '-'], true, 'Select callout fold option.'); const title = await tp.system.prompt('Title:', '', true); let content = await tp.system.prompt('Content (New line -> Shift + Enter):', '', true, true); content = content.split('\n').map(line => `> ${line}`).join('\n') const calloutHead = `> [!${type}]${fold} ${title}\n`; tR += calloutHead + content -%>