Preserve fenced code block contents during wrapping (#329) - #343
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
SummaryThis PR resolves issue ProblemThe reported issue prevented mdtablefix from corrupting documentation examples when applying combined post-processing flags (e.g., SolutionThe tokenizer in ChangesCore Implementation:
Testing:
Validation: WalkthroughRefactor the markdown tokenizer to use the shared FenceTracker for fence detection and emission; expand unit tests and add CLI regression plus property tests and fixtures to ensure combined-flag runs do not mutate fenced code block bodies. ChangesFenced Content Preservation During Wrapping
Poem
🚥 Pre-merge checks | ✅ 19 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (19 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
5889005 to
6f88538
Compare
|
@coderabbitai review |
This comment was marked as resolved.
This comment was marked as resolved.
Use the shared fence tracker when tokenizing Markdown for post-wrap transforms. This keeps nested literal fences inside their outer block, so `--ellipsis` cannot rewrite fenced examples after wrapping.
Allow `--fences` to normalize fence delimiters in the combined CLI regression while still checking that the fenced bodies remain unchanged. This keeps the test aligned with the documented fence normalization behaviour.
Load the combined wrapping regression input and assertion fragments with `include_str!` so the test data follows the existing `tests/data` fixture convention.
Add focused tokenizer coverage for closed fenced code blocks and nested literal fences, then document the shared `FenceTracker` role in the wrapping pipeline.
Add snapshot coverage for the issue 329 CLI regression and a bounded property test for combined flags preserving generated fenced bodies.
7acbf98 to
e708f40
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Add explicit `tokenize_markdown` tests for closed fences, nested literal fences, and normal post-fence prose tokenization. Clarify the `FenceTracker` ownership and preservation contract in docs.
Generate printable ASCII fenced bodies, varied info strings, indentation, and non-closing fence-like inner lines. Assert the exact body slice remains unchanged after the combined formatting flags.
Store the full-output issue 329 CLI snapshot under `tests/snapshots` and point the wrap regression test at that shared snapshot directory.
This comment was marked as resolved.
This comment was marked as resolved.
Use Oxford `-ize` spellings in the developer guide and prevent generated fence info strings from containing fence marker characters.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@sourcery-ai review |
Reviewer's GuideRefactors markdown tokenization to use the shared FenceTracker so fenced code blocks (including nested literal fences) are treated as opaque during wrapping, and adds targeted property-based and snapshot tests plus documentation updates to prevent regressions for issue #329. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Move generated fenced-block strategies out of the CLI test module so behavioural assertions remain focused on CLI output. Locate the generated fenced body in formatted output before checking the surrounding fence lines. Assert the normalised output fence keeps its indentation and info string, and that the closing fence matches the opening marker selected by `--fences`.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
This branch preserves fenced code block contents during the combined wrapping and post-processing pipeline for issue #329. It makes Markdown tokenization use the shared fence tracker, so nested literal fences remain inside their outer fenced block and
--ellipsiscannot rewrite examples after--wraphas run.Closes #329.
Review walkthrough
FenceTrackersemantics.--wrap --renumber --breaks --ellipsis --fencesregression covering SQL, JSON-like examples and nested literal fences.Validation
make test BUILD_JOBS='--test wrap test_cli_wrap_fences_ellipsis_preserve_fenced_content': passed.coderabbit review --agent: passed with 0 findings.make check-fmt: passed.make lint: passed.make test: passed.Summary by Sourcery
Preserve fenced code block contents during Markdown wrapping by aligning the tokenizer’s fence handling with the shared fence tracking semantics used elsewhere.
Bug Fixes:
Documentation:
Tests: