feat: add padding and margin character support#546
Merged
aymanbagabas merged 5 commits intov2-expfrom Jul 7, 2025
Merged
Conversation
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces configurable padding and margin characters in the Style struct, defaulting to whitespace when unset.
- Added
paddingCharandmarginCharfields and corresponding property keys. - Updated
RenderandapplyMarginsto 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
paddingCharandmarginCharbehaviors in rendering. Consider adding unit tests to verify custom character defaults and overrides.
padChar := s.paddingChar
Member
Author
caarlos0
approved these changes
Jul 7, 2025
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>
andreynering
approved these changes
Jul 7, 2025
Contributor
|
superseedes #545 |
Member
Author
|
This is now merged into v2-exp. @andreynering We should update Glamour to use the new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.