I use VSCode and Markdown files. You can select anything and run that in the terminal by executing the action 'Terminal: Run Selected text in active terminal'
I have also given it a shortcut: `Ctrl+e, e`. So I can just select something and execute it in the terminal. Works quite well.