Skip to content

feature: Customize header background width for each header type #126

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

Closed
ntn-nicholas opened this issue Aug 8, 2024 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@ntn-nicholas
Copy link

Is your feature request related to a problem? Please describe.

Currently, header background widths can either be in 'full' or 'block' mode. Full mode seems to add too much clutter for smaller headers, especially when a lot of them are nested (the rainbow color code is nice, but in terms of style they all have the same impact). However, it is still nice to have full mode enabled for the more major headers, to easily separate between different sections without the need of horizontal line separators.

The feature request is for a way users can customize the header background width per header types, and not have the option be applied generally to all header types.

Describe the solution you'd like

Proposed solution would be to optionally accept a table for heading.width, where users can choose what mode to use per header. If less than 6 items are given, the last item can be applied to remaining header types.

Ex: width = { "full", "full", "block", "block", "block", "block" }
equivalent to width = { "full", "full", "block" }

This is only a suggestion , and any configuration implementation would be great as long as the requested behavior can be distinguished.

Describe alternatives you've considered

N/A

Additional information

No response

@ntn-nicholas ntn-nicholas added the enhancement New feature or request label Aug 8, 2024
MeanderingProgrammer added a commit that referenced this issue Aug 8, 2024
## Details

Request: #126

The `heading -> width` option is now allowed to be `block`, `width`, or
an array of these 2 values. If it is an array we index into it using a
clamp based on the heading level.

Requires a new kind of validation logic but not too bad, seems to cover
all cases. Also required moving list class to generics, which was easy.
Move all union strings to type alias annotations so exact values can be
defined once and reused as needed.
@MeanderingProgrammer
Copy link
Owner

Sure, added here: f06d19a

Works like in the proposal

@xfzv
Copy link

xfzv commented Aug 8, 2024

Really nice addition, thanks!

However, it is still nice to have full mode enabled for the more major headers, to easily separate between different sections without the need of horizontal line separators.

I agree. I've just switched to the following myself after trying it:

    heading = {
      width = {
        "full",
        "full",
        "block",
        "block",
        "block",
        "block",
      },
    },

@MeanderingProgrammer
Copy link
Owner

Glad you like it, I still prefer the uniform version, but I get it :)

Because of how the values are accessed the following config is also equivalent to yours:

heading = {
    width = { "full", "full", "block" },
},

The last value gets used for any indexes greater than the number of values you provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants