-
Notifications
You must be signed in to change notification settings - Fork 270
feat: add padding and margin character support #546
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
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
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.
Pull Request Overview
This PR introduces configurable padding and margin characters in the Style
struct, defaulting to whitespace when unset.
- Added
paddingChar
andmarginChar
fields and corresponding property keys. - Updated
Render
andapplyMargins
to use the custom characters. - Added setter/getter methods for the new properties.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
style.go | Defined new paddingCharKey /marginCharKey , struct fields, and applied defaults in rendering. |
set.go | Handled paddingCharKey and marginCharKey in set , setFrom , and created PaddingChar /MarginChar methods. |
get.go | Introduced GetPaddingChar , GetMarginChar , and getAsRune to retrieve the new properties. |
Comments suppressed due to low confidence (2)
get.go:138
- [nitpick] Add a comma after 'set' in the comment: 'If no value is set, 0 is returned.' to improve readability.
// GetPaddingChar returns the style's padding character. If no value is set
style.go:395
- There are no tests covering the new
paddingChar
andmarginChar
behaviors in rendering. Consider adding unit tests to verify custom character defaults and overrides.
padChar := s.paddingChar
This adds support for setting a padding and margin character in the Style struct. This allows users to specify a character that will be used for padding and margin and defaults to whitespace if not set.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
superseedes #545 |
This is now merged into v2-exp. @andreynering We should update Glamour to use the new |
This adds support for setting a padding and margin character in the Style struct. This allows users to specify a character that will be used for padding and margin and defaults to whitespace if not set.