fix(rendering): fix invalid markdown HTML and syntax-highlighted stream output#9
Merged
abhay-ramesh merged 2 commits intomainfrom Mar 27, 2026
Merged
fix(rendering): fix invalid markdown HTML and syntax-highlighted stream output#9abhay-ramesh merged 2 commits intomainfrom
abhay-ramesh merged 2 commits intomainfrom
Conversation
…am output Two rendering bugs found by inspecting the live dev server HTML: 1. Markdown cells produced invalid HTML — the parser replaced `# Heading` with `<h1>Heading</h1>` but then wrapped everything in `<p>...</p>`, producing `<p><h1>...</h1></p>` which browsers must error-correct. Rewrote the markdown parser to split on blank lines and only wrap non-block-level content in `<p>` tags. 2. Stream output (stdout/stderr) was being passed through highlight.js auto-detection, causing plain text like "Libraries imported successfully!" to receive incorrect hljs-attribute/keyword spans. `OutputText` is now a simple `<pre><span>` with no syntax highlighting — stream output is terminal text, not source code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Jupyter embeds terminal colour codes (e.g. \x1b[0;31m) in traceback strings. The error renderer was joining traceback lines and dropping them into a <pre> as raw text, so these escape sequences showed up literally in the browser. Added a stripAnsi helper that removes all ANSI CSI colour sequences before rendering each traceback line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
How these were found
Built the package, started the docs dev server, and inspected the actual rendered HTML at
/docs/examples/notebook-demo.Bug 1 — Markdown cells produce invalid HTML
The markdown parser converted
# Headingto<h1>Heading</h1>then wrapped the entire cell output in<p>...</p>, producing:Block-level elements (
h1–h6,blockquote,pre) cannot be children of<p>. Browsers must silently error-correct this, which can break layout and styling.Fix: Rewrote the markdown parser to split on blank lines (
\n\n) and handle each block independently. Headings, blockquotes, and code blocks are emitted as standalone block elements. Only text content gets wrapped in<p>.Bug 2 — Stream output (stdout/stderr) gets syntax-highlighted
OutputTextcalledhighlightCode()with auto-detection on all text, including stream output. This applied highlight.js's language guesser to plain terminal text:Stream output (
stdout/stderr) andtext/plainexecute results are terminal text, not source code. Syntax highlighting should never be applied.Fix:
OutputTextnow renders plain<pre><span>with no highlight.js call.Verified in live HTML
Both fixes were confirmed by fetching and parsing the rendered HTML from
http://localhost:3000/docs/examples/notebook-demoafter rebuilding the package.🤖 Generated with Claude Code