Repository navigation
feat(preview): improve reader code block rendering - #30
Merged
Merged
Conversation
- Parse <pre> children so nested <code> markup and entities no longer leak into extracted code text. - Keep language hints from language-*/lang-* classes, GitHub highlight-source wrappers, and Markdown fence info strings. - Render code blocks with a language label, copy button, and horizontal scrolling for long lines. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
🔎 Cloudflare preview: https://36315d02-feedreader.phatpham9.workers.dev Uploaded from |
Co-Authored-By: Claude Code <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.
Summary
Reader-preview code blocks now keep their language hint and render as a proper code block instead of a wrapped
<pre>that leaks nested markup.node-html-parsertreats<pre>as raw text; parsing its children fixes nested<code>markup and<entities leaking into preview text.tsx title="app.tsx"→tsx).Evidence
<pre><code class="language-ts">const x = 1;</code></pre>extracted as the literal text<code class="language-ts">const x = 1;</code>, with no label or copy action.After: extracted as
const x = 1;withlanguage: "ts". Local preview ofcloudflare/security-audit-skillrenderedSHELLlabels, right-aligned Copy buttons, andCopiedfeedback.npm test— 30 files, 238 tests passed.npm run typecheck— clean. New assertions cover HTML classes, GitHubhighlight-source-*wrappers, Markdown fence info, and fence options.Merge Danger
Door: two-way — reverting restores the previous renderer.
Blast Radius: preview rendering
Previews cached before deploy keep the old literal-tag text for up to 30 minutes; labels and the new layout appear as those entries refresh. The code-block payload gains an optional
languagefield, which older clients ignore.🤖 Generated with Claude Code