Variables
VS Code Stanard Variables
Template Variables
Dendron supports various template variables.
- For inserting the current date and time:
- CURRENT_YEAR: The current year
 - CURRENT_MONTH: The month as two digits (example '02')
 - CURRENT_DAY: The day of the month as two digits (example '08')
 - CURRENT_HOUR: The current hour in 24-hour clock format
 - CURRENT_MINUTE: The current minute as two digits
 - CURRENT_SECOND: The current second as two digits
 
 
VS Code default variables
The following variables can be used:
TM_SELECTED_TEXTThe currently selected text or the empty stringTM_CURRENT_LINEThe contents of the current lineTM_CURRENT_WORDThe contents of the word under cursor or the empty stringTM_LINE_INDEXThe zero-index based line numberTM_LINE_NUMBERThe one-index based line numberTM_FILENAMEThe filename of the current documentTM_FILENAME_BASEThe filename of the current document without its extensionsTM_DIRECTORYThe directory of the current documentTM_FILEPATHThe full file path of the current documentRELATIVE_FILEPATHThe relative (to the opened workspace or folder) file path of the current documentCLIPBOARDThe contents of your clipboardWORKSPACE_NAMEThe name of the opened workspace or folderWORKSPACE_FOLDERThe path of the opened workspace or folder
For inserting the current date and time:
CURRENT_YEARThe current yearCURRENT_YEAR_SHORTThe current year's last two digitsCURRENT_MONTHThe month as two digits (example '02')CURRENT_MONTH_NAMEThe full name of the month (example 'July')CURRENT_MONTH_NAME_SHORTThe short name of the month (example 'Jul')CURRENT_DATEThe day of the month as two digits (example '08')CURRENT_DAY_NAMEThe name of day (example 'Monday')CURRENT_DAY_NAME_SHORTThe short name of the day (example 'Mon')CURRENT_HOURThe current hour in 24-hour clock formatCURRENT_MINUTEThe current minute as two digitsCURRENT_SECONDThe current second as two digitsCURRENT_SECONDS_UNIXThe number of seconds since the Unix epoch
Example
Today is {{ CURRENT_YEAR }}.{{ CURRENT_MONTH }}.{{ CURRENT_DAY }},
output:
Today is 2022.01.04
Template Variable replacement
For replacing the standard variables inside the dendron template files
https://wiki.dendron.so/notes/GelEQPZrSgr3CK9y10Nrg/#template-variables
VSCode Snippet Tricks
- You can set a default value for a variable by using a colon (:).
 
Example:
- The DUE: property in the below snippet defaults to the current current month, date, hour but can be edited fairly quick
 
"TODO": {
   "prefix": "stodo",
   "body": [
    "- [ ] ${1:Enter Task}",
    "- **CAPTURED:**        ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}-08:00",
    "- **DUE:**             ${CURRENT_YEAR}-${2:${CURRENT_MONTH}}-${3:${CURRENT_DATE}}T${4:${CURRENT_HOUR}}:${5:${CURRENT_MINUTE}}:00-08:00",
    "- **PRIORITY:**        ${6|HIGH,MEDIUM,LOW|}",
    "- **STATUS:**          ${7|TODO,WAITING,IN PROGRESS,DONE|}",
    "- **NOTES:**           ",
    "    - $0",
    ],
    "description": "Capture new TODO"
}
- You can set dropdown values for a variable using a pipe (|).
 
Example:
"Context Switch": {
   "prefix": "scontext",
   "body": [
    "- **TYPE:**          ${1|COMMS,SUPPORT,RESEARCH,MEETING,DEVELOPMENT,TESTING,VALIDATION,CI/CD,PROJECT MGMT,CONSULTING,DOCUMENTATION,ADMINISTRATION,TRAINING,BREAK|}",
    "- **PROJECT:**       ${2|PROJ1,PROJ2|}",
    "- **TOOLS:**         ${3|N/A,PYTHON,AZURE,POWER APPS,POWER AUTOMATE,POWER BI,SHAREPOINT,DENDRON|}",
    "- **START:**         ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:{$CURRENT_MINUTE}:${CURRENT_SECOND}-08:00",
    "- **END:**           ",
    "- **DURATION:**      ",
    "- **NOTES:**         ",
    "    - $0",
    "---"
    ],
    "description": "Capture new context switch"
}
Backlinks