This should do the trick. If there's nothing selected and the cursor position is preceded by two newlines, then tildes for a code block will be included instead of backticks for inline code. Nevertheless, I do recommend some further tests, because I encountered a really weird bug doing my own tests:
Everything seemed to work as intended, but at some point, when I selected text that definitely included newlines, pushing the button resulted in only the first line being wrapped in backticks, with the rest of the selected text being ignored.
I really can't explain this behavior and was not able to consistently reproduce it.
This should do the trick. If there's nothing selected and the cursor position is preceded by two newlines, then tildes for a code block will be included instead of backticks for inline code. Nevertheless, I do recommend some further tests, because I encountered a really weird bug doing my own tests:
Everything seemed to work as intended, but at some point, when I selected text that definitely included newlines, pushing the button resulted in only the first line being wrapped in backticks, with the rest of the selected text being ignored.
I really can't explain this behavior and was not able to consistently reproduce it.