Skip to content

feat: implement MD007 ul-indent rule with perfect parity (#59)#59

Merged
ekropotin merged 1 commit into
developmentfrom
dev
Aug 12, 2025
Merged

feat: implement MD007 ul-indent rule with perfect parity (#59)#59
ekropotin merged 1 commit into
developmentfrom
dev

Conversation

@ekropotin
Copy link
Copy Markdown
Owner

Implements MD007 (ul-indent) rule for unordered list indentation consistency. This rule ensures list items are indented by the configured number of spaces with support for complex nesting scenarios and mixed list types.

Features

  • Three configuration parameters:

    • indent: Spaces per nesting level (default: 2)
    • start_indent: Spaces for first level when start_indented=true (default: 2)
    • start_indented: Whether to indent first level (default: false)
  • Smart list detection: Only checks unordered lists, ignores ordered lists

  • Proper nesting handling: Correctly calculates indentation based on tree structure

  • Mixed list support: Ignores unordered lists nested within ordered lists

Implementation

  • Uses Token-based rule type for optimal performance with AST caching
  • Comprehensive nesting level calculation with proper parent list validation
  • Single-pass analysis with efficient tree traversal
  • Perfect parity with original markdownlint validated through testing

Testing

  • 14 comprehensive unit tests covering all configuration combinations
  • 2 TOML configuration parsing tests
  • 3 test sample files following project conventions
  • Edge case coverage: empty documents, single items, nested structures
  • Parity validation against original markdownlint

Documentation

  • Complete rule documentation with examples and configuration details
  • Updated README.md with rule status and configuration
  • Comprehensive test samples demonstrating valid/invalid patterns

🤖 Generated with Claude Code

Implements MD007 (ul-indent) rule for unordered list indentation consistency.
This rule ensures list items are indented by the configured number of spaces
with support for complex nesting scenarios and mixed list types.

## Features

- **Three configuration parameters**:
  - `indent`: Spaces per nesting level (default: 2)
  - `start_indent`: Spaces for first level when start_indented=true (default: 2)
  - `start_indented`: Whether to indent first level (default: false)

- **Smart list detection**: Only checks unordered lists, ignores ordered lists
- **Proper nesting handling**: Correctly calculates indentation based on tree structure
- **Mixed list support**: Ignores unordered lists nested within ordered lists

## Implementation

- Uses Token-based rule type for optimal performance with AST caching
- Comprehensive nesting level calculation with proper parent list validation
- Single-pass analysis with efficient tree traversal
- Perfect parity with original markdownlint validated through testing

## Testing

- 14 comprehensive unit tests covering all configuration combinations
- 2 TOML configuration parsing tests
- 3 test sample files following project conventions
- Edge case coverage: empty documents, single items, nested structures
- Parity validation against original markdownlint

## Documentation

- Complete rule documentation with examples and configuration details
- Updated README.md with rule status and configuration
- Comprehensive test samples demonstrating valid/invalid patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ekropotin ekropotin merged commit 782bf48 into development Aug 12, 2025
3 checks passed
@ekropotin ekropotin deleted the dev branch August 12, 2025 04:58
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