Conversation
Reviewer's GuideIntroduces an 80-column text wrapping stage for paragraphs and list items by integrating a new wrap_text helper into the processing pipeline, adding supporting regex and flush logic, accompanied by tests, documentation updates, and the textwrap dependency. Sequence Diagram: Core Text Wrapping InteractionsequenceDiagram
participant P as process_stream
participant WT as wrap_text
participant FP as flush_paragraph
participant TWF as textwrap::fill
P->>WT: wrap_text(lines, 80)
activate WT
loop Over text segments (paragraphs/list items)
alt Buffer needs flushing or list item processing
WT->>FP: flush_paragraph(out_vec, current_buffer, indent, width)
activate FP
FP->>TWF: fill(buffered_text, effective_width)
activate TWF
TWF-->>FP: wrapped_text_segment
deactivate TWF
FP-->>WT: (appends to out_vec)
deactivate FP
else Regular text line
WT->>WT: Add line to internal buffer
end
end
WT-->>P: resulting_wrapped_lines
deactivate WT
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Rate limit exceeded@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughThis update introduces a text wrapping feature to the Markdown processing pipeline. After tables are reflowed and HTML tables are handled, paragraphs and list items are now wrapped at 80 columns, preserving indentation and Markdown structure. The README and integration tests are updated to reflect and verify this new functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant process_stream
participant wrap_text
User->>process_stream: Provide Markdown input
process_stream->>process_stream: Reflow Markdown tables
process_stream->>process_stream: Convert HTML tables
process_stream->>wrap_text: Pass processed lines
wrap_text->>wrap_text: Wrap paragraphs and list items (80 columns)
wrap_text-->>process_stream: Return wrapped text
process_stream-->>User: Output final Markdown
Possibly related PRs
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tests/integration.rs (1)
505-515: Test enforces an incorrect list-wrapping specificationRequiring every wrapped line to start with “- ” masks the bug above and does not match common Markdown conventions (subsequent lines should be indented, not bullet-prefixed).
Please adjust the test once the wrapping logic is fixed.
🧹 Nitpick comments (3)
Cargo.toml (1)
12-12: Pinning textwrap to an exact minor/patch version may hindercargo updateConsider specifying a caret requirement (
^0.16) or dropping the patch version so that non-breaking bug-fix releases are picked up automatically.README.md (1)
4-5: Minor style nit“It also wraps paragraphs and list items to 80 columns” reads a little more smoothly than “at 80 columns”.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~4-~4: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...orm width. It also wraps paragraphs and list items at 80 columns. The tool ignores f...(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)
src/lib.rs (1)
256-264:flush_paragraphignores existing intra-paragraph blank linesIf the buffer contained hard line-breaks they are collapsed into spaces before wrapping, losing author intent.
Consider preserving explicit<br>or two-space line breaks.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
Cargo.toml(1 hunks)README.md(1 hunks)src/lib.rs(3 hunks)tests/integration.rs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/integration.rs (1)
src/lib.rs (1)
process_stream(334-392)
🪛 LanguageTool
README.md
[uncategorized] ~4-~4: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...orm width. It also wraps paragraphs and list items at 80 columns. The tool ignores f...
(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)
🔇 Additional comments (2)
src/lib.rs (2)
249-251: Regex captures bullet prefix correctly – good
No issues here.
266-331: Edge cases: headings & fenced code blocks with indentation
FENCE_REis anchored (^) so indented code fences (“ ```”) are not detected and may be re-wrapped.
Similarly, indented ‘#’ headings are treated as paragraph text.
Add^\s*to both patterns or trim-start before matching.
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `tests/integration.rs:504` </location>
<code_context>
+}
+
+#[test]
+fn test_wrap_list_item() {
+ let input = vec![
+ "- This bullet item is exceptionally long and must be wrapped to keep \
</code_context>
<issue_to_address>
Add a test case for list items shorter than the wrap width.
Ensure that list items shorter than the wrap width are tested to confirm they remain unwrapped and retain their prefix and content on a single line.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…columns` Docstrings generation was requested by @leynos. * #32 (comment) The following files were modified: * `src/html.rs` * `src/lib.rs` * `tests/integration.rs`
|
Note Generated docstrings for this pull request at #35 |
…columns` (#35) Docstrings generation was requested by @leynos. * #32 (comment) The following files were modified: * `src/html.rs` * `src/lib.rs` * `tests/integration.rs` Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
Testing
cargo fmt --checkcargo clippy -- -D warningsRUSTFLAGS="-D warnings" cargo testnpx markdownlint-cli2 README.mdnixie **/*.mdhttps://chatgpt.com/codex/tasks/task_e_684e3e0cdbc08322b183dc70fb60e179
Summary by Sourcery
Add automatic text wrapping for Markdown content after table reflow, including helper functions for wrapping logic, update documentation, and add tests to ensure wrapping at 80 columns.
New Features:
Enhancements:
Build:
Documentation:
Tests:
Summary by CodeRabbit