1
0
silverbullet/plugs/template/template.plug.yaml

137 lines
3.0 KiB
YAML
Raw Normal View History

2023-08-28 15:12:15 +00:00
name: template
functions:
# API
renderTemplate:
path: api.ts:renderTemplate
cleanTemplate:
path: api.ts:cleanTemplate
2023-12-21 17:37:50 +00:00
# Used by various slash commands
insertTemplateText:
path: template.ts:insertTemplateText
indexTemplate:
path: ./index.ts:indexTemplate
events:
2023-12-21 17:37:50 +00:00
# Special event only triggered for template pages
- page:indexTemplate
2023-11-06 08:14:16 +00:00
2023-12-21 17:37:50 +00:00
# Completion
2023-11-06 08:14:16 +00:00
templateSlashCommand:
2023-12-21 17:37:50 +00:00
path: ./complete.ts:templateSlashComplete
2023-11-06 08:14:16 +00:00
events:
- slash:complete
insertSlashTemplate:
2023-12-21 17:37:50 +00:00
path: ./complete.ts:insertSlashTemplate
handlebarHelperComplete:
path: ./complete.ts:templateVariableComplete
events:
- editor:complete
2023-11-06 08:14:16 +00:00
2023-08-28 15:12:15 +00:00
applyLineReplace:
path: ./template.ts:applyLineReplace
insertFrontMatter:
redirect: insertTemplateText
slashCommand:
2023-11-27 15:43:12 +00:00
name: frontmatter
description: Insert page frontmatter
2023-08-28 15:12:15 +00:00
value: |
---
|^|
---
makeH1:
redirect: applyLineReplace
slashCommand:
name: h1
description: Turn line into h1 header
match: "^#*\\s*"
replace: "# "
makeH2:
redirect: applyLineReplace
slashCommand:
name: h2
description: Turn line into h2 header
match: "^#*\\s*"
replace: "## "
makeH3:
redirect: applyLineReplace
slashCommand:
name: h3
description: Turn line into h3 header
match: "^#*\\s*"
replace: "### "
makeH4:
redirect: applyLineReplace
slashCommand:
name: h4
description: Turn line into h4 header
match: "^#*\\s*"
replace: "#### "
insertCodeBlock:
redirect: insertTemplateText
slashCommand:
name: code
2023-10-04 15:14:24 +00:00
description: Insert fenced code block
2023-08-28 15:12:15 +00:00
value: |
2023-10-04 15:14:24 +00:00
```|^|
2023-08-28 15:12:15 +00:00
```
insertHRTemplate:
redirect: insertTemplateText
slashCommand:
name: hr
description: Insert a horizontal rule
value: "---"
2023-12-21 17:37:50 +00:00
2023-08-28 15:12:15 +00:00
insertTable:
redirect: insertTemplateText
slashCommand:
name: table
description: Insert a table
boost: -1 # Low boost because it's likely not very commonly used
value: |
| Header A | Header B |
|----------|----------|
| Cell A|^| | Cell B |
2023-12-21 17:37:50 +00:00
2023-08-28 15:12:15 +00:00
quickNoteCommand:
path: ./template.ts:quickNoteCommand
command:
name: "Quick Note"
key: "Alt-Shift-n"
2023-12-21 17:37:50 +00:00
2023-08-28 15:12:15 +00:00
dailyNoteCommand:
path: ./template.ts:dailyNoteCommand
command:
name: "Open Daily Note"
key: "Alt-Shift-d"
2023-12-21 17:37:50 +00:00
2023-08-28 15:12:15 +00:00
weeklyNoteCommand:
path: ./template.ts:weeklyNoteCommand
command:
name: "Open Weekly Note"
key: "Alt-Shift-w"
2023-12-21 17:37:50 +00:00
newPageCommand:
path: ./template.ts:newPageCommand
2023-08-28 15:12:15 +00:00
command:
2023-12-21 17:37:50 +00:00
name: "Page: From Template"
key: "Alt-Shift-t"
2023-08-28 15:12:15 +00:00
insertTodayCommand:
path: "./template.ts:insertTemplateText"
slashCommand:
name: today
description: Insert today's date
value: "{{today}}"
2023-12-21 17:37:50 +00:00
2023-08-28 15:12:15 +00:00
insertTomorrowCommand:
path: "./template.ts:insertTemplateText"
slashCommand:
name: tomorrow
description: Insert tomorrow's date
value: "{{tomorrow}}"