
obsidian template 관련 플러그인을 하나씩 설정해보자
오늘 설치하고 테스트할 플러그인은 3개 인데
1. calendar
2. periodic Notes
3. templater
다.
calendar를 설치해보자별다른 설정을 할건 없다.

캘린더를 클릭하면 daily 또는 weekly note가 생성됨
periodic Notes을 설치해보자.periodic Notes 플러그인은 calendar에서 daily, weekly note를 생성 될때, periodic Notes에 등록한 템플릿을 사용해서 Note를 생성한다.
calendar플러그인이periodic Note플러그인 설정에 따라 Note를 생성 된다는게 중요
periodic Notes - daily Note 생성 설정
YYYY/MM//YYYY-MM-DD ( ddd )/를 넣으면 알아서 폴더를 생성해 파일을 만들어 준다_template/daily.mddiary/dailyNote Folder를 기준으로 Format 설정에 맞게 Note를 생성하게 된다.
diary/daily/2023/09/2023-09-23 ( Sat )으로 만들어짐!
_template/daily.md

_template폴더를 만들어서 daily, weekly, montly, quarterly, yearly 템플릿들을 모아 두었다.
다 쓸지 모르겠지만 daily, weekly, montly, quarterly, yearly 템플릿 만들고,
periodic Notes에서 각각 활성 시켜둠 (언젠가 쓰지 않을까...😜)

templater 설치, 이것만 하면 template 설정은 마무리!!!https://silentvoid13.github.io/Templater/
좀 더 커스텀하게 동적으로 template를 생성 할 수 있는 플러그인
js 스크립트를 등록하여 function을 등록 할 수도 있다함 >> 아직 안해봄
간단한 스크립트( {{date}} )는 굳이
templater플러그인 없이 template에 적용시킬수 있다.
templater 설정해보면 일단 Template folder location 지정 >>> _template 위에서 template 모아둔 폴더 지정
중요한게
Trigger Templater on new file creation를 활성해줘야calendar에서periodic Notes를 활용하여 template를 만들때, 스크립트가 적용된 Note를 만들 수 있음! 휴우😤

Trigger Templater on new file creation를 활성해주면 Folder Templates - Add New가 열리는데, 여기에 template을 추가해줘야 해당 template가 생성될때, template 안에 있는 스크립트를 정상적으로 실행시켜 준다.
Trigger Templater on new file creation 예시를 만들어보면 _template/daily.md
... 생략
<%*
let parent_tfile = tp.config.active_file;
let title = parent_tfile.basename;
-%>
---
title : <% title %>

calendar 날짜 클릭 >> periodic Notes, templater 설정된 템플릿 생성
경로, 제목, 일반 텍스트 본문은
periodic Notes설정을 따르고, 본문에2023-09-20 ( Wed )은 template에 적용된 스크립트를templater가 실행시켜 보여줌
TODO - User Script Funtions 여기에 js 파일을 등록하면 함수를 사용할 수 있다고 하는데 필요할 때 해보고 추가로 작성하겠음!!🥱 졸려ㅕㅕㅕㅂ2templater 에서 사용하는 function 사용해보기!!.js 파일은 obsidian에서 안보임.. vscode로 편집해서 넣어야함
모든 파일 확장명 인식 활성해주면 보임!
_template/js/test.js
function my_function (msg) {
return `Message from my script: ${msg}`;
}
module.exports = my_function2;
// tp.user.[파일명](인자)
<% tp.user.test("Hello World!") %>
TEST (Failure) - 하나의 js파일에 function 여러개 넣을려고 했는데 안됨..파일 하나에 하나의 function만 export 할 수 있나봄.. 아래처럼 테스트 해봤는데 에러남

_template/js/test.js
function my_function (msg) {
return `Message from my script 1111: ${msg}`;
}
function my_function2 (msg) {
return `Message from my script 2222: ${msg}`;
}
module.exports = {my_function, my_function2};
_template/daily.md

참고해서 세팅했어요 감사합니다 🙆♂️