Files
plainleaf/docs/API/index.md
T

1.2 KiB

tags, references
tags references
api/syscall
plug-api/syscalls/index.ts
client/plugos/syscalls/index.ts
client/data/object_index.ts

The index API provides functions for interacting with SilverBullet's Object Index, including query collections used by Space Lua/Integrated Query, schema introspection, ad-hoc Markdown indexing, and direct object-index operations.

The main query API is index.objects; the other collection functions are mostly convenient filters over the same index.

${spacelua.renderApiDocumentation("index")}

Integrated Query examples

Query one page:

${queryfrom index.pages() limit 1}

Query three sub-pages below the API page:

${query}

Render three incomplete tasks:

${query}

Ad-hoc index a Markdown fragment and select its list items:

${query[[ from index.markdown("* Item 1\n* [ ] Task 1") where _.tag == "item" ]]}

index.extractFrontmatter can inspect and optionally transform frontmatter and top-level tags. For example, this returns the frontmatter of the current page:

${(index.extractFrontmatter(editor.getText())).frontmatter}