Important note: spell checking is a browser/native operation, and is not controled by silverbullet itself, therefor here is an also earlier post regarding spellcheck:
TL;DR
To disable globally for SB:
js.window.document.querySelector(".cm-content").setAttribute("spellcheck", "false")
Using the exact same DOM manipulation strategy by applying the standard HTML lang attribute to the CodeMirror editor container (.cm-content)
To set a language globally, the snippet is:
js.window.document.querySelector(".cm-content").setAttribute("lang", "de")
(Replace "de" with "en", "fr", "es", or whichever language code you require.)
Per-Page Dynamic Language Setting
To set the language automatically based on the page you are viewing, you can hook into SilverBullet's page load event in Space Lua. You can define a frontmatter attribute on your page (such as lang: de) and update the editor attribute dynamically whenever a page loads.
Add something like this to a Space Lua block:
event.listen {
name = "editor:pageLoaded",
run = function(e)
local pageLang = "en"
local meta = editor.getCurrentPageMeta()
if meta and meta.lang then
pageLang = meta.lang
end
local editorEl = js.window.document.querySelector(".cm-content")
if editorEl then
editorEl.setAttribute("lang", pageLang)
end
end
}
Now, on any page where you want a specific spellcheck language, simply add it to the page frontmatter at the top:
---
lang: de
---
If a page omits the lang attribute, it will gracefully fall back to "en".
(Do ensure your browser actually has the corresponding language dictionaries installed for native spellcheck to function properly.)
the code above was done using Silverbullet - DeepWiki and tested by me if the actual lang is set by the script in the DOM, but i couldnt also test the spelling check, because the behaviour is specific to each browser and installed language directories ![]()
... and no, i'm not an AI-bot ![]()