Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the MdHeader class to support indentation and validate header levels. The changes add parameter validation with warning messages for invalid header levels and introduce an optional indent parameter to control header positioning.
- Added header level validation with warnings for levels outside the 1-6 range
- Introduced an indent parameter to support header indentation
- Updated documentation to reflect the new functionality
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mdfy/elements/header.py | Added header level validation, indent parameter support, and corresponding documentation updates |
| tests/elements/header_test.py | Added test cases for invalid header level warnings and header indentation functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Args: | ||
| content (str): The content of the header. | ||
| level (int, optional): The header level. Defaults to 1. | ||
| level (int, optional): The header level. Should be in a range of 6 >= level >= 1. Defaults to 1. |
There was a problem hiding this comment.
The range description is unclear and uses unconventional notation. Consider rephrasing to 'The header level. Should be between 1 and 6 (inclusive). Defaults to 1.' for better clarity.
| level (int, optional): The header level. Should be in a range of 6 >= level >= 1. Defaults to 1. | |
| level (int, optional): The header level. Should be between 1 and 6 (inclusive). Defaults to 1. |
| self.content = content | ||
| if level < 1 or level > 6: | ||
| warnings.warn( | ||
| f"Header level {level} is out of range" |
There was a problem hiding this comment.
The warning message should specify the valid range for better user guidance. Consider changing to 'Header level {level} is out of range. Valid range is 1-6.'
| f"Header level {level} is out of range" | |
| f"Header level {level} is out of range. Valid range is 1-6." |
No description provided.