- Start of a migration guide

- Included a warning at the top of the SilverBullet documentation indicating that it is for version 2, which is still in progress.
- Provided a link to version 1 for users preferring a stable version and included a note about active development on v2.
This commit is contained in:
Zef Hemel
2025-03-30 21:21:33 +02:00
parent ed35a9d390
commit db62692d5a
3 changed files with 83 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
Can be configured anywhere, but preferred in [[CONFIG]].
## config.set(key, value)
Set a config value
## config.get(key)
Get a config value
## config.define(key, jsonSchema)
Defines a JSON schema for a config key
+70
View File
@@ -0,0 +1,70 @@
Some pointers on how to migrate from v1 to v2:
# Queries
v2 does not have support for old-style [queries](https://v1.silverbullet.md/Query%20Language) (live queries) anymore. They have been replaced with [[Space Lua/Lua Integrated Query]]. Give the linked page a read, but generally there’s a few differences:
1. Lua Integrated Queries tend to start with `from index.tag "tag-name"` instead of plain `tag-name`. This is a bit longer, but since whatever comes after `from` is a Lua expression, you can not just query [[Objects]], you can query any Lua table as well in the same way.
2. In the old query language, you access attribute simply by their name, this works in LIQ too, but stylistically it’s nicer to use either `_.attribute`, or to give the object you’re iterating over a name, using `from page = index.tag "page"`, for instance.
3. The `=` equals operator is `==` in Lua 😄
# Templates
In v1 there were various types of templates:
* [Live Templates](https://v1.silverbullet.md/Live%20Templates) (in `template` blocks)
* [Live Template Widgets](https://v1.silverbullet.md/Live%20Template%20Widgets) (using special [[Frontmatter]]-based hooks)
* [Snippets](https://v1.silverbullet.md/Snippets) (using special [[Frontmatter]]-based hooks)
* [Page Templates](https://v1.silverbullet.md/Page%20Templates) (using special [[Frontmatter]]-based hooks)
_Live templates_ are now better expressed by simply putting `${lua expressions}` in text. Iterating and rendering queries using templates is generally done using the `${template.each(query[[...]], someTemplateExpression)}` pattern.
_Live Template Widgets_ can now be implemented using an event listener:
```lua
event.listen {
name = "hooks:renderTopWidgets", -- or hooks:renderBottomWidgets
run = function(e)
return widget.new {
markdown = "Showing up at the top"
}
end
}
```
See [[^Library/Std/Widgets]] for some examples.
_Snippets_ can be implemented using the `slashcommand.define` API:
```space-lua
slashcommand.define {
name = "my-snippet",
run = function()
editor.insertAtCursor("Hello world!")
end
}
```
See [[^Library/Std/Slash]] for more examples.
_Page templates_ still need to be figured out, you can [chime in here](https://community.silverbullet.md/t/page-templates-in-v2/2037).
# Plugs
Many existing plugs _should_ keep working, but some may need updating.
However, since Space Config is removed. You now specify the plugs you like to use with Space Lua + the [[API/config]] API:
```lua
config.set("plugs", {
"github:joekrill/silverbullet-treeview/treeview.plug.js"
})
```
After which you run the `Plugs: Update` to download and/or update them. `Plugs: Add` has not been (re)implemented, so you have to do this in code.
# Removed features
Certain features have been removed:
* Online mode: v2 is sync mode only, meaning all your content will be synced into your browser. A simpler Online mode may be added back later. If you like to wipe your local content at any time, use the `System: Wipe Client` command.
* [Federation](https://v1.silverbullet.md/Federation)
* [Share](https://v1.silverbullet.md/Plugs/Share) replaced by [[^Library/Std/Export]]
* [Libraries](https://v1.silverbullet.md/Libraries): will likely be replaced by [[^Library/Std/Import]].
* Space Script: replaced by [[Space Lua]]
* Space Config: replaced by the [[API/config]] APIs.
* Command link syntax (`{[...]})`) replaced by the `${widgets.commandButton(...)}` API.
+3
View File
@@ -1,3 +1,6 @@
> **warning** Warning
> You are looking at the documentation of SilverBullet **v2**, which is still a work in progress. If you like less _edgy_ stuff, you can have a look at [v1](https://v1.silverbullet.md/) instead. All active development happens here, on v2, though. Migrating? Check out the [[Migrate from v1]] docs.
# Introduction
SilverBullet is an open source **personal productivity platform** built on [[Markdown]], turbo charged with the scripting power of [[Space Lua|Lua]]. You [[Install|self host]] it on your server, access it via any modern browser on any device (desktop, laptop, mobile). Since SilverBullet is built as a [[Local First]] [[PWA]], it is fully offline capable. Temporarily don’t have network access? No problem, SilverBullet will sync your content when you get back online.