Skip to content

Conversation

theletterf
Copy link
Contributor

@theletterf theletterf commented Oct 10, 2025

Fixes #2007

Claude's diagnosis:

When you use console syntax highlighting, the text fragments like don't render because:

  1. Console blocks use a different rendering path: In Code.cshtml (lines 12-21), console blocks render through ApiSegments using RenderLineWithCallouts() instead of the standard RenderCodeBlockLines() method.
  2. No HTML escaping in console rendering: The RenderLineWithCallouts() method in CodeViewModel.cs (lines 33-62) directly appends the content to the HTML string without escaping HTML entities (line 53):
    _ = html.Append(line); // No HTML escaping!
  3. Standard code blocks ARE escaped: When using any other language, the rendering goes through EnhancedCodeBlockHtmlRenderer.RenderCodeBlockLines() which calls renderer.WriteEscape(slice) (line 61), properly
    escaping HTML entities like < and >.

So when you write in a console block, the browser interprets it as an HTML tag (which doesn't exist), so it doesn't render. In other languages, it gets escaped to <password> and displays
correctly.

Which makes sense if Console blocks were created differently or before we had callouts


Authored using Claude 4.5 in Claude CLI 2.0 with some human intervention

@theletterf theletterf requested review from a team as code owners October 10, 2025 09:25
@theletterf theletterf requested a review from reakaleek October 10, 2025 09:25
@theletterf theletterf self-assigned this Oct 10, 2025
@theletterf theletterf added the bug label Oct 10, 2025
Copy link

🔍 Preview links for changed docs

@theletterf
Copy link
Contributor Author

@theletterf theletterf merged commit d5f086c into main Oct 10, 2025
23 checks passed
@theletterf theletterf deleted the fix-escape-console-rendering branch October 10, 2025 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

variables in angle brackets are not rendered

2 participants