Skip to content

fix --no-pr in markdown mode#291

Merged
yshavit merged 3 commits intomainfrom
fix-no-br
Mar 31, 2025
Merged

fix --no-pr in markdown mode#291
yshavit merged 3 commits intomainfrom
fix-no-br

Conversation

@yshavit
Copy link
Owner

@yshavit yshavit commented Mar 31, 2025

Add tests of a bunch of different element types, but not all of them (it was reaching diminishing returns). I made sure to get a mix of block-type, inline-type, and line-type items.

Resolves #288.

yshavit added 3 commits March 30, 2025 23:57
check both block-type things and not-block things
@yshavit yshavit added the ai-review Tag a PR with this to get an AI review. label Mar 31, 2025
@coderabbitai
Copy link

coderabbitai bot commented Mar 31, 2025

📝 Walkthrough

Walkthrough

The pull request refactors the Markdown rendering logic concerning thematic breaks. The write_md function now passes a hardcoded true for the add_break parameter, ensuring a consistent break is applied. A new method, print_separator, centralizes the decision to output either a thematic break or a newline based on the include_thematic_breaks option. Additionally, several test cases have been added to verify the behavior in scenarios with and without thematic breaks between markdown blocks. These changes aim to simplify the code’s control flow and improve maintainability without altering the overall output structure.

Assessment against linked issues

Objective Addressed Explanation
Correct handling of line breaks in Markdown output for --no-br [#288]

Possibly related PRs

Overall Grade: A


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78bc66d and 62fc439.

📒 Files selected for processing (1)
  • src/fmt_md.rs (8 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/fmt_md.rs (1)
src/utils_for_test.rs (3)
  • default_for_tests (14-16)
  • default_for_tests (20-22)
  • default_for_tests (26-36)
🔇 Additional comments (9)
src/fmt_md.rs (9)

72-72: Changed parameter from dynamic to hardcoded true. Grade: B

The write_md function now passes a hardcoded true value for the add_break parameter instead of using options.include_thematic_breaks. This change simplifies the control flow by centralizing the thematic break decision in the new print_separator method.


104-105: Refactored to use new print_separator method. Grade: A

Good refactoring - replacing direct thematic break insertion with the new centralized method improves maintainability.


111-117: New method centralizes thematic break logic. Grade: A

This new method encapsulates the decision logic for whether to print a thematic break or just a newline, making the code more maintainable. The implementation correctly checks the include_thematic_breaks option.


429-429: Consistent use of print_separator method. Grade: A

Properly refactored to use the new method, ensuring consistency throughout the codebase.


684-710: Added tests for paragraphs with and without thematic breaks. Grade: A

Good addition of tests to verify the behavior with and without thematic breaks between paragraphs. The tests are clear and check both configurations correctly.


901-947: Added tests for list items with and without thematic breaks. Grade: A

Excellent test coverage for list items with both thematic breaks enabled and disabled. These tests will help ensure the feature works correctly across different element types.


1297-1349: Added tests for code blocks with and without thematic breaks. Grade: A

Good test coverage for code blocks. These tests provide comprehensive verification of the thematic break behavior between code blocks.


1398-1422: Added tests for inline elements with and without thematic breaks. Grade: A

Comprehensive tests for inline elements. The tests properly verify both scenarios with thematic breaks enabled and disabled.


1861-1924: Added tests for links with and without thematic breaks. Grade: A

Well-structured tests for links with various configurations. The tests properly verify the behavior with both thematic breaks enabled and disabled, including tests with different reference placement options.


🪧 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>, please review it.
    • Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yshavit yshavit merged commit 42227b5 into main Mar 31, 2025
7 checks passed
@yshavit yshavit deleted the fix-no-br branch March 31, 2025 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Tag a PR with this to get an AI review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--no-br in markdown removes too many lines

1 participant