This is where you configure SilverBullet to your liking. See ^Library/Std/Config for a full list of configuration options.
config.set {
plugs = {
"github:silverbulletmd/silverbullet-katex/katex.plug.js"
}
}
command.update {
name = "Navigate: Back in History",
key = "Ctrl-,",
}
command.update {
name = "Navigate: Forward in History",
key = "Ctrl-."
}
-- Setting up latex
latex = {
header = [<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css">](<<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.22/dist/katex.min.css">>),
katex = js.import("https://cdn.jsdelivr.net/npm/katex@0.16.22/+esm")
}
function latex.inline(expression)
local html = latex.katex.renderToString(expression, {
trust = true,
throwOnError = false,
displayMode = false
})
return widget.new {
html = "<span>" .. latex.header .. html .. "</span>"
}
end
function latex.block(expression)
local html = latex.katex.renderToString(expression, {
trust = true,
throwOnError = false,
displayMode = true
})
return widget.new {
html = "<span>" .. latex.header .. html .. "</span>"
}
end
slashcommand.define {
name = "math",
run = function()
editor.insertAtCursor("${latex.inline[[]]}", false, true)
editor.moveCursor(editor.getCursor() - 3)
end
}
slashcommand.define {
name = "equation",
run = function()
editor.insertAtCursor("${latex.block[[]]}", false, true)
editor.moveCursor(editor.getCursor() - 3)
end
}
function widgets.linkedMentions(pageName)
return nil
end
function widgets.toc(options)
return
end