ascfix 0.7.1

Automatic ASCII diagram repair tool for Markdown files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.7.1] - 2026-04-01

### Added

- **Fenced diagram processing enabled by default**:
  `fenced_diagrams` configuration now defaults to `true`.
  Running `ascfix --mode=diagram` (the default) now processes ASCII diagrams inside bare code fences (no language specifier).
  Users no longer need `--all` to fix all diagrams in a file.
  This is safe because bare code fences are explicitly for ASCII art/diagrams, not code.

- **Support for filled triangle arrow markers** (▼▲):
  LLM-generated diagrams often use filled triangles as arrow markers. ascfix now detects and preserves these in vertical arrow sequences,
  placing them strategically (2/3 down the arrow) with proper connector lines for clean visual separation between boxes.
  This provides better visual markers for arrow connections without extra blank lines.

### Fixed

- **Diagrams in code fences not being processed**:
  The `--fences` flag now enables diagram processing inside bare code fences, not just fence repair.
  Previously, only `--all` would process fenced diagrams. Now `--fences --mode=diagram` correctly handles diagrams in code fences.

## [0.7.0] - 2026-04-01

### Changed

- **Default mode is now `diagram`** instead of `safe`:
  The corner-tracing box detection algorithm is now robust enough to be the default.
  Users running `ascfix README.md` will now repair ASCII diagrams by default.
  Users can still use `--mode safe` to process only tables and lists.

- **Significantly improved CLI help output**:
  - New **MODES** section with clear descriptions of `diagram` and `safe` modes
  - Improved **OPTIONS** section with better wording and clarification:
    - `--fences`: Now explains it repairs mismatched code fence markers
    - `--check`: Clarifies it's for CI integration (exit 1 if changes needed)
    - `--all`: Better description of enabling both diagram mode and fence repair
  - New **EXAMPLES** section with practical usage patterns
  - Better formatting and organization throughout

### Fixed

- **Box detection algorithm refinements**:
  Improved corner-tracing algorithm to more reliably detect ASCII boxes in edge cases.
  Enhanced handling of boxes with complex junction characters and arrows.

- **Rendering improvements**:
  Better preservation of alignment and spacing in diagram repair operations.

### Tests

- Updated integration test fixtures to reflect improved diagram handling.

## [0.6.2] - 2026-02-28

### Fixed

- **Ordered list sub-items after a blank line collapsed to column 0** ([#10]https://github.com/evoludigit/ascfix/issues/10):
  v0.6.1 introduced a regression where sub-items separated from their ordered
  list parent by a blank line (loose list syntax) lost all indentation and
  appeared at column 0. The blank line was clearing the parent list context
  stack, so subsequent sub-items were treated as fresh top-level items.
  The blank-line stack-clear has been removed: the stack now truncates
  naturally when a new list item appears at a lower indent, correctly
  preserving ordered-list context across blank lines.

## [0.6.1] - 2026-02-28

### Fixed

- **Ordered list child indentation** ([#10]https://github.com/evoludigit/ascfix/issues/10):
  `normalize_lists()` was normalising nested list items to a hardcoded 2-space
  indent per level, regardless of parent marker width. Under a `1. ` ordered
  list item, `CommonMark` requires ≥ 3 spaces for continuation content — so
  sub-items were reduced from the valid 3 spaces to the invalid 2 spaces,
  causing parsers (e.g. Starlight's `<Steps>`) to treat them as sibling
  elements instead of children. The indentation is now computed per level
  from the parent marker width: ordered markers contribute `marker.len() + 2`
  spaces (`"1. "` → 3, `"10. "` → 4), unordered markers contribute 2 spaces.

- **Table indentation inside ordered list items** ([#10]https://github.com/evoludigit/ascfix/issues/10):
  Tables nested inside ordered list items were losing their leading
  indentation after normalisation, moving from inside the list item to column 0.
  `process_safe_mode()` now captures the table's leading whitespace before
  calling `normalize_table()` and re-applies it to every output line.

## [0.6.0] - 2026-02-16

### Dependency Reduction & Performance Release

**Massive dependency reduction while maintaining full functionality and improving UX**

#### 🚀 **Performance Improvements**
- **Dependencies**: Reduced from 126 → 56 crates (-56%)
- **Binary Size**: Reduced from 3.7MB → 1.5MB unstripped (-59%)
  - Stripped binary: 1.1MB (-61% from v0.5.8)
- **Compile Time**: Reduced from ~60s → 4s (-93%)
- **Zero functional regressions** - all 296 library tests pass

#### 🔧 **Changed**
- **CLI Parser**: Replaced `clap` (40 deps) with `lexopt` (1 dep)
  - User-facing interface remains identical
  - Manual help text (same format as before)
  - All CLI flags work exactly as before
  - More explicit control over argument parsing
- **File Discovery**: Replaced `ignore` (15 deps) with `std::fs`
  - Simple directory filtering (skips hidden dirs, `node_modules`, `target`, etc.)
  - Better performance (no .gitignore parsing overhead)
  - Symlink loop prevention built-in

#### ⚠️ **Breaking Changes**
- **Removed**: `.gitignore` support for file discovery
  - **Rationale**: Saved 13 dependencies for a rarely-used feature
  - **Impact**: Low - most users process explicit paths or entire directories
  - **Workaround**: Use external tools for complex filtering:
    ```bash
    # With find:
    ascfix $(find . -name "*.md" -not -path "*/node_modules/*")

    # With fd:
    ascfix $(fd -e md)
    ```
- **Removed**: `--no-gitignore` CLI flag (no longer needed)

#### 📁 **Directory Filtering Behavior**
Now automatically skips:
- Hidden directories (starting with `.`)
- `target/` (Rust builds)
- `node_modules/` (JavaScript)
- `vendor/` (Go, PHP)
- `dist/`, `build/` (build output)
- `.git/`, `.svn/`, `.hg/` (version control)

#### **Kept (Good UX)**
- **Config file support** (`toml` + `serde`) - Project-level settings
- **Colored output** (`colored`) - Beautiful terminal output
- **JSON output** (`serde_json`) - Tooling integration

#### 🧪 **Testing**
- All 296 library tests pass
- All 9 integration tests pass
- All 24 edge case tests pass
- 3 fuzz tests pass
- Comprehensive integration testing completed

#### 📚 **Documentation**
- Added `TEST_RESULTS_v0.6.0.md` - Complete test report
- Updated README.md - Removed .gitignore mentions
- Added migration guide for v0.5.x users

#### 🔒 **Security**
- Reduced attack surface (fewer dependencies)
- All remaining deps provide real value
- Input validation maintained
- Symlink loop prevention verified

### Migration from v0.5.8

**No action required for most users!** CLI interface is unchanged.

**If you relied on .gitignore support:**
```bash
# Old (automatic .gitignore):
ascfix .

# New (use find for complex filtering):
ascfix $(find . -name "*.md" -not -path "*/node_modules/*" -not -path "*/.git/*")

# Or use fd (faster):
ascfix $(fd -e md)
```

**Benefits of upgrading:**
- 59% smaller binary (faster downloads, less disk space)
- 93% faster compilation (better CI/CD times)
- Same functionality, better performance

---

## [0.5.8] - 2026-02-16

### Architecture & Quality Release

**Major code organization improvements, comprehensive testing, and transparency about limitations**

#### 🏗️ **Architecture Improvements**
- **Module Refactoring**: Split `modes.rs` into clean, focused modules
  - `modes/mod.rs` (113 lines) - Router logic and integration tests
  - `modes/check.rs` (33 lines) - Check mode implementation
  - `modes/diagram.rs` (150 lines) - Diagram processing pipeline
  - `modes/safe.rs` (265 lines) - Safe mode for tables and lists
  - `modes/table.rs` (215 lines) - Table normalization utilities
  - Improved code maintainability and test organization
  - No breaking changes to public API

#### 🧪 **Testing Infrastructure**
- **Stress Tests**: Added 21 comprehensive stress tests (run with `--ignored`)
  - Large file handling: 1MB, 10MB, 50MB, 100MB
  - Performance scaling verification (linear time complexity)
  - Edge cases: extremely long lines, many blank lines, deeply nested lists
  - Unicode support: emoji, RTL text, zero-width characters, Asian scripts
  - Complex diagrams: nested boxes, wide tables, large grids
- **Fuzz Tests**: Added 3 property-based tests using proptest
  - Random ASCII input handling (no panics)
  - Box dimension fuzzing
  - Line length fuzzing
- **Test Helpers**: Created generators and assertions for test infrastructure
  - `tests/helpers/generators.rs` - Test data generation
  - `tests/helpers/assertions.rs` - Custom test assertions

#### 📚 **Documentation**
- **Idempotence Transparency**: Comprehensive documentation of known limitations
  - README.md: Added "Known Limitations" section with clear examples
  - LIBRARY_USAGE.md: 141 new lines with code examples and workarounds
  - ARCHITECTURE.md: 60 new lines explaining technical root causes
  - What works: simple diagrams, tables, single-level nesting (✅ fully idempotent)
  - What to watch: complex diagrams with 3+ nesting levels (⚠️ may not be idempotent)
  - Four documented workarounds for users
- **Documentation Tests**: Added 5 tests to validate documentation accuracy

#### 🛡️ **Safety Enhancements**
- **Table Unwrapping**: Improved edge case handling with conservative preservation
  - Detects and preserves list markers (`-`, `*`, `+`, `1.`, `2.`) in table cells
  - Detects and preserves blockquotes (`>`) in table cells
  - Prevents incorrect unwrapping of intentional multi-line content
  - 4 new tests for edge case coverage
  - Total: 14 table tests ensuring correctness

#### 🧹 **Code Quality**
- Removed all TODO action items from codebase
- Added safety comments to production `unwrap()` calls
- Replaced "Todo" in test data with clearer examples ("Buy milk", "Task")
- All 288 library tests passing
- Zero clippy warnings
- Clean code audit results

#### **Performance**
- Verified linear scaling (1MB in ~1.2s, no quadratic behavior)
- Performance test included in stress test suite
- Memory efficiency maintained for large files

### Verification
- ✅ 288 library tests passing (100%)
- ✅ 21 stress tests available
- ✅ 3 fuzz tests passing
- ✅ 5 documentation tests passing
- ✅ Zero clippy warnings
- ✅ Backwards compatible (no API changes)

### Notes
This release focuses on code quality, testing infrastructure, and transparency. The module refactoring makes the codebase more maintainable while the comprehensive documentation helps users understand the tool's capabilities and limitations. No functional changes to existing features.

## [0.5.7] - 2026-02-15

### Bug Fix Release

**Critical fix: normalize_loose_lists now called in safe mode**

#### 🐛 **Bug Fixes**
- **Fixed issue #9**: `normalize_loose_lists()` was not being called in safe mode
  - Lists were rendering inline in Pandoc/LaTeX PDFs despite v0.5.6 claims
  - Root cause: function existed but was never invoked in `process_safe_mode()`
  - Fix: Added missing call to `normalize_loose_lists(&content)` in safe mode processing

#### 🔧 **Technical Changes**
- Fixed idempotence test to verify idempotence rather than exact line count equality
- Updated fixture files to reflect correct Pandoc-compatible list formatting
- Updated README.md with proper list formatting

### Verification
- ✅ All 288+ tests passing
- ✅ Zero Clippy warnings
- ✅ Lists now properly get blank lines in safe mode

## [0.5.6] - 2026-02-15

### Feature Release

**Auto-fix list formatting for Pandoc/CommonMark compatibility**

#### **New Features**
- **Fixed issue #8**: Automatically add blank lines before lists for proper rendering
  - Lists following text ending with `:` now get blank line inserted
  - Lists following bold text with colons (e.g., `**Requirements:**`) now work correctly
  - Lists in code blocks are preserved unchanged
  - Nested lists maintain proper structure (no blank lines added between parent/child)
  - Prevents duplicate blank lines when one already exists

#### 🐛 **Bug Fixes**
- Fixed false positive detection: bold text like `**Requirements:**` was incorrectly treated as list items
- Fixed code block handling: lists inside code fences are no longer modified

#### 🧪 **Tests**
- Added 6 comprehensive edge case tests for blank line insertion
- Tests cover colon endings, bold text, nested lists, and code block preservation

### Verification
- ✅ All 288+ tests passing (6 new tests added)
- ✅ Zero Clippy warnings
- ✅ No breaking changes

## [0.5.5] - 2026-02-15

### Bug Fix Release

**Fixed critical panic on tables with mismatched column counts**

#### 🐛 **Bug Fixes**
- **Fixed issue #7**: Prevent "index out of bounds" panic when data rows have more cells than header rows
  - Added bounds check in `normalize_table()` when formatting data rows
  - Extra cells beyond header count are now silently truncated (consistent with width calculation)
  - Tables with fewer cells than headers continue to work correctly

#### 🧪 **Tests**
- Added edge case test for tables with extra columns
- Added edge case test for tables with fewer columns

### Verification
- ✅ All 282+ tests passing
- ✅ Zero Clippy warnings
- ✅ No breaking changes

## [0.5.4] - 2026-02-14

### Quality & Documentation Release

**This release focuses on code quality improvements and comprehensive documentation**

#### **Code Quality**
- **Resolved all Clippy warnings**: Zero warnings with strict pedantic linting
- **Clippy compliance**: Marked 6 arrow detection functions as const fn for compile-time evaluation
- **Simplified patterns**: Replaced map_or patterns with is_some_and for cleaner code
- **Code formatting**: Applied consistent formatting standards across all modules

#### 📚 **Documentation Improvements**
- **Added CONFIG.md**: Complete configuration guide with schema, examples, and best practices
- **Added LIBRARY_USAGE.md**: Comprehensive Rust API documentation with integration examples
- **Updated README**: Improved documentation organization and discoverability
- **Quality validation**: All documentation examples verified and tested

#### 🧪 **Test Reliability**
- **Golden fixture tests**: Properly marked edge case fixtures for conservative mode
- **Test organization**: Improved fixture structure with clear documentation
- **Quality metrics**: Established realistic quality thresholds for different diagram types

#### 🔧 **Technical Improvements**
- **Test refactoring**: Extracted large test functions to improve maintainability
- **Code consolidation**: Reduced test complexity while maintaining coverage

### Notes
- All 282+ tests passing
- Zero Clippy warnings
- Code formatting standards applied throughout
- Backward compatible with 0.5.x series

## [0.5.0] - 2026-02-12

### Major Quality Improvements & Finalization Release

**Conservative, reliable ASCII diagram processing with honest quality guarantees**

#### 🐛 **Critical Bug Fixes**

**Table Processing Bug (Finalization)**
- **Fixed**: Tables with empty cells in some columns were corrupted (columns merged/shifted)
- **Root Cause**: `parse_table_row()` skipped empty cells, breaking column alignment
- **Solution**: Preserve ALL cells including empty ones; refined wrapped cell detection
- **Impact**: Tables now process correctly, README can be safely normalized
- **Verification**: Added README as dogfood test fixture

**Wrapped Cell Detection**
- **Fixed**: Legitimate empty table cells incorrectly identified as wrapped continuations
- **Solution**: Refined `is_continuation_row()` to check for first-column-empty + max-one-content-cell
- **Impact**: Wrapped cells unwrap correctly; empty cells preserved properly

#### **Quality Improvements**

**Text Corruption Prevention**
- **Fixed**: Arrows (↑↓←→) and pipes (│) corrupting text content inside boxes
- **Solution**: Collision detection prevents arrows from overwriting box interiors
- **Impact**: Text content preserved in simple-to-moderate diagrams

**Data Loss Elimination**
- **Fixed**: Complete sections of diagrams being deleted during processing
- **Solution**: Overlay rendering preserves all original content, only modifies detected primitives
- **Impact**: Zero data loss for simple diagrams; conservative mode for complex

**Nested Box Containment**
- **Added**: Basic parent-child box containment with proper margins
- **Status**: Single-level nesting works reliably; deep nesting (3+ levels) handled conservatively
- **Impact**: Simple nested diagrams render cleanly; complex structures preserved unchanged

**Intelligent Quality Validation**
- **Added**: Semantic transformation analysis distinguishing destructive vs constructive changes
- **Features**: Context-aware corruption detection, transformation classification
- **Impact**: Automated quality assurance with conservative behavior for ambiguous cases

### Repository Finalization

**Code Cleanup**
- Removed all phase markers from code and tests
- Cleaned up dead code and unused variables (13+ instances)
- Fixed all clippy warnings and linting issues
- Applied `cargo fmt` consistently across codebase
- Removed development archaeology per "Eternal Sunshine Principle"

**Documentation Honesty**
- Updated README with conservative, honest quality claims
- Changed from "92% pass rate" to "comprehensive test suite with 10+ passing fixtures"
- Added explicit caveats for complex nested structures
- Documented conservative mode behavior
- Accurate feature descriptions matching actual capabilities

**Test Enhancements**
- Added README as dogfood test fixture (`idempotent_readme_dogfood`)
- Comprehensive fixture documentation in `tests/data/README.md`
- Fixed wrapped cell fixtures to match correct output
- Quality tests marked with clear TODOs for known limitations

### Technical Enhancements

#### Core Processing Pipeline
- **Rendering**: Changed from "fresh grid" to "overlay on original" for content preservation
- **Detection**: Enhanced parent-child relationship establishment for nested boxes
- **Normalization**: Added nested containment logic with collision-aware expansion
- **Quality**: Intelligent validation framework with transformation classification
- **Tables**: Fixed cell preservation and wrapped cell detection

#### New Modules
- `src/transformation_analysis.rs` - Semantic analysis of processing transformations
- `src/quality.rs` - Comprehensive quality validation and metrics
- Enhanced test suites with 74 total tests (3 ignored with TODOs)

#### Quality Assurance
- **Test Coverage**: 74 tests passing (simple-to-moderate diagrams verified)
- **Conservative Behavior**: Complex structures (3+ nesting levels) handled safely
- **Validation Types**: Text preservation, structure integrity, corruption detection
- **Dogfooding**: README processes correctly with ascfix
- **CI/CD Ready**: Automated quality regression detection

### Known Limitations (Documented Transparently)
- **Complex Nested Diagrams**: Deep nesting (3+ levels) preserved unchanged (conservative mode)
- **Overlapping Elements**: Complex overlapping structures handled conservatively
- **Some Quality Tests Ignored**: 3 tests ignored with TODOs for features needing refinement
  - Complex nested diagrams (rendering issues)
  - Fence repair quality (needs refinement)

### Breaking Changes
- **Table Processing**: Tables now correctly preserve empty cells (was a bug, now fixed)
- **Processing Behavior**: Enhanced collision detection may change output for edge cases

### Performance
- **Processing Speed**: Maintained linear O(n) performance
- **Memory Usage**: Slight increase due to quality analysis (acceptable for benefits)
- **Build Size**: Minor increase due to additional quality validation code

### Verification
- ✅ 74 tests passing (3 ignored with documented TODOs)
- ✅ Zero clippy warnings
- ✅ Security audit clean (cargo audit)
- ✅ Code formatted (cargo fmt)
- ✅ Documentation builds (cargo doc)
- ✅ README processes cleanly with ascfix (dogfooding verified)
- ✅ Conservative quality approach for complex diagrams
- ✅ All original functionality preserved

### Migration Notes
- **No breaking API changes** - all existing functionality preserved
- **Enhanced quality** - improved output for complex diagrams
- **Better error handling** - more informative quality validation messages
- **CI/CD friendly** - automated quality gates for integration pipelines

---

## [Unreleased]

### Added - Table Unwrapping (Phase 02)

**Automatic Table Cell Unwrapping**
- Detect and repair Markdown tables with hard-wrapped cells at 80 columns
- Join continuation lines back into single cells with proper spacing
- Support for single and multi-column wrapped content
- Automatic detection using continuation row patterns (empty leading cells)

**Smart Content Preservation**
- Code blocks in table cells are preserved (not unwrapped)
- Supports both backtick (```) and tilde (~~~) code fences
- Links spanning wrap boundaries are preserved to prevent syntax breakage
- Intentional multi-line content remains intact

**Safe Mode Integration**
- Table unwrapping automatically applied in safe mode
- Unwrapping happens before column alignment normalization
- Seamless integration with existing table processing pipeline

**Comprehensive Testing**
- 10 unit tests for table unwrapping logic
- 3 new integration fixtures for wrapped tables
- 3 new fixture tests validating end-to-end behavior
- Tests for code block preservation and link boundary detection

### Technical Details

- New module: `src/tables.rs` with 200+ lines of table unwrapping logic
- Added `has_wrapped_cells()` - Detect wrapped table cells
- Added `unwrap_table_rows()` - Join continuation lines intelligently
- Added `contains_code_fence()` - Detect code blocks in cells
- Added `has_incomplete_link_across_rows()` - Prevent breaking markdown links
- Updated `process_safe_mode()` to integrate unwrapping pipeline

## [0.4.0] - 2026-02-09

### Added - Directory Support, MDX Files, and Duplicate Fence Repair

**Directory Processing and File Discovery**
- Process entire directories recursively with automatic file discovery
- Recursive traversal of nested directories
- Auto-detection of `.md` and `.mdx` files by default
- Custom file extension filtering via `--ext` / `-e` flag (comma-separated)
- Respect `.gitignore` files by default with `--no-gitignore` override
- Mixed argument support: process both files and directories in a single invocation

**MDX File Support (Issue #3)**
- `.mdx` files included in default processing
- Seamless handling alongside Markdown files
- Full feature parity with `.md` files

**Duplicate Closing Fence Detection (Issue #4)**
- Detect orphaned/duplicate closing fence markers
- Remove duplicate closing fences that appear after properly closed blocks
- Handle consecutive duplicate closing fences
- Support for both backtick and tilde fence types
- Conservative approach: preserves intentional nesting and longer fences

**CLI Improvements**
- New `--ext` / `-e` flag for custom file extension filtering
- New `--no-gitignore` flag to disable gitignore respect
- Graceful error handling: continue processing on single file errors
- Batch processing with error collection and reporting
- Short flag support for all flags (`-c`, `-e`, `-i`, `-a`, etc.)
- Improved help output with categorized sections and examples

**Batch Processing Enhancements**
- Process multiple files with resilience: errors in one file don't stop batch processing
- Comprehensive error reporting at end of processing
- Proper exit codes (0 for success, 1 for errors or changes needed)
- Clear error messages for file discovery and processing failures

**Dependencies**
- Added `ignore` crate (v0.4) for directory walking and gitignore support

### Testing
- 7 new integration tests for duplicate closing fence repair
- 16 unit tests for file discovery
- 5 tests for gitignore behavior and respect
- 7 end-to-end directory integration tests
- All existing tests continue to pass (247 unit tests, 572 total)

### Fixed
- Clippy warnings and code style improvements

### Changed
- Renamed internal `files` argument to `paths` for clarity (user-facing behavior unchanged)
- Default file extensions now include `.mdx` alongside `.md`

## [0.3.0] - 2026-02-09

### Added - Code Fence Boundary Validation and Repair

**Code Fence Repair**
- Detect and repair mismatched code fence lengths
- Automatically close unclosed code fences
- Preserve language specifiers (e.g., `python`, `javascript`)
- Support for both backtick and tilde fences
- Proper handling of nested fences (preserves intentional nesting)
- Conservative approach: skips ambiguous cases (type mismatches)

**CLI Enhancements**
- New `--fences` flag to enable fence repair independently
- New `--all` flag as shorthand for `--fences --mode=diagram`
- Works with `--check` mode for CI/CD validation

**Testing**
- 12 integration tests for fence repair
- 23 unit tests for detection, pairing, and validation
- Golden file tests for common fence scenarios
- Idempotence verification

### Fixed
- Integration with existing table and diagram repair pipeline

## [0.2.0] - 2026-02-06

### Added - Major Feature Expansion

**Box Style Variants**
- Support for double-line boxes (╔═╗║╚╝)
- Support for rounded-corner boxes (╭─╮│╰╯)
- Automatic style detection and preservation
- Style-aware rendering maintains original aesthetic

**Enhanced Arrow Support**
- Multiple arrow types: standard (→), double (⇒), long (⟶), dashed
- Bidirectional arrow support (rightward/leftward/upward/downward)
- Type detection from arrow characters
- Consistent arrow alignment across diagrams

**Side-by-Side Box Balancing**
- Automatic width normalization for horizontally adjacent boxes
- Vertical overlap detection
- Uniform sizing within alignment groups
- Conservative gap detection (≤1 cell)

**Nested Box Hierarchies**
- Parent/child relationship detection
- Automatic parent box expansion to fit children
- Multi-level nesting support (up to 2 levels stable)
- Hierarchy-aware rendering with proper nesting order

**Connection Lines (L-shaped Paths)**
- L-shaped path detection (limited to 4 segments)
- Box endpoint snapping
- Segment-based representation
- Conservative structure validation

**Label Preservation Framework**
- Text label attachment tracking to primitives
- Offset-based positioning (relative to attachment)
- Collision detection framework
- Support for labels on boxes, arrows, and connections

**Comprehensive Testing**
- 40+ new test cases across 5 test suites
- Golden file tests for all new features
- Idempotence verification framework
- 15 edge case tests covering unusual inputs
- Total: 250+ tests, all passing

### Improved
- Architecture updated to support 6 new primitive types
- Detector enhanced with hierarchy and connection detection
- Normalizer extended with 8 distinct operations
- Renderer updated for style-aware output
- Documentation comprehensive with examples

### Documentation
- Updated README with feature examples and usage
- Enhanced ARCHITECTURE.md with new primitives and algorithms
- Documented known limitations and conservative behavior
- Security and contribution guides maintained

### Known Limitations
- Nested box hierarchies may trigger re-detection on second pass (non-idempotent for complex diagrams)
- Simple diagrams remain fully idempotent
- Deep nesting (>2 levels) handled conservatively
- Connection line detection limited to 4 segments

### Verification
- 250+ tests passing (210 unit, 12 golden file, 15 edge case, 3 idempotence, 10 others)
- Zero Clippy warnings
- All code lints clean
- Security audit passed
- Release build successful

---

## [0.1.0] - 2026-02-06

### Added
- Initial release of **ascfix** - Automatic ASCII diagram repair tool
- **Safe mode**: Normalize Markdown tables (column alignment)
- **Diagram mode**: Detect and normalize ASCII boxes and arrows
- **Check mode**: Validate files without modifying (exit codes for CI/CD)
- Grid-based diagram representation and processing
- Primitive detection (boxes, arrows, text rows)
- Layout normalization (box widths, arrow alignment, padding)
- Comprehensive test suite (258 tests)
  - 122 unit tests
  - 129 integration tests
  - 6 golden file tests
  - 1 roundtrip test
- Production-ready binary (~1.2MB)
- Library API for programmatic use

### Features
- **Conservative**: Only fixes well-understood diagram structures
- **Idempotent**: Running twice produces identical output
- **Fast**: Linear processing of file content
- **Safe**: No panics on untrusted input
- **Deterministic**: Consistent output every time

### Verified
- Zero Clippy warnings
- All tests passing
- No development artifacts
- Clean git history
- Security validated

---

[Unreleased]: https://github.com/evoludigit/ascfix/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/evoludigit/ascfix/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/evoludigit/ascfix/releases/tag/v0.1.0