Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better code highlight with Prism #428

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Mar 18, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced code presentation in the documentation with syntax highlighting using prism-react-renderer.
    • Added a new story in the "Getting Started" section, demonstrating the usage of UI components with highlighted code blocks.
  • Documentation

    • Updated the Getting Started documentation to include syntax-highlighted code blocks for installation, configuration, and usage sections.
  • Dependencies

    • Updated @ladle/react to version 4.0.3.
    • Added prism-react-renderer version 2.3.1 to improve documentation readability.

Copy link

coderabbitai bot commented Mar 18, 2024

Walkthrough

The recent update enhances the documentation package by improving code presentation. It bumps the version of @ladle/react in devDependencies, adds prism-react-renderer for syntax highlighting, and refactors existing code blocks across various guides to utilize this new dependency. This results in a more visually appealing and readable documentation, particularly in the "Getting Started" section, where code snippets are now highlighted, and UI component usage is demonstrated more effectively.

Changes

File Path Change Summary
.../documentation/package.json - Bumped @ladle/react from 4.0.2 to 4.0.3
- Added prism-react-renderer 2.3.1
.../2-Installation.stories.tsx - Added Highlight component for code syntax highlighting
.../3-configuration.stories.tsx
.../4-usage.stories.tsx
- Added Highlight and themes import
- Replaced <pre><code> with <div><Highlight> for better code presentation
- Demonstrated UI component usage with code highlighting

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between 421b11d and f4565f8.
Files selected for processing (5)
  • packages/documentation/package.json (2 hunks)
  • packages/documentation/src/GettingStarted/2-Installation.stories.tsx (3 hunks)
  • packages/documentation/src/GettingStarted/3-configuration.stories.tsx (2 hunks)
  • packages/documentation/src/GettingStarted/4-usage.stories.tsx (1 hunks)
  • pnpm-lock.yaml (41 hunks)
Files not summarized due to errors (1)
  • pnpm-lock.yaml: Error: Message exceeds token limit
Additional comments: 34
packages/documentation/package.json (2)
  • 20-20: The version bump for @ladle/react to 4.0.3 is noted. Ensure to verify any changes or migration steps required for this minor version update.
  • 30-30: The addition of prism-react-renderer version 2.3.1 is appropriate for enabling syntax highlighting. This dependency is correctly placed in the dependencies section.
packages/documentation/src/GettingStarted/4-usage.stories.tsx (3)
  • 1-5: The import statements are correctly organized and include all necessary components for the story, including the Highlight component for syntax highlighting.
  • 11-32: The codeBlock constant is well-defined and provides a clear example of using UI components within JSX. This is a good practice for documentation to include practical examples.
  • 34-88: The Usage story component effectively demonstrates the use of the Highlight component for syntax highlighting. The implementation is clean and follows best practices for using prism-react-renderer. This enhances the documentation by providing a practical example of UI component usage with highlighted code blocks.
packages/documentation/src/GettingStarted/3-configuration.stories.tsx (3)
  • 5-5: The import of the Highlight component and themes from prism-react-renderer is correctly done and necessary for implementing syntax highlighting in the documentation.
  • 11-19: The codeBlock constant is well-defined and provides a clear example of configuring TailwindCSS with the UI components. This is beneficial for users looking to understand how to integrate the library with TailwindCSS.
  • 58-72: The Configuration story component effectively uses the Highlight component for syntax highlighting. The implementation is clean and follows best practices for using prism-react-renderer, enhancing the documentation with a practical example of configuration.
packages/documentation/src/GettingStarted/2-Installation.stories.tsx (4)
  • 12-12: The import of the Highlight component and themes from prism-react-renderer is correctly done and necessary for implementing syntax highlighting in the documentation.
  • 47-48: The installBlock constant is well-defined and provides clear npm install commands for the UI components and styles. This is beneficial for users looking to understand how to install the necessary packages.
  • 90-102: The Installation story component effectively uses the Highlight component for syntax highlighting. The implementation is clean and follows best practices for using prism-react-renderer, enhancing the documentation with a practical example of installation.
  • 107-123: Additionally, the inclusion of React and React-DOM installation commands using the Highlight component further enriches the documentation by providing essential setup information in a visually appealing manner.
pnpm-lock.yaml (22)
  • 154-156: The addition of prism-react-renderer version 2.3.1 aligns with the PR's objective to enhance code highlighting using Prism. Ensure that this version is compatible with the current project setup and other dependencies.
  • 168-169: The update to @ladle/react version 4.0.3 is noted. Verify that this version bump does not introduce breaking changes or incompatibilities with existing code or dependencies.
  • 357-370: The updates to @babel/* dependencies are likely part of the dependency tree affected by the main updates. Ensure these updates do not introduce any breaking changes or compatibility issues with the project's Babel configuration.
  • 384-386: Updates to @babel/types and the addition of @jridgewell/trace-mapping are part of the dependency tree updates. Confirm that these updates are compatible with the project's current setup.
  • 396-396: The addition of browserslist version 4.23.0 suggests an update in the project's browser compatibility configuration. Ensure this version aligns with the project's target browsers.
  • 410-411: Updates to @babel/template and @babel/types are part of the dependency tree updates. Confirm that these updates are compatible with the project's current setup.
  • 428-434: The update to @babel/helper-module-transforms and its dependencies is part of the dependency tree updates. Ensure these updates do not introduce any breaking changes or compatibility issues with the project's Babel configuration.
  • 451-458: Updates to @babel/types in various dependencies are part of the dependency tree updates. Confirm that these updates are compatible with the project's current setup.
  • 476-482: Updates to @babel/helpers and its dependencies are part of the dependency tree updates. Ensure these updates do not introduce any breaking changes or compatibility issues with the project's Babel configuration.
  • 504-510: The update to @babel/parser version 7.24.0 is part of the dependency tree updates. Confirm that this update is compatible with the project's current Babel setup and does not introduce any breaking changes.
  • 512-528: Updates to @babel/plugin-transform-react-jsx-self and @babel/plugin-transform-react-jsx-source are part of the dependency tree updates. Ensure these updates are compatible with the project's React and Babel configurations.
  • 539-545: The update to @babel/template and its dependencies is part of the dependency tree updates. Confirm that these updates are compatible with the project's current setup.
  • 536-552: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [548-559]

Updates to @babel/traverse and its dependencies are part of the dependency tree updates. Ensure these updates do not introduce any breaking changes or compatibility issues with the project's Babel configuration.

  • 575-582: The update to @babel/types version 7.24.0 and its dependencies is part of the dependency tree updates. Confirm that this update is compatible with the project's current Babel setup and does not introduce any breaking changes.
  • 946-946: The update to @types/node version 20.11.28 is part of the dependency tree updates. Ensure this version is compatible with the project's Node.js version and does not introduce type definition conflicts.
  • 1056-1093: The update to @ladle/react version 4.0.3 and its dependencies is part of the main updates related to the PR objectives. Ensure that this version bump and the addition of prism-react-renderer are compatible with the project's setup and do not introduce breaking changes.
  • 1103-1104: The addition of vite version 5.1.6 suggests an update or addition in the project's build tooling. Confirm that this version is compatible with the project's current setup and does not introduce any breaking changes.
  • 2194-2195: Updates to @types/babel__core and its dependencies are part of the dependency tree updates. Ensure these updates do not introduce any breaking changes or compatibility issues with the project's Babel configuration.
  • 2204-2217: Updates to @types/babel__generator, @types/babel__template, and @types/babel__traverse are part of the dependency tree updates. Confirm that these updates are compatible with the project's current setup.
  • 2409-2409: The update to @types/mute-stream version 0.0.4 is part of the dependency tree updates. Ensure this version is compatible with the project's setup and does not introduce type definition conflicts.
  • 2818-2829: The update to @vitejs/plugin-react version 4.2.1 and its dependencies is part of the dependency tree updates. Confirm that this version is compatible with the project's current Vite and React setup and does not introduce any breaking changes.
  • 3547-3548: The addition of axe-core version 4.8.4 suggests an update or addition in the project's accessibility tooling. Confirm that this version is compatible with the project's current setup and does not introduce any breaking changes.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between f4565f8 and dd752e1.
Files selected for processing (1)
  • packages/documentation/src/GettingStarted/4-usage.stories.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/documentation/src/GettingStarted/4-usage.stories.tsx

Copy link

Bundle Size (components)

Status File Size (Gzip) Limits
style.css 6.63 KB (+5 B +0.07%) 8 KB
index.js 8.04 KB (+4 B +0.05%) 20 KB
vendor.js 65.07 KB 67 KB

Overall bundle size: 79.73 KB (+9 B +0.01%)
Overall status: ✅

Bundle Size (form components)

Status File Size (Gzip) Limits
index.js 4.73 KB (+5 B +0.10%) 20 KB
vendor.js 44.49 KB 67 KB

Overall bundle size: 49.22 KB (+5 B +0.01%)
Overall status: ✅

Bundle Size (system)

Status File Size (Gzip) Limits
style.css 6.96 KB (+269 B +3.92%) 8 KB
index.js 1.74 KB 3 KB
vendor.js 44.49 KB 46 KB

Overall bundle size: 53.19 KB (+269 B +0.50%)
Overall status: ✅

@aversini aversini merged commit b6a8fd9 into main Mar 18, 2024
5 checks passed
@aversini aversini deleted the docs-better-code-highlight-with-Prism branch March 18, 2024 14:07
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yaml

Commits Files that changed from the base of the PR and between dd752e1 and ac32a4a.
Files selected for processing (3)
  • packages/documentation/package.json (2 hunks)
  • packages/documentation/src/GettingStarted/2-Installation.stories.tsx (3 hunks)
  • pnpm-lock.yaml (41 hunks)
Files not summarized due to errors (1)
  • pnpm-lock.yaml: Error: Message exceeds token limit
Files skipped from review as they are similar to previous changes (2)
  • packages/documentation/package.json
  • packages/documentation/src/GettingStarted/2-Installation.stories.tsx
Additional comments: 8
pnpm-lock.yaml (8)
  • 154-159: The addition of prism-react-renderer and prismjs is aligned with the PR's objective to enhance code highlighting capabilities. These dependencies are crucial for integrating Prism into the project.
  • 171-172: The update to @ladle/react is noted. Ensure to verify that this version bump does not introduce breaking changes or require updates to existing code beyond what's covered in this PR.
  • 360-373: Updates to babel-related dependencies are noted. It's important to verify these updates for any breaking changes or required configuration adjustments to maintain compatibility with the project's current babel configuration.
  • 949-949: The update to @types/node is noted. Ensure to verify the compatibility of this updated version with the project's Node.js version and TypeScript code.
  • 1059-1096: The detailed update to @ladle/react and its dependencies is noted. As previously mentioned, ensure to verify compatibility and check for breaking changes, especially since this update includes a wide range of dependencies.
  • 2412-2412: The update to @types/mute-stream is noted. Ensure to verify the compatibility of this updated version with the project's usage of mute-stream and TypeScript code.
  • 2412-2412: The addition of @types/prismjs supports the PR's objectives and enhances the TypeScript development experience by ensuring type safety for Prism integration.
  • 10022-10025: Reiterating approval for the addition of prismjs, which is crucial for the syntax highlighting feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant