Skip to content

text: make the gap below a heading configurable - #3129

Open
wweziza wants to merge 1 commit into
longbridge:mainfrom
wweziza:text-configurable-heading-gap
Open

wweziza wants to merge 1 commit into
longbridge:mainfrom
wweziza:text-configurable-heading-gap

Conversation

@wweziza

@wweziza wweziza commented Sep 18, 2026

Copy link
Copy Markdown

What

Add TextViewStyle::heading_gap (getter) and with_heading_gap (setter), mirroring the existing paragraph_gap, and use it for the heading's bottom padding in the block renderer.

Why

Headings render with a hard-coded .pb(rems(0.3)), so stacked headings, and a heading above body text, always sit tight no matter what spacing the surrounding view wants. There is no way to loosen it from TextViewStyle the way paragraph_gap already allows for paragraphs.

Behavior

The default is rems(0.3), identical to the current constant, so existing output is unchanged. Callers that want roomier headings can now do:

TextView::markdown(id, text, window, cx)
    .style(TextViewStyle::default().with_heading_gap(rems(1.)))

Notes

One focused change following the paragraph_gap pattern:

  • crates/base/src/text/style.rs: field, PartialEq arm, default, with_heading_gap, heading_gap().
  • crates/base/src/text/node.rs: heading uses node_cx.style.heading_gap() instead of the constant.

Headings render with a fixed 0.3 rem bottom padding, so stacked headings and a
heading above body text always sit tight regardless of the view's spacing.

Add `TextViewStyle::heading_gap` (with `with_heading_gap`), mirroring the
existing `paragraph_gap`, and use it for the heading's bottom padding. The
default stays 0.3 rem, so existing output is unchanged.
wweziza added a commit to wweziza/letronna that referenced this pull request Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant