Skip to content

feat: execute {{query}} blocks as live, auto-updating results #224

Description

@tstapler

Problem

Logseq-style {{query (todo todo)}} macro blocks are parsed into a MacroNode (InlineParser.kt) but never executed — MarkdownEngine.kt:278 renders every macro, including query, as literal monospace text ({{query ...}}) instead of running it and rendering results.

This is Logseq's own signature "live query" feature, and it's the spiritual equivalent of Trilium Notes' saved-search notes / Table / Kanban collections (see https://docs.triliumnotes.org/user-guide/concepts/navigation/search and https://docs.triliumnotes.org/user-guide/note-types/saved-search) — a block whose content is a standing query over the graph that stays current as pages change.

Why this matters

  • The parser already recognizes the syntax — only the execution/render step is missing, so this is a comparatively contained lift for a signature capability.
  • Every Logseq graph SteleKit opens may already contain {{query}} blocks (from the user's existing usage); today those silently render as dead text instead of their intended results.
  • Once a query executor exists, it becomes the substrate for Table/Kanban/Calendar-style collection views (see related issues) — those views are really just alternate renderers over the same underlying query result set.

Suggested scope (v1)

  • Support the common Logseq simple-query forms: (todo TODO), (page-property key value), (between ...), tag/page-ref based queries.
  • Render results as a live, read-only block list embedded in the page (auto-refresh when underlying data changes).
  • Out of scope for v1: advanced/datalog queries, saved-search-as-page-type, bulk actions on results (can be follow-ups).

References

  • kmp/src/commonMain/kotlin/dev/stapler/stelekit/parsing/InlineParser.ktMacroNode parsing
  • kmp/src/commonMain/kotlin/dev/stapler/stelekit/ui/components/MarkdownEngine.kt:278 — current literal-text rendering
  • kmp/src/commonTest/kotlin/dev/stapler/stelekit/parsing/OutlinerExtensionsSpec.kt:390 — existing parse-only test

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions