Templates 2.0 (#636)
Templates 2.0 and a whole bunch of other refactoring
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
We would like to keep our space clean, these are some tools that help you do that.
|
||||
|
||||
# Broken links
|
||||
This shows all internal links that are broken.
|
||||
|
||||
```template
|
||||
query: |
|
||||
link where toPage and pageExists(toPage) = false
|
||||
template: |
|
||||
{{#if .}}
|
||||
{{#each .}}
|
||||
* [[{{ref}}]]: broken link to [[{{toPage}}]]
|
||||
{{/each}}
|
||||
{{else}}
|
||||
No broken links, all good!
|
||||
{{/if}}
|
||||
```
|
||||
|
||||
# Conflict copies
|
||||
These are pages that have conflicted copies (as a result of sync), have a look at them as well as their original (non-conflicted versions) and decide which one to keep.
|
||||
|
||||
```template
|
||||
query: |
|
||||
page where name =~ /\.conflicted\.\d+$/
|
||||
select
|
||||
name as conflictedName,
|
||||
replace(name, /\.conflicted\.\d+$/, "") as cleanName
|
||||
template: |
|
||||
{{#if .}}
|
||||
{{#each .}}
|
||||
* [[{{cleanName}}]]: confict copy [[{{conflictedName}}]]
|
||||
{{/each}}
|
||||
{{else}}
|
||||
No conflicting pages!
|
||||
{{/if}}
|
||||
```
|
||||
@@ -0,0 +1,47 @@
|
||||
This page lists all templates currently available in your space.
|
||||
|
||||
# New Page
|
||||
$newPage
|
||||
These [[!silverbullet.md/Page Templates]] are available through the {[Page: From Template]} command.
|
||||
|
||||
```query
|
||||
template where hooks.newPage render [[Library/Core/Query/Template]]
|
||||
```
|
||||
|
||||
# Snippets
|
||||
$snippets
|
||||
These can be used as [[!silverbullet.md/Snippets]] via [[!silverbullet.md/Slash Commands]]:
|
||||
|
||||
```query
|
||||
template where hooks.snippet render [[Library/Core/Query/Template]]
|
||||
```
|
||||
|
||||
# Widgets
|
||||
$widgets
|
||||
Widgets can either be automatically attached to the top or bottom of pages (matching certain criteria) or used inline via [[!silverbullet.md/Live Templates]].
|
||||
|
||||
## Top
|
||||
```query
|
||||
template
|
||||
where hooks.top
|
||||
order by order
|
||||
render [[Library/Core/Query/Template]]
|
||||
```
|
||||
|
||||
## Bottom
|
||||
```query
|
||||
template
|
||||
where hooks.bottom
|
||||
order by order
|
||||
render [[Library/Core/Query/Template]]
|
||||
```
|
||||
|
||||
## Inline
|
||||
Use these as `page` in [[!silverbullet.md/Live Templates]] to render useful things in your pages:
|
||||
|
||||
```query
|
||||
template
|
||||
where name =~ /\/Widget\// and hooks.top = null and hooks.bottom = null
|
||||
order by order
|
||||
render [[Library/Core/Query/Template]]
|
||||
```
|
||||
Reference in New Issue
Block a user