string.pack, string.unpack and string.packsize (#1851)
The three binary-packing functions from Lua are now implemented in a dedicated `string_pack.ts` module and wired into `stringApi`. Format parsing follows the exact option set of Lua: * signed and unsigned integers of configurable width (`b`/`B`/`h`/`H`/`l`/`L`/`j`/`J`/`T`/`i`/`I`), * IEEE 754 single and double precision floats (`f`/`d`/`n`), * fixed-length strings (`c`), * length-prefixed strings (`s`), * zero-terminated strings (`z`), * padding bytes (`x`), * alignment padding (`X`), and * endianness/alignment modifiers (`<`/`>`/`=`/`!`). `string.packsize` rejects variable-length formats (`s` and `z`) as Lua requires. `string.unpack` returns all unpacked values followed by the next position integer, matching the Lua contract exactly. Test suite extended in separates `string_pack_test.lua` file. Passes both Lua and Space Lua execution. Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
SilverBullet
SilverBullet is a Programmable, Private, Browser-based, Open Source, Self Hosted, Personal Knowledge Management Platform.
Yowza! That surely is a lot of adjectives to describe a browser-based Markdown editor programmable with Lua.
Let’s get more specific.
In SilverBullet you keep your content as a collection of Markdown Pages (called a Space). You navigate your space using the Page Picker like a traditional notes app, or through Links like a wiki (except they are bi-directional).
If you are the writer type, you’ll appreciate SilverBullet as a clean Markdown editor with Live Preview. If you have more of an outliner personality, SilverBullet has Outlining tools for you. Productivity freak? Have a look at Tasks. More of a database person? You will appreciate Objects and Queries.
And if you are comfortable programming a little bit — now we’re really talking. You will love dynamically generating content with Space Lua (SilverBullet’s Lua dialect), or to use it to create custom Commands, Page Templates or Widgets.
Much more detail can be found on silverbullet.md
Installing SilverBullet
Check out the instructions.
Developing SilverBullet
SilverBullet's frontend is written in TypeScript and built on top of the excellent CodeMirror 6 editor component. Additional UI is built using Preact. ESBuild) running through Deno is used to build both the front-end.
The server backend is written in Go.
If you're considering contributing changes, be aware of the LLM use policy.
Code structure
client/: The SilverBullet client, implemented with TypeScriptserver/: The SilverBullet server, written in Goplugs: Set of built-in plugs that are distributed with SilverBulletlibraries: A set of libraries (space scripts, page templates, slash templates) distributed with SilverBulletplug-api/: Useful APIs for use in plugslib/: Useful libraries to be used in plugssyscalls/: TypeScript wrappers around syscallstypes/: Various (client) types that can be references from plugs
binplug_compile.tsthe plug compiler
scripts/: Useful scriptswebsite/: silverbullet.md website content
Requirements
It's convenient to also install air for development, this will automatically rebuild both the frontend and backend when changes are made:
go install github.com/air-verse/air@latest
Make sure your $GOPATH/bin is in your $PATH.
To build everything and run the server:
air <PATH-TO-YOUR-SPACE>
Alternatively, to build:
make
To run the resulting server:
./silverbullet <PATH-TO-YOUR-SPACE>
Useful development tasks
# Clean all generated files
make clean
# Typecheck and lint all code
make check
# Format all code
make fmt
# Run all tests
make test
Build a docker container
Note, you do not need Deno nor Go locally installed for this to work:
docker build -t silverbullet .
To run:
docker run -p 3000:3000 -v <PATH-TO-YOUR-SPACE>:/space silverbullet