How to replace blockquote with custom HTML

I’m trying to write an editor extension for Obsidian that should produce something similar to its callouts, but I can’t get further than a very simple line decoration based on another plugin (Fountain Editor).

The goal is to parse a Markdown blockquote where the first line follows a specific syntax. For example:

> @Character Name
> Dialogue
> 
> (Parenthetical)

If the extension detects the start of a blockquote with the @ character, it should replace the entire blockquote with what I’m guessing should be a widget. This should be an HTML container that renders the character name (from the first line) on the left, and the body of the blockquote on the right (in such a way that it’s still parsed as normal body text, just like with a callout). Just like with callouts, clicking the widget should restore its “source” to edit it again.

Parentheticals should preferably also be decorated so they can be styled differently, whether inline or on their own.

I’ve done a lot of searching around and diving into the documentation, but I can’t seem to figure out how to read the whole block (until the next empty line) and then replace that entire block. And much of what I try clashes with whatever Obsidian/HyperMD is doing rather than override it. I am working with StateFields, and I’ve tried using syntaxTree or reading the document line by line (and looking ahead), but without knowing the expected pattern, I might be “breaking” CM so to speak.