Repository navigation
Add in-browser Python/Java compiler and "Try it yourself" book page - #1
Merged
Merged
Conversation
Compiler view (#compiler) and a practice page in every solution book: editor, custom stdin, Run/Stop and output, with no test cases or judging. Python runs in Pyodide inside a Web Worker (10 s limit, output cap); Java 17 runs via CheerpJ. Nothing is sent to a server. Catalog entries gain an optional problemUrl that links to the original statement.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requested by Kavya Katal · project thread
Problem or area changed
Visual Lab (
dist/): adds a code runner so readers can try a problem on the spot. You get an editor, a custom stdin box, Run/Stop and output. There are no test cases and no judging, by design.#compiler(linked from the top nav).problemUrladds a "Read the full statement on LeetCode ↗" link on the first page and on the practice page. Statements are linked, not copied. It's filled in for 4084 and 4085 frommetadata.yaml.The insight
The site is public and static (GitHub Pages / Vercel), so everything runs in the reader's browser. There's no execution server to host, pay for, or get abused, and code never leaves the device.
dist/python-worker.mjs), loaded from jsDelivr. The 10 s time limit and the 100k-character output cap work by terminating the worker. Tracebacks are trimmed to the reader's ownmain.pyframes.javaccompiles the reader's file plus a smallPgRunnerclass that pointsSystem.inat the input box and callsmain(). CheerpJ is free for personal and educational use.:and{, and Ctrl/⌘+Enter to run. Escape followed by Tab leaves the editor. No new dependencies and no build step.solution-book-1tocompiler-1.Verification
python3 scripts/validate_repo.py: all checks pass.python3 -m http.server --directory dist, with the Pyodide files served from the npm package because this sandbox can't reach jsDelivr:15.while True: passstops at 10 s, and the next run restarts Python and works.cjrtnc.leaningtech.com). I checked thePgRunnerwrapper and the Java template with a local JDK 21. Thejavac-in-CheerpJ approach follows Leaning Technologies' JavaFiddle. Please try Java once on the Vercel preview.Generated by Claude Code