Configure @codemirror/closeBrakcets?

I’ve seen there’s CloseBracketConfig in @codemirror/closeBrackets extension.

I was wondering, is there a way to configure it currently?

I’d like to add character `, and remove { from completing. Currently, I guess there’s no way of doing it?

This is done through language data, as the docs mention. Add something like{closeBrackets: {brackets: ...}}) to your editor configuration.

1 Like

Thanks for the answer!

@marijn And is there a way to customize it further?

Ideally, can I pass in some predicate, when I want the extension to work and when not? I would like to run it with markdown extension, and I would love to enable it only in CodeBlock or FencedCode types.

If it was a normal command, I would just do this

return ({state, dispatch}) => {
  if (/condition/) {
    insertBracket({state, dispatch});

No, there isn’t.

@marijn Cause I find it really wierd, when I have a link in my content "hi [title](href)", and I select first 6 characters (so hi [ti), and I press `, then it does "`hi [ti`tle](href)". I would like to disable that.

Should I make a fork of @codemirror/closebrackets? Or is there a simpler way of doing that?