Templaterã䜿ã£ãŠãhotkeyã§frontmatterïŒæ¥ä»ãªã©çšæãããã®ïŒãæ¿å
¥ïŒæŽæ°ããããšã¯ã§ãã
ããããæŽæ°å¿ããå€ã
ããã®ã§ãä¿åãæŒãããšã«èªåã§å€ãã£ãŠãã£ãŠã»ãã
Obsidian Linterãã»ãŒãããšã«èµ°ãã®ã§ããã°ãåæ§ã®ããšã¯åºæ¥ãŠãããããã¯ãªã
Loading...
That plugin hasn't been updated in a while and seems to have a major bug. Linter may be a better choice for an out-of-the-box solution.
ãããçŽæ¥èšåããŠããããã§ã¯ãªããã確ãã«Obsidian Linterã«post scriptçãªæ©èœã¯ãããã
â ãã£ã
ä¿åæã«åããŠã»ãããªãå Žåããã
éå»èšäºã®ã¿ã€ããèšå®ãçŽãããã ãã§ãæŽæ°æéã¯å€ããããªããªã©
ãªãã ããã çµå±èœåçãªãããããŒã®æ¹ãè¯ãããïŒãªãã ã£ããã ...ïŒ
P.S äžå¿templater scriptãããã«è»¢æ©ããŠãã
frontmatter_date
<%*
// Front matterã®ããŒ
const KEY = 'updated'
// å€ã®æ¥æãã©ãŒããã
const date = tp.date.now("YYYY-MM-DD")
const UPDATED = `${KEY}: ${date}`
const editor = app.workspace.activeLeaf.view.editor
const updatedFrontMatter = tp.frontmatter.updated
if (updatedFrontMatter) {
const index = await tp.user.replace_line_at_word_starts(KEY + ": ", UPDATED)
if (index !== undefined) {
new Notice("æçµæŽæ°æ¥ãæŽæ°ããŸãã")
} else {
new Notice("æçµæŽæ°æ¥ãæŽæ°ããããšããŸããã倱æããŸãã")
}
return
}
const frontMatterBody = `
created: ${date}
${KEY}: ${date}
`.trim()
const hasFrontMatter = Object.keys(tp.frontmatter).length > 0
if (hasFrontMatter) {
await tp.user.insert_new_line_at_word_found("---", frontMatterBody)
return
}
const noteBody = `---
${frontMatterBody}
---
`
await tp.user.insert_new_line_at_first(noteBody)
%>