-
-
Notifications
You must be signed in to change notification settings - Fork 169
fix(check-line-alignment): preserve markdown list indentation in never and always modes #1601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…never mode) Co-authored-by: brettz9 <[email protected]>
…never mode) Co-authored-by: brettz9 <[email protected]>
…never mode) Co-authored-by: brettz9 <[email protected]>
|
@copilot : Continue to implement "always" mode. |
Co-authored-by: brettz9 <[email protected]>
Implemented "always" mode support in commit 9d38881. The solution preserves relative list indentation while maintaining proper tag alignment:
Added 3 test cases covering various "always" mode scenarios with nested lists. |
brettz9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
@copilot Anything more to add for this PR? |
No, the PR is complete and ready to merge. It includes:
The solution successfully preserves nested markdown list indentation while maintaining proper tag alignment in both modes. |
|
🎉 This PR is included in version 61.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The
check-line-alignmentrule was flattening nested markdown lists in JSDoc comments by removing indentation from continuation lines.Changes
Detection Logic
startsWithListMarker()to identify markdown list markers (-,*,1.,2., etc.)@param {type} name - description)Indentation Preservation - "Never" Mode
shouldAllowExtraIndent()to determine when extra indentation beyondwrapIndentis validwrapIndentwrapIndent(correct base)Indentation Preservation - "Always" Mode
checkForListMarkers()to detect list markers across tag linescalculateListExtraIndent()to calculate relative indentation for nested itemswrapIndent+ relative offset to the aligned positionExample
Before (broken):
After (preserved):
Scope
Fix applies to both "never" and "always" modes
Comprehensive test coverage with 7 new test cases covering various list scenarios
Fixes
check-line-alignmentscrews lists in tags #1541Original prompt
This section details on the original issue you should resolve
<issue_title>
check-line-alignmentscrews lists in tags</issue_title><issue_description>## Motivation
Lists may be used in
@param,@property, or@returns(random example in MediaWiki). Solutions like Rewrap, used by hundreds of thousands, automatically prettify those, making them look readable. They also support nested lists which should have correct indentation—otherwise their structure would be lost.The
check-line-alignmentrule, on the other hand, is heavy-handed with lists: it either removes all indentation from the lines following the first line of the tag, or allows only fixed indentation with thewrapIndentparameter.I suggest to implement any kind of solution that would prevent the plugin from screwing lists in tags:
-,*,1.if the indentation is greater (not less) than the baselineDesired behavior
(From https://github.com/wikimedia/mediawiki/blob/26e679cfb2878f485ac29b8c523274a91ec0f702/resources/src/mediawiki.api/index.js#L211)
Current behavior
Note that sublists are killed.