Render custom UI in block without macro renderer

Hi, my plugin-in can add some properties to a block. I would like to add a little graph underneath the block based on the values of these properties. Similar to how [[card]] blocks get a border around them.

However I prefer not using a {{renderer}} macro thing because the graph should always be rendered if the given properties exist, so it will be redundant and messy to have additional data in the block. Furthermore if a user accidentally removes the macro but keeps the properties it can be confusing…

Any help on how this can be achieved would be appreciated!
*

Welcome. Would need a MutationObserver to check for the property after every rendering of the block. However, if the property is normally added by the plugin itself, I would still prefer a macro, one with the name of the plugin, to explicitly state that this block has been processed.

Welcome.

Thanks!

Would need a MutationObserver to check for the property after every rendering of the block.

Could you refer me to some example code for this? Is it simply watching for any DOM changes, parse the page for blocks, and check through the html if it has my required properties?

to explicitly state that this block has been processed.

Wouldn’t that be shown explicitely by the UI I would draw? And besides this logseq provides afaik no way to hide plugin related properties, so anyway you would see the properties underneath the block, which is also quite explicit. What do you think?

Too many in this forum, e.g. Is it possible to hide a custom view if the query result is empty?

Depending on your requirements, there is a variety of possible configurations. Although it is possible to parse the block’s content or even its html, it is better to get the block’s id, then use Logseq’s API to read its properties from the database.

I don’t think that Logseq distinguishes properties by their origin. :block-hidden-properties should work for any custom property.

It gets a little philosophical. Could even consider providing multiple approaches and let the user choose one.