Add code syntax highlighting - #20
Conversation
…ded HTML line breaks.
…ction Integrates Prism.js for syntax highlighting across supported languages. Adds necessary CSS and JavaScript files. Updates `DocRendererService` to ensure HTML placeholders are processed for advanced rendering features like tabs and callouts. Introduces a JavaScript observer to trigger automatic highlighting on dynamic content. Updates related Razor components for seamless integration.
|
Warning Review limit reached
More reviews will be available in 22 minutes and 59 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds Prism syntax highlighting to the documentation viewer. ChangesPrism Syntax Highlighting Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
Redot-Documentation/docs/About/introduction.md (1)
55-67: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider semantic paragraph breaks instead of presentational
<br/>.The three
<br/><br/>tags add vertical spacing via presentational HTML. If the design intent is extra spacing between paragraphs, consider achieving this through CSS margin utilities or custom styles on the.doc-viewer-contentcontainer rather than inline breaks. This preserves semantic document structure and avoids screen-reader verbosity from explicit line breaks.No change required if this is an intentional short-term compatibility measure.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Redot-Documentation/docs/About/introduction.md` around lines 55 - 67, The introduction content uses repeated <br/><br/> tags for spacing, which is presentational and hurts document semantics. Update the prose in introduction.md to use real paragraph breaks or rely on styling from the doc viewer instead of inline breaks, and keep the content structure within the Introduction section semantically grouped. Use the surrounding introduction text and the .doc-viewer-content styling approach as the guide when relocating the spacing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Redot-Documentation/Components/App.razor`:
- Around line 23-28: The Prism script list in App.razor only loads language
components for C, C++, C#, and GDScript, so shell fenced code blocks are not
highlighted. Add the missing Prism shell language asset alongside the existing
prism-* includes in the App.razor script section, keeping the change near the
current Prism imports so ```shell fences are recognized.
In `@Redot-Documentation/Services/DocRendererService.cs`:
- Around line 46-52: The placeholder replacement loop in
DocRendererService.RenderMarkdown can hang if a replacement reintroduces a
token, so bound resolution instead of looping until no keys remain. Update the
logic around renderedHtml and transformedMarkdown.HtmlPlaceholders to use
collision-resistant placeholder tokens and limit replacement passes to the
number of placeholders (or another fixed cap), ensuring the loop always
terminates even when content contains deterministic placeholder-like text.
- Around line 99-106: The warning callout handling in
DocRendererService.TransformMarkdown is applied after TransformTabsBlocks, which
can hide :::warning blocks inside tab content from the regex. Reorder the
transforms so the warning Regex.Replace runs before the tab placeholder pass,
then call TransformTabsBlocks only once afterward, keeping the existing
TransformCallout and IconConstants.TipsIcon usage intact.
In `@Redot-Documentation/wwwroot/js/syntax-highlight.js`:
- Around line 24-38: The `highlightCode` flow is re-triggering itself because
`Prism.highlightElement` mutates the same code nodes and the `MutationObserver`
on `document.body` keeps scheduling repeats. Update the logic around
`codeBlocks.forEach(...)` and `window.Prism.highlightElement(codeBlock)` to
prevent reprocessing, either by marking already highlighted blocks or
temporarily disconnecting/reconnecting the observer while highlighting. Use the
existing `highlightCode` and observer setup in `syntax-highlight.js` to keep the
same blocks from being highlighted more than once.
In `@Redot-Documentation/wwwroot/lib/prism/prism-tomorrow.min.css`:
- Line 1: The Prism theme stylesheet still uses the deprecated word-wrap
property in the base code/pre rule, which stylelint flags. Update the shared
syntax-highlighting selector block for code[class*=language-] and
pre[class*=language-] to use overflow-wrap instead of word-wrap so the minified
theme stays lint-clean while preserving wrapping behavior.
---
Nitpick comments:
In `@Redot-Documentation/docs/About/introduction.md`:
- Around line 55-67: The introduction content uses repeated <br/><br/> tags for
spacing, which is presentational and hurts document semantics. Update the prose
in introduction.md to use real paragraph breaks or rely on styling from the doc
viewer instead of inline breaks, and keep the content structure within the
Introduction section semantically grouped. Use the surrounding introduction text
and the .doc-viewer-content styling approach as the guide when relocating the
spacing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e3b1aaa3-f93d-40b3-91eb-e1f68fb62555
⛔ Files ignored due to path filters (6)
Redot-Documentation/wwwroot/lib/prism/prism-c.min.jsis excluded by!**/*.min.jsRedot-Documentation/wwwroot/lib/prism/prism-clike.min.jsis excluded by!**/*.min.jsRedot-Documentation/wwwroot/lib/prism/prism-core.min.jsis excluded by!**/*.min.jsRedot-Documentation/wwwroot/lib/prism/prism-cpp.min.jsis excluded by!**/*.min.jsRedot-Documentation/wwwroot/lib/prism/prism-csharp.min.jsis excluded by!**/*.min.jsRedot-Documentation/wwwroot/lib/prism/prism-gdscript.min.jsis excluded by!**/*.min.js
📒 Files selected for processing (8)
Redot-Documentation/Components/App.razorRedot-Documentation/Components/Pages/DocViewer.razorRedot-Documentation/Services/DocRendererService.csRedot-Documentation/docs/About/introduction.mdRedot-Documentation/docs/Community/channels.mdRedot-Documentation/wwwroot/app.cssRedot-Documentation/wwwroot/js/syntax-highlight.jsRedot-Documentation/wwwroot/lib/prism/prism-tomorrow.min.css
…lout blocks are processed
…g in DocRendererService Integrates Prism.js support for shell-session syntax in documentation. Updates `DocRendererService` for more robust placeholder replacement using unique GUIDs, enhancing reliability of HTML block rendering.
Added syntax highlighting and a few misc formatting things on various docs pages.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation