Lua API docs

I’m experimenting with AI based tooling (have been using Cursor AI recently), and have now generated a whole bunch of API docs for Lua APIs based on the source code and tests, which should be valuable for people playing with Space Lua:

https://silverbullet.md/API

I’ve checked some of it and fixed some things, but there may be issues there. I’d be happy to take PRs with fixes to the docs, everything lives here: silverbullet/website/API at main · silverbulletmd/silverbullet · GitHub

5 Likes

I think this kind of up to date doc for lua and other api entries should be a very important part of the silverbullet. I wonder if it is better directly generated from the docstring instead of relying on repeated human effort to update them?

Yes I’d agree, but what makes this slightly tricky is that there are three sources of Lua APIs now that all would rely on a different way documenting:

  1. Syscalls (defined in typescript in a very specific way): silverbullet/common/syscalls/system.ts at main · silverbulletmd/silverbullet · GitHub
  2. Lua specific builtins (defined in typescript in yet another way): silverbullet/common/space_lua/stdlib/math.ts at main · silverbulletmd/silverbullet · GitHub
  3. APIs implemented in space lua directly and included e.g. via Library/Std: silverbullet/Library/Std/Template.md at main · silverbulletmd/silverbullet · GitHub

Ah, that could be tricky to deal with. Maybe we need to rely on some specifically designed ci for gathering from these sources? I’ll try to have a look at it once I have time (currently the only available time is used to upgrade to v2).

As a proof for such need: I just found an undocumented editor method getCurrentLine() that can help me acquire many required line informations. Luckily I can find it from the completion but still would be nice if we ensure the doc is properly there.

Yes absolutely. Docs or it doesn’t exist should be the motto.