How to make snippetCompletion() work with markdown quote?

I’m using this code with snippetCompletion():

      activateOnTyping: true,
      override: [
        context => {
          const matchBefore = context.matchBefore(/`[\w]*/)
          if (matchBefore) {
            return {
              from: matchBefore.from,
              options: [
                snippetCompletion('```${lang}\n${}\n```', {label: '```'}),

The code works great, and it does add code block where I need it.

But when I add it in block quote:

> |

then the resulting content is this:

> ```lang

How to edit this code so that the markup is continued? Not just in block quote but in lists and other elements as well?

I would like the result to look like this:

> ```lang
> |
> ```

That’s not something the snippet functionality will do for you. You’d have to write your own apply logic.

Yes, that I got.

But question is - is there some ready function in @lezer/markdown or @codemirror/lang-markdown, something similar to insertNewlineContinueMarkup() that could do that?

The block quotes can be nested, so the apply() function should detect the lever of nesting , and possibly other elements like lists (in which there should be added indents to be continued), so I was wondering, is there such a feature already?

No. You could either try and derive this from the syntax tree, or just use a regexp on the start of the current line.