Is it possible to use the API to make a simple plugin that, for example, replaces :hw: in every block with Hello World! at render time (i.e., keeping the original file with the :hw:), without using any slash command? Just installing the plugin and every instance of :hw: visible is rendered as that other string. Of course, the rest of the text should keep standard markdown render.
I tried to use onBlockRendererSlotted, but I don’t understand the docs and I haven’t found any examples on rendering the Markdown. I then tried using provideUI inside, but it receives HTML. Can I use Markdown instead?
Is there any way I can accomplish that? Basically, given a certain block I want to:
In the markdown content, replace all instances of :hw: with <span style="color: pink">Hello World!</span> (said and done)
Block Example
Original: A block with **Bold** and *italics* and :hw:
Modified string: A block with **Bold** and *italics* and <span style="color: pink">Hello World!</span>
Render this new markdown string
Block Example
Original: A block with **Bold** and *italics* and :hw:
Modified string: A block with **Bold** and *italics* and <span style="color: pink">Hello World!</span>
Rendered string: A block with <b>Bold</b> and <i>italics</i> and <span style="color: pink">Hello World!</span>
The other is a feature request, this is a question that might be solved with that feature, or might be solved with another workflow
Isn’t MutationObserver a bit hacky as it doesn’t use the logseq API? What should I observe? Every span.inline? The whole body? When should I start the observer?
These are questions whose answers could change every version, and that require some reverse engineering.
By the way, when I install the plugin from GitHub release, it raises an error: DOMException: Blocked a frame with origin "lsp://logseq.io" from accessing a cross-origin frame
It seems I have to modify the manifest in the marketplace and then its done!