Let’s say I have a function to get the cursor position
public getCursorPosition = () => {
const {state} = this.view;
const {from, to, empty} = state.selection;
if (empty) {
return from;
}
return to;
}
I would like to receive the number of md tokens per position. That is, if the text is italic, then I will receive 2 md tokens. (* and *) I need help because I have no idea how to do this. You can, of course, blindly follow the value and sort of parse it, but what if there is a better way?