Skip to content

Commit

Permalink
Escape Pyodide stdout and stderr text output
Browse files Browse the repository at this point in the history
Fixes #69.
  • Loading branch information
georgestagg committed Dec 16, 2024
1 parent 10edd21 commit e92357a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _extensions/live/resources/live-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions live-runtime/src/evaluate-pyodide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,16 @@ export class PyodideEvaluator implements ExerciseEvaluator {
if (result.stdout) {
const outputDiv = document.createElement("div");
outputDiv.className = "exercise-cell-output cell-output cell-output-pyodide cell-output-stdout";
outputDiv.innerHTML = `<pre><code>${result.stdout}</code></pre>`;
outputDiv.innerHTML = "<pre><code></code></pre>";
outputDiv.querySelector('code').textContent = result.stdout;
container.appendChild(outputDiv);
}

if (result.stderr) {
const errorDiv = document.createElement("div");
errorDiv.className = "exercise-cell-output cell-output cell-output-pyodide cell-output-stderr";
errorDiv.innerHTML = `<pre><code>${result.stderr}</code></pre>`;
errorDiv.innerHTML = "<pre><code></code></pre>";
errorDiv.querySelector('code').textContent = result.stderr;
container.appendChild(errorDiv);
}

Expand Down

0 comments on commit e92357a

Please sign in to comment.