fix: resolve code block rendering issues in api_components.mdx
Fixes #5160
Root Cause
The code block rendering issues were caused by two problems:
- The
api_components.mdxfile was missing frompages/docs/tools/generator/ - Color inconsistency between code blocks is a Prism.js behavior β
importinside JSX (<Component />) highlights differently than plain JS. This is handled by the syntax highlighter theme inCodeBlock.tsx.
Changes
- Added
api_components.mdxtopages/docs/tools/generator/ - Used consistent
jslanguage tags on all code blocks to fix color inconsistency - Used proper 2-space indentation to fix uneven padding issue
- All code blocks now render correctly with consistent syntax highlighting
How to test
- Run
npm run dev - Open
http://localhost:3000/docs/tools/generator/api_components - Verify code blocks render with correct colors and no padding issues
Note
The slight color difference on import keyword inside JSX blocks is a known Prism.js behavior and may require a separate fix in CodeBlock.tsx if maintainers decide it needs addressing.
Summary by CodeRabbit
- Documentation
- Added a new "API Components" documentation page describing reusable AsyncAPI Generator components (CloseConnection, Connect, CoreMethods, DependencyProvider, OnClose, OnError, OnMessage, OnOpen, Usage).
- Includes overview, per-component explanations and practical JavaScript/JSX examples demonstrating installation, import, rendering, and common usage patterns.
Deploy Preview for asyncapi-website ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 7c81640371dd2d626fd0e85db8b5b18a26fee8a6 |
| Latest deploy log | https://app.netlify.com/projects/asyncapi-website/deploys/69c145a67e130c00080e12e6 |
| Deploy Preview | https://deploy-preview-5270--asyncapi-website.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 28517928-a296-4651-8c54-8a1ec59e8681
π₯ Commits
Reviewing files that changed from the base of the PR and between 8c4143252a3d5f3f554de8323f0b15777dda88e0 and 7c81640371dd2d626fd0e85db8b5b18a26fee8a6.
π Files selected for processing (1)
pages/docs/tools/generator/api_components.mdx
β Files skipped from review due to trivial changes (1)
- pages/docs/tools/generator/api_components.mdx
π Walkthrough
Walkthrough
A new MDX documentation page pages/docs/tools/generator/api_components.mdx was added, documenting reusable components from @asyncapi/generator-components with sections for CloseConnection, Connect, CoreMethods, DependencyProvider, Installation, OnClose, OnError, OnMessage, OnOpen, and Usage, each including descriptive text and JavaScript/JSX examples.
Changes
| Cohort / File(s) | Summary |
|---|---|
API Components Documentation pages/docs/tools/generator/api_components.mdx |
Added a new MDX page describing ten reusable generator components; includes overview, per-component descriptions, and JS/JSX import+render usage examples with representative props (language, methodName, methodParams, preExecutionCode, postExecutionCode, framework, role, additionalDependencies, title, clientName, clientFileName, etc.). |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~10 minutes
Poem
π° I nibble lines of docs anew,
Components sprout, a helpful crew,
Code blocks gleam and examples play,
Hop, build, and ship β hooray hooray! π₯
π₯ Pre-merge checks | β 5
β Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The PR title accurately describes the main change: fixing code block rendering issues in the api_components.mdx file, which is the primary objective of the changeset. |
| Linked Issues check | β Passed | The PR successfully addresses all coding requirements from issue #5160: added the missing api_components.mdx file, normalized code block language tags, applied consistent indentation, and resolved padding inconsistencies. |
| Out of Scope Changes check | β Passed | All changes in the PR are directly related to the linked issue #5160 objectives; only the api_components.mdx file was added with no unrelated modifications. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.
β‘οΈ Lighthouse report for the changes in this PR:
| Category | Score |
|---|---|
| π΄ Performance | 42 |
| π’ Accessibility | 98 |
| π’ Best practices | 92 |
| π’ SEO | 100 |
| π΄ PWA | 33 |
Lighthouse ran on https://deploy-preview-5270--asyncapi-website.netlify.app/
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 100.00%. Comparing base (7653853) to head (7c81640).
:warning: Report is 84 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #5270 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 796 830 +34
Branches 146 159 +13
=========================================
+ Hits 796 830 +34
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@animeshk923 Got it Iβll take another look at the rendering issue an update soon.
@animeshk923 @Sourya07 The CoreMethods JSX color inconsistency is a known Prism.js limitation β it highlights JSX differently inside a js code block. Changing the code example would affect documentation accuracy so I kept it correct. Can you guide me