Feat/interactive python editor #1214
Open
+311
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added an interactive Python code editor component for tutorial pages, enabling users to edit and run Python code snippets directly in the browser. The editor features syntax highlighting, execution feedback, and a modern UI powered by Monaco Editor (VS Code's editor) and Pyodide for in-browser Python execution.
Fixes #1128
Type of Change
New feature (e.g., new page, component, or functionality)
Bug fix (non-breaking change that fixes an issue)
UI/UX improvement (design, layout, or styling updates)
Performance optimization (e.g., code splitting, caching)
Documentation update (README, contribution guidelines, etc.)
Other (please specify):
Changes Made
Created index.tsx with Monaco Editor integration and Pyodide for Python execution.
Added styles.css for modern styling with rounded corners, shadows, and dark output area.
Added interactive-python-editor.md as a demo page showcasing the component.
Replaced basic textarea + Prism with Monaco for better UX, including syntax highlighting, line numbers, and IntelliSense-like features.
Updated component to load Pyodide from CDN and capture stdout/stderr for output display.
Dependencies
Added @monaco-editor/react (latest version) for the Monaco Editor component.
No other new dependencies; Pyodide is loaded via CDN.
Checklist
My code follows the style guidelines of this project.
I have tested my changes across major browsers and devices
My changes do not generate new console warnings or errors .
I ran npm run build and attached screenshot(s) in this PR.
This is already assigned Issue to me, not an unassigned issue.
Screenshot