Yes, my plan for this is to use Lua metatables. This already kind of works, just not for the page decoration use case . It’s undocumented, but sharing here so you can try.
This is my test page:
```space-lua
local mt = {
__index = function(self, attr)
if attr == "pageDecoration" then
return {
prefix = "🎄 "
}
end
end
}
index.defineTag {
name = "tree",
metatable = mt
}
```
#tree
Sup
${query[[from index.tag "tree" select {name=name, pageDecoration=_.pageDecoration}]]}
You’ll see that in the query result the pageDecoration
attribute is dynamically injected. However, since all the uses of pageDecorations in the UI happen across plug boundaries, this ability of using metatables gets lost. I have to figure out how to work around that.
By the way, I also intend to add a schema
attribute to that defineTag
call with an (optional) JSON schema, which can then be used to bring back the v1 schema feature, which can validate frontmatter, be used for attribute completion etc.