diff --git a/common/PAGE_TEMPLATES.ts b/common/PAGE_TEMPLATES.ts index 7386de4d..da8b990e 100644 --- a/common/PAGE_TEMPLATES.ts +++ b/common/PAGE_TEMPLATES.ts @@ -1,13 +1,13 @@ export const SETTINGS_TEMPLATE = `#meta -This page contains settings for configuring SilverBullet. A list of built-in settings [[!silverbullet.md/SETTINGS|can be found here]]. +This page contains settings for configuring SilverBullet. A list of settings and their documentation [[!silverbullet.md/SETTINGS|can be found here]]. -To update \`libraries\` specified here: {[Libraries: Update]} +To update the [[!silverbullet.md/Libraries|libraries]] specified below, run {[Libraries: Update]} \`\`\`yaml indexPage: index libraries: -- source: "[[!silverbullet.md/Library/Core/*]]" +- import: "[[!silverbullet.md/Library/Core/*]]" \`\`\` `; diff --git a/plugs/federation/library.ts b/plugs/federation/library.ts index 71927dbc..26cf7fb1 100644 --- a/plugs/federation/library.ts +++ b/plugs/federation/library.ts @@ -7,7 +7,11 @@ import { federatedPathToLocalPath, wildcardPathToRegex } from "./util.ts"; import { confirm } from "$sb/syscalls/editor.ts"; type LibraryDef = { - source: string; + /** + * @deprecated Use `import` instead + */ + source?: string; + import: string; exclude?: string[]; }; @@ -38,11 +42,15 @@ export async function updateLibraries(): Promise { const updateStats: UpdateStats = { libraries: 0, items: 0 }; const libraries = (await readSetting("libraries", [])) as LibraryDef[]; for (const lib of libraries) { - if (!lib.source) { + // Handle deprecated 'source' field + if (lib.source) { + lib.import = lib.source; + } + if (!lib.import) { console.warn("Library source not set, skipping", lib); continue; } - const pageUri = parsePageRef(lib.source).page; + const pageUri = parsePageRef(lib.import).page; if (!pageUri.startsWith("!")) { console.warn( diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index 43383464..80e12588 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -8,6 +8,7 @@ _These features are not yet properly released, you need to use [the edge builds] * [[Page Decorations]] are here (initial implementation by [Deepak Narayan](https://github.com/silverbulletmd/silverbullet/pull/940), later refined by Zef) * New type of [[Shortcuts|shortcut]]: `slashCommand` +* Naming is hard. Renamed the `source` attribute of [[Libraries]] to `import`. egacy references to `source` will keep working. * **Fix:** very large spaces would let the server blow up when saving snapshots. This is now fixed. * **Fix:** Conflict copies could no longer be edited, whoops (initial fix by [Semyon Novikov](https://github.com/silverbulletmd/silverbullet/pull/939), later refined by Zef) diff --git a/website/Libraries.md b/website/Libraries.md index 168d4122..946dd166 100644 --- a/website/Libraries.md +++ b/website/Libraries.md @@ -14,14 +14,14 @@ When you set up a fresh space, the [[Library/Core]] is automatically configured: ```yaml libraries: -- source: "[[!silverbullet.md/Library/Core/*]]" +- import: "[[!silverbullet.md/Library/Core/*]]" ``` If you would like to _exclude_ specific pages, for instance [[Library/Core/Widget/Table of Contents]], you can do so using the library’s `exclude` attribute ```yaml libraries: -- source: "[[!silverbullet.md/Library/Core/*]]" +- import: "[[!silverbullet.md/Library/Core/*]]" exclude: - "[[!silverbullet.md/Library/Core/Widget/Table of Contents]]" ``` diff --git a/website/Library/Core.md b/website/Library/Core.md index 7efe32b7..b77bee45 100644 --- a/website/Library/Core.md +++ b/website/Library/Core.md @@ -11,7 +11,7 @@ Some examples: In your [[SETTINGS]] list the following under `libraries:` ```yaml libraries: -- source: "[[!silverbullet.md/Library/Core/*]]" +- import: "[[!silverbullet.md/Library/Core/*]]" ``` Then run the {[Libraries: Update]} command to install it. diff --git a/website/Library/Journal.md b/website/Library/Journal.md index def8601d..11d7c27f 100644 --- a/website/Library/Journal.md +++ b/website/Library/Journal.md @@ -4,7 +4,7 @@ This [[Libraries|library]] contains some useful page templates for journalers. W In your [[SETTINGS]] list the following under `libraries:` ```yaml libraries: -- source: "[[!silverbullet.md/Library/Journal/*]]" +- import: "[[!silverbullet.md/Library/Journal/*]]" ``` Then run the {[Libraries: Update]} command to install it. diff --git a/website/SETTINGS.md b/website/SETTINGS.md index 9b51e92b..ddb3822c 100644 --- a/website/SETTINGS.md +++ b/website/SETTINGS.md @@ -1,5 +1,5 @@ #meta -/ind + This page contains settings for configuring SilverBullet and its Plugs. Changing any of these will go into effect immediately in most cases except `indexPage` which requires a page reload. ```yaml @@ -7,7 +7,7 @@ This page contains settings for configuring SilverBullet and its Plugs. Changing indexPage: "[[SilverBullet]]" libraries: # The "Core" library is recommended for all users -- source: "[[!silverbullet.md/Library/Core/*]]" +- import: "[[!silverbullet.md/Library/Core/*]]" # You can exclude items from the import using exclude (also supports wildcards): # exclude: # - [[!silverbullet.md/Table of Contents]]