From 142e503512ac14bd4f8426c48571aead4e56e7bf Mon Sep 17 00:00:00 2001 From: notes Date: Mon, 30 Sep 2024 10:15:00 +0000 Subject: [PATCH] Snapshot --- Library/Core/New Page/Movie.md | 16 ------- Library/Core/New Page/Page Template.md | 12 ++++++ Library/Core/New Page/Quick Note.md | 2 +- Library/Core/New Page/Recipe.md | 24 ----------- Library/Core/New Page/Snippet Template.md | 11 +++++ Library/Core/Page/Maintenance.md | 51 ++++++++++++----------- Library/Core/Page/Meta Index.md | 7 ++++ Library/Core/Page/Space Overview.md | 39 +++++++++++++++++ Library/Core/Page/Template Index.md | 23 ++++++---- Library/Core/Query/Full Page.md | 5 +++ Library/Core/Query/Template.md | 5 ++- Library/Core/Quick Notes.md | 7 +++- Library/Core/Snippet/each-directive.md | 10 +++++ Library/Core/Snippet/h1.md | 2 +- Library/Core/Snippet/h2.md | 2 +- Library/Core/Snippet/h3.md | 2 +- Library/Core/Snippet/h4.md | 2 +- Library/Core/Snippet/if-directive.md | 10 +++++ Library/Core/Snippet/if-else-directive.md | 12 ++++++ Library/Core/Snippet/include-page.md | 8 ++++ Library/Core/Snippet/item.md | 10 +++++ Library/Core/Snippet/let-directive.md | 10 +++++ Library/Core/Snippet/task.md | 4 +- Library/Core/Snippet/template.md | 4 +- Library/Core/Widget/Linked Mentions.md | 23 ++++------ Library/Core/Widget/Linked Tasks.md | 15 +++++-- Library/Core/Widget/Table of Contents.md | 2 +- Library/Core/Widget/Tagged Tasks.md | 4 +- SETTINGS.md | 4 ++ 29 files changed, 219 insertions(+), 107 deletions(-) delete mode 100644 Library/Core/New Page/Movie.md create mode 100644 Library/Core/New Page/Page Template.md delete mode 100644 Library/Core/New Page/Recipe.md create mode 100644 Library/Core/New Page/Snippet Template.md create mode 100644 Library/Core/Page/Meta Index.md create mode 100644 Library/Core/Page/Space Overview.md create mode 100644 Library/Core/Query/Full Page.md create mode 100644 Library/Core/Snippet/each-directive.md create mode 100644 Library/Core/Snippet/if-directive.md create mode 100644 Library/Core/Snippet/if-else-directive.md create mode 100644 Library/Core/Snippet/include-page.md create mode 100644 Library/Core/Snippet/item.md create mode 100644 Library/Core/Snippet/let-directive.md diff --git a/Library/Core/New Page/Movie.md b/Library/Core/New Page/Movie.md deleted file mode 100644 index c54be65..0000000 --- a/Library/Core/New Page/Movie.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -description: "Create a movie" -tags: template -hooks.newPage: - suggestedName: "Media/Movies/" - confirmName: true - command: "Create Movie" ---- - ---- -date: -author: -rating: 0 ---- - -# Name \ No newline at end of file diff --git a/Library/Core/New Page/Page Template.md b/Library/Core/New Page/Page Template.md new file mode 100644 index 0000000..6e19acd --- /dev/null +++ b/Library/Core/New Page/Page Template.md @@ -0,0 +1,12 @@ +--- +description: Create a New Page template +tags: template +hooks.newPage: + suggestedName: "Library/Personal/New Page/" + confirmName: true +frontmatter: | + tags: template + displayName: "|^|" + hooks.newPage: + suggestedName: "" +--- diff --git a/Library/Core/New Page/Quick Note.md b/Library/Core/New Page/Quick Note.md index 06617c1..16a85d6 100644 --- a/Library/Core/New Page/Quick Note.md +++ b/Library/Core/New Page/Quick Note.md @@ -2,7 +2,7 @@ description: "Create a quick note" tags: template hooks.newPage: - suggestedName: "Inbox/{{today}} {{time}}" + suggestedName: "Inbox/{{today}}/{{safeTime}}" confirmName: false command: "Quick Note" key: "Alt-Shift-n" diff --git a/Library/Core/New Page/Recipe.md b/Library/Core/New Page/Recipe.md deleted file mode 100644 index dcb6825..0000000 --- a/Library/Core/New Page/Recipe.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -description: "Create a recipe" -tags: template -hooks.newPage: - suggestedName: "Recipes/" - confirmName: true - command: "Create Recipe" ---- ---- -link: -rating: -time: -image: ---- - -# Name - ---- - -- Ingredients - ---- - -1. Steps diff --git a/Library/Core/New Page/Snippet Template.md b/Library/Core/New Page/Snippet Template.md new file mode 100644 index 0000000..e3899b4 --- /dev/null +++ b/Library/Core/New Page/Snippet Template.md @@ -0,0 +1,11 @@ +--- +tags: template +description: Create a new Snippet template +hooks.newPage: + suggestedName: Library/Personal/Snippet/ + confirmName: true +frontmatter: | + tags: template + hooks.snippet: + slashCommand: "|^|" +--- diff --git a/Library/Core/Page/Maintenance.md b/Library/Core/Page/Maintenance.md index cde943d..0e4f5b4 100644 --- a/Library/Core/Page/Maintenance.md +++ b/Library/Core/Page/Maintenance.md @@ -1,36 +1,37 @@ +#meta + 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. +# Aspiring pages +This shows all page links that link to a page that does not (yet) exist. These could be broken links or just pages _aspiring_ to be created. ```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}} +{{#let @brokenLinks = {aspiring-page}}} +{{#if @brokenLinks}} +{{#each @brokenLinks}} +* [[{{ref}}]]: broken link to [[{{name}}]] +{{/each}} +{{else}} +No aspiring pages, all good! +{{/if}} +{{/let}} ``` # 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}} +{{#let @conflictPages = { + page where name =~ /\.conflicted\.\d+$/ + select name as conflictedName, + replace(name, /\.conflicted\.\d+$/, "") as cleanName +}}} +{{#if @conflictPages}} +{{#each @conflictPages}} +* [[{{cleanName}}]]: confict copy [[{{conflictedName}}]] +{{/each}} +{{else}} +No conflicting pages! +{{/if}} +{{/let}} ``` diff --git a/Library/Core/Page/Meta Index.md b/Library/Core/Page/Meta Index.md new file mode 100644 index 0000000..d9264dc --- /dev/null +++ b/Library/Core/Page/Meta Index.md @@ -0,0 +1,7 @@ +#meta + +This page lists all `#meta` tagged pages currently available in your space. You can also navigate to them via the {[Navigate: Meta Picker]}. + +```query +page where tags = "meta" render [[Library/Core/Query/Page]] +``` \ No newline at end of file diff --git a/Library/Core/Page/Space Overview.md b/Library/Core/Page/Space Overview.md new file mode 100644 index 0000000..f250881 --- /dev/null +++ b/Library/Core/Page/Space Overview.md @@ -0,0 +1,39 @@ +#meta + +This page compiles some useful things about your space and may also be useful for debugging things. + +# Stats +```template +**Total pages:** {{count({page select name})}} +**Total attachments:** {{count({attachment select name})}} +**Total tags:** {{count({tag select name})}} +``` + +# Active [[!silverbullet.md/Space Script]] +```template +{{#each {space-script}}} +* [[{{ref}}]] +{{/each}} +``` + +# Active [[!silverbullet.md/Space Style]] +```template +{{#each {space-style}}} +* [[{{ref}}]] +{{/each}} +``` + +# Active [[!silverbullet.md/Space Config]] +You have space config defined on the following pages: +```template +{{#each {space-config select replace(ref, /@.+/, "") as page}}} +* [[{{page}}]] +{{/each}} +``` + +Composed, this leads to the following active configuration: +```template +~~~yaml +{{yaml(@config)}} +~~~ +``` diff --git a/Library/Core/Page/Template Index.md b/Library/Core/Page/Template Index.md index 4758c02..d269fa2 100644 --- a/Library/Core/Page/Template Index.md +++ b/Library/Core/Page/Template Index.md @@ -1,23 +1,28 @@ -This page lists all templates currently available in your space. +#meta + +This page lists all templates currently available in your space. You can also navigate to them via the {[Navigate: Meta Picker]}. More information on templates can be found [[!silverbullet.md/Templates]] # New Page -$newPage -These [[!silverbullet.md/Page Templates]] are available through the {[Page: From Template]} command. +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]] +```template +{{#each { + template + where hooks.snippet + order by hooks.snippet.slashCommand +}}} +* [[{{ref}}|/{{hooks.snippet.slashCommand}}]] {{description}} +{{/each}} ``` # 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 @@ -37,11 +42,11 @@ render [[Library/Core/Query/Template]] ``` ## Inline -Use these as `page` in [[!silverbullet.md/Live Templates]] to render useful things in your pages: +Use with [[!silverbullet.md/Live Templates#Include]] to render useful things in your pages: ```query template -where name =~ /\/Widget\// and hooks.top = null and hooks.bottom = null +where name =~ /\/Widget\// and not hooks.top and not hooks.bottom order by order render [[Library/Core/Query/Template]] ``` diff --git a/Library/Core/Query/Full Page.md b/Library/Core/Query/Full Page.md new file mode 100644 index 0000000..0357f1c --- /dev/null +++ b/Library/Core/Query/Full Page.md @@ -0,0 +1,5 @@ +--- +tags: template +description: A page reference link as a list item showing the full page path +--- +* [[{{name}}|{{name}}]] \ No newline at end of file diff --git a/Library/Core/Query/Template.md b/Library/Core/Query/Template.md index 0bf123a..51dee54 100644 --- a/Library/Core/Query/Template.md +++ b/Library/Core/Query/Template.md @@ -1,4 +1,7 @@ -#template +--- +tags: template +--- + * [[{{ref}}]] {{description}} {{#if usage}} * **Usage:** {{usage}} diff --git a/Library/Core/Quick Notes.md b/Library/Core/Quick Notes.md index f5f061e..55bb148 100644 --- a/Library/Core/Quick Notes.md +++ b/Library/Core/Quick Notes.md @@ -1,5 +1,8 @@ This is your {[Quick Note]} inbox. - + ```query -page where name =~ /^Inbox\// render [[Library/Core/Query/Page]] +page + where name =~ /^Inbox\// + render [[Library/Core/Query/Full Page]] + order by lastModified desc ``` diff --git a/Library/Core/Snippet/each-directive.md b/Library/Core/Snippet/each-directive.md new file mode 100644 index 0000000..a10fb5e --- /dev/null +++ b/Library/Core/Snippet/each-directive.md @@ -0,0 +1,10 @@ +--- +description: (Template) Insert an `#each` directive +tags: template +hooks.snippet: + slashCommand: "#each" + order: 10 +--- +{{escapeDirective("#each |^|")}} + +{{escapeDirective("/each")}} \ No newline at end of file diff --git a/Library/Core/Snippet/h1.md b/Library/Core/Snippet/h1.md index 0b4a3d0..55fc849 100644 --- a/Library/Core/Snippet/h1.md +++ b/Library/Core/Snippet/h1.md @@ -3,6 +3,6 @@ tags: template description: Make this a level 1 heading hooks.snippet: slashCommand: h1 - match: "^#*\\s*" + matchRegex: "^#*\\s*" --- # \ No newline at end of file diff --git a/Library/Core/Snippet/h2.md b/Library/Core/Snippet/h2.md index b8c31ae..e2b5a4e 100644 --- a/Library/Core/Snippet/h2.md +++ b/Library/Core/Snippet/h2.md @@ -3,6 +3,6 @@ tags: template description: Make this a level 2 heading hooks.snippet: slashCommand: h2 - match: "^#*\\s*" + matchRegex: "^#*\\s*" --- ## \ No newline at end of file diff --git a/Library/Core/Snippet/h3.md b/Library/Core/Snippet/h3.md index b918906..5c23af5 100644 --- a/Library/Core/Snippet/h3.md +++ b/Library/Core/Snippet/h3.md @@ -3,6 +3,6 @@ tags: template description: Make this a level 3 heading hooks.snippet: slashCommand: h3 - match: "^#*\\s*" + matchRegex: "^#*\\s*" --- ### \ No newline at end of file diff --git a/Library/Core/Snippet/h4.md b/Library/Core/Snippet/h4.md index c0761eb..f9a47fc 100644 --- a/Library/Core/Snippet/h4.md +++ b/Library/Core/Snippet/h4.md @@ -3,6 +3,6 @@ tags: template description: Make this a level 4 heading hooks.snippet: slashCommand: h4 - match: "^#*\\s*" + matchRegex: "^#*\\s*" --- #### \ No newline at end of file diff --git a/Library/Core/Snippet/if-directive.md b/Library/Core/Snippet/if-directive.md new file mode 100644 index 0000000..003990a --- /dev/null +++ b/Library/Core/Snippet/if-directive.md @@ -0,0 +1,10 @@ +--- +description: (Template) Insert an `#if` directive +tags: template +hooks.snippet: + slashCommand: "#if" + order: 10 +--- +{{escapeDirective("#if |^|")}} + +{{escapeDirective("/if")}} \ No newline at end of file diff --git a/Library/Core/Snippet/if-else-directive.md b/Library/Core/Snippet/if-else-directive.md new file mode 100644 index 0000000..638a231 --- /dev/null +++ b/Library/Core/Snippet/if-else-directive.md @@ -0,0 +1,12 @@ +--- +description: (Template) Insert `#if` directive with 'else' +tags: template +hooks.snippet: + slashCommand: "#if-else" + order: 10 +--- +{{escapeDirective("#if |^|")}} + +{{escapeDirective("else")}} + +{{escapeDirective("/if")}} \ No newline at end of file diff --git a/Library/Core/Snippet/include-page.md b/Library/Core/Snippet/include-page.md new file mode 100644 index 0000000..1d6d259 --- /dev/null +++ b/Library/Core/Snippet/include-page.md @@ -0,0 +1,8 @@ +--- +tags: template +description: Add a live preview of a page +hooks.snippet.slashCommand: include-page +--- +```include +raw: "[[|^|]]" +``` diff --git a/Library/Core/Snippet/item.md b/Library/Core/Snippet/item.md new file mode 100644 index 0000000..553b042 --- /dev/null +++ b/Library/Core/Snippet/item.md @@ -0,0 +1,10 @@ +--- +tags: template +description: Make this a bullet item +hooks.snippet: + slashCommand: item + matchRegex: "^(\\s*)[\\-\\*]?\\s*" + command: "Text: Turn into a bullet item" + key: "Ctrl-q i" +--- +$1* \ No newline at end of file diff --git a/Library/Core/Snippet/let-directive.md b/Library/Core/Snippet/let-directive.md new file mode 100644 index 0000000..d0c0d80 --- /dev/null +++ b/Library/Core/Snippet/let-directive.md @@ -0,0 +1,10 @@ +--- +description: (Template) Insert a `#let` directive +tags: template +hooks.snippet: + slashCommand: "#let" + order: 10 +--- +{{escapeDirective("#let @|^| = ")}} + +{{escapeDirective("/let")}} \ No newline at end of file diff --git a/Library/Core/Snippet/task.md b/Library/Core/Snippet/task.md index 07b902b..108e4b4 100644 --- a/Library/Core/Snippet/task.md +++ b/Library/Core/Snippet/task.md @@ -1,10 +1,10 @@ --- tags: template -description: Turn the current line into a task +description: Make this a task hooks.snippet: slashCommand: task matchRegex: "^(\\s*)[\\-\\*]?\\s*(\\[[ xX]\\])?\\s*" - command: "Turn into task" + command: "Text: Turn into task" key: "Ctrl-q t" --- $1* [ ] \ No newline at end of file diff --git a/Library/Core/Snippet/template.md b/Library/Core/Snippet/template.md index 24efd95..90ba62b 100644 --- a/Library/Core/Snippet/template.md +++ b/Library/Core/Snippet/template.md @@ -1,8 +1,8 @@ --- -description: Insert an inline template +description: Insert a template tags: template hooks.snippet.slashCommand: "template" --- ```template -page: "[[|^|]]" +|^| ``` diff --git a/Library/Core/Widget/Linked Mentions.md b/Library/Core/Widget/Linked Mentions.md index 6104e18..8bb4e84 100644 --- a/Library/Core/Widget/Linked Mentions.md +++ b/Library/Core/Widget/Linked Mentions.md @@ -1,18 +1,13 @@ --- description: Adds Linked Mentions to pages tags: template -hooks.bottom.where: 'false' +hooks.bottom.where: 'true' --- -```template -# We need to escape handlebars directives here, since we're embedding -# this template into a template (INCEPTION) -template: | - {{escape "#if ."}} - # Linked Mentions - {{escape "#each ."}} - * [[{{escape "ref"}}]]: `{{escape "snippet"}}` - {{escape "/each"}} - {{escape "/if"}} -query: | - link where toPage = "{{@page.name}}" and page != "{{@page.name}}" -``` +{{#let @linkedMentions = {link where toPage = @page.name and page != @page.name order by page}}} +{{#if @linkedMentions}} +# Linked Mentions +{{#each @linkedMentions}} +* [[{{ref}}]]: “{{snippet}}” +{{/each}} +{{/if}} +{{/let}} diff --git a/Library/Core/Widget/Linked Tasks.md b/Library/Core/Widget/Linked Tasks.md index 57412e2..ac4af38 100644 --- a/Library/Core/Widget/Linked Tasks.md +++ b/Library/Core/Widget/Linked Tasks.md @@ -2,8 +2,15 @@ tags: template description: | Shows all tasks that contain a link the current page. For instance a task that references `[[John]]` in its name, would appear on the `John` page. +hooks.top: + where: 'true' + order: 1 --- - -```query -task where name =~ /\[\[{{escapeRegexp @page.name}}\]\]/ where done = false render [[Library/Core/Query/Task]] -``` \ No newline at end of file +{{#let @linkedTasks = {task where not done and contains(name, "[[" + @page.name + "]]")}}} +{{#if @linkedTasks}} +# Linked Tasks +{{#each @linkedTasks}} +{{template([[Library/Core/Query/Task]], .)}} +{{/each}} +{{/if}} +{{/let}} diff --git a/Library/Core/Widget/Table of Contents.md b/Library/Core/Widget/Table of Contents.md index 942067d..22ff719 100644 --- a/Library/Core/Widget/Table of Contents.md +++ b/Library/Core/Widget/Table of Contents.md @@ -2,7 +2,7 @@ description: Adds a Table of Contents to pages tags: template hooks.top: - where: 'false' + where: 'not pageDecoration.disableTOC' # Show all the way at the top order: 0 --- diff --git a/Library/Core/Widget/Tagged Tasks.md b/Library/Core/Widget/Tagged Tasks.md index f9d4bd1..f696607 100644 --- a/Library/Core/Widget/Tagged Tasks.md +++ b/Library/Core/Widget/Tagged Tasks.md @@ -5,5 +5,5 @@ usage: Pass in the tag to filter on as the `value` of this template --- ```query -task where tags = "{{.}}" and done = false render [[Library/Core/Query/Task]] -``` +task where tags = "{{.}}" and not done render [[Library/Core/Query/Task]] +``` \ No newline at end of file diff --git a/SETTINGS.md b/SETTINGS.md index 9529997..50d51a3 100644 --- a/SETTINGS.md +++ b/SETTINGS.md @@ -1,5 +1,9 @@ ```yaml indexPage: index +hideSyncButton: true +libraries: +# The "Core" library is recommended for all users +- import: "[[!silverbullet.md/Library/Core/*]]" git: autoCommitMinutes: 5 autoSync: true # or false