- Added slash commands for inserting today's, yesterday's, and tomorrow's dates. - Introduced new admonition commands for notes and warnings. - Implemented a table command for quick table insertion. - Enhanced the `insertAtCursor` function to support a cursor placeholder option. - Updated `getSelection` to return the selected text along with cursor positions. - Added a new widget function to display linked tasks in the editor.
44 lines
962 B
Markdown
44 lines
962 B
Markdown
#meta
|
|
|
|
A work-in-progress library of generally useful templates for rendering queries.
|
|
|
|
```space-lua
|
|
-- Renders a page object as a linked list item
|
|
templates.pageItem = template.new([==[
|
|
* [[${name}]]
|
|
]==])
|
|
|
|
-- Renders a page object as a linked list item with full path
|
|
templates.fullPageItem = template.new([==[
|
|
* [[${name}|${name}]]
|
|
]==])
|
|
|
|
-- Renders a task object as a togglable task
|
|
templates.taskItem = template.new([==[
|
|
* [${state}] [[${ref}]] ${name}
|
|
]==])
|
|
|
|
-- Renders an item object
|
|
templates.itemItem = template.new([==[
|
|
* ${name}
|
|
]==])
|
|
|
|
```
|
|
|
|
|
|
# Examples
|
|
`template.pageItem`:
|
|
${template.each(query[[from index.tag "page" limit 3]], templates.pageItem)}
|
|
|
|
`template.taskItem`:
|
|
* [ ] Task 1
|
|
* [ ] Task 2
|
|
|
|
${template.each(query[[from index.tag "task" where page == _CTX.currentPage.name]], templates.taskItem)}
|
|
|
|
`template.itemItem`:
|
|
* Item 1
|
|
* Item 2
|
|
|
|
${template.each(query[[from index.tag "item" where page == _CTX.currentPage.name]], templates.itemItem)}
|