Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell output should escape text #69

Open
kcarnold opened this issue Oct 3, 2024 · 0 comments
Open

Cell output should escape text #69

kcarnold opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kcarnold
Copy link

kcarnold commented Oct 3, 2024

I noticed that trying to print(type(10)) doesn't show anything.

This is probably because stdout isn't getting escaped:

outputDiv.innerHTML = `<pre><code>${result.stdout}</code></pre>`;

The solution could look like:

      const outputDiv = document.createElement("div");
      outputDiv.className = "exercise-cell-output cell-output cell-output-pyodide cell-output-stdout";
      outputDiv.innerHTML = `<pre><code></code></pre>`;
      outputDiv.querySelector('code').textContent = result.stdout;
      container.appendChild(outputDiv);

The same should apply to stderr.

@georgestagg georgestagg added the bug Something isn't working label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants