Skip to content

Commit e92357a

Browse files
committed
Escape Pyodide stdout and stderr text output
Fixes #69.
1 parent 10edd21 commit e92357a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

_extensions/live/resources/live-runtime.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

live-runtime/src/evaluate-pyodide.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,16 @@ export class PyodideEvaluator implements ExerciseEvaluator {
329329
if (result.stdout) {
330330
const outputDiv = document.createElement("div");
331331
outputDiv.className = "exercise-cell-output cell-output cell-output-pyodide cell-output-stdout";
332-
outputDiv.innerHTML = `<pre><code>${result.stdout}</code></pre>`;
332+
outputDiv.innerHTML = "<pre><code></code></pre>";
333+
outputDiv.querySelector('code').textContent = result.stdout;
333334
container.appendChild(outputDiv);
334335
}
335336

336337
if (result.stderr) {
337338
const errorDiv = document.createElement("div");
338339
errorDiv.className = "exercise-cell-output cell-output cell-output-pyodide cell-output-stderr";
339-
errorDiv.innerHTML = `<pre><code>${result.stderr}</code></pre>`;
340+
errorDiv.innerHTML = "<pre><code></code></pre>";
341+
errorDiv.querySelector('code').textContent = result.stderr;
340342
container.appendChild(errorDiv);
341343
}
342344

0 commit comments

Comments
 (0)