This extension allows you to execute code blocks in any programming language directly from Markdown files in VS Code.
- Execute Code Blocks: CodeLens Buttons appear above each code block (```) for running or copying the code. Temporary files are created for execution and are cleaned up afterward.
- Execute Code Snippets: Run code snippets (enclosed in `) with Ctrl + Click. Results are displayed in the terminal.
- Save Execution Results: Execute code directly within Markdown files, with the output captured in the document.
- Broad Language Support: Supports a wide range of languages, including C, Rust, C++, Java, TypeScript, PHP, Perl, R, Dart, Groovy, Go, Haskell, Julia, Lua, Ruby, JavaScript, Python, Bash. Add non-compiled languages via settings.
Before running a code block:
- Verify "Compiler Configuration" settings are correct.
- Ensure your code is correct.
- Install necessary languages and dependencies.
- Add compilers to the PATH environment variable if necessary to enable global access to installed languages.
On Arch Linux, install all supported languages with:
sudo pacman --needed -S php perl r dart groovy go rustup ghc julia lua ruby nodejs npm python bash
For other systems, research language installation or use the Windows Subsystem for Linux.
Download or copy DEMO.md and the demo_helpers
folder into VS Code after installing this extension, and test all the features out!
- Configure language compilers by specifying Item:
Code Block Tag
and associated Value:[Language Name, File Extension, Compiler Command/Path]
. Only non-compiled languages can be added.
// Example
Item: python, Value: ["Python", "py", "python"]
- Reset settings using the ↻ icons or remove the
markdownRunner.compilerConfiguration
entry from VSCode'ssettings.json
to restore to default if any issues occur.
Enable this to add the Markdown file's parent directory to Python's sys.path
, allowing you to import modules from that directory.
Planned features (no guarantee):
- Support for multiple
Run on Markdown
output streams.
Your feedback and contributions are welcome in shaping the future of this extension!