Skip to content

Conversation

@Nayab-Gauhar
Copy link

Summary

This PR fixes issue #5594 by aligning the <pre> element with the baseline grid using the nudge system.

Changes

  • Updated padding to use $spv-nudge for top padding and ($spv--small - $spv-nudge) for bottom padding
  • Adjusted margin-bottom to $spv--x-large - $spv-nudge to compensate for the nudge value

What this fixes

The <pre> element was not properly aligned with the baseline grid because it wasn't using the nudge system that other text elements use. This fix applies the standard nudge pattern:

  1. Adds nudge value to padding-top to shift content down
  2. Compensates at padding-bottom to maintain total height
  3. Adjusts margin-bottom to account for the nudge

QA

  • Open any page with <pre> elements in the documentation
  • Verify that the pre elements now align properly with the baseline grid
  • Check that the visual appearance and spacing remains correct

Checklist

  • PR should have the Bug 🐛 label
  • Package version update (if needed for release)

…system

- Updated padding to use $spv-nudge for top padding and compensate at bottom
- Adjusted margin-bottom to account for nudge value
- This ensures the pre element aligns properly with the baseline grid
@webteam-app
Copy link

Nayab-Gauhar is not a collaborator of the repo

@jmuzina jmuzina requested review from Copilot and jmuzina October 31, 2025 15:39
Copy link
Contributor

Copilot AI left a 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 adjusts the spacing for code blocks by introducing nudge values to fine-tune the margins and padding. The changes modify the visual spacing around code elements to achieve more precise vertical alignment.

  • Reduced bottom margin by subtracting a nudge value
  • Modified padding to use asymmetric vertical values with nudge adjustments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@jmuzina jmuzina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployed demo.

Here's an example pen that can has content immediately following a pre block that might be helpful in QA'ing this.

It appears the content after the pre is sitting a bit lower than the baseline. I'm not sure if that's owing to the padding (nudge) or margin bottom (spacing after) being off.

Image

@lyubomir-popov or @dgtlntv , could you have a look and let us know what the desired spacing should be?

@dgtlntv
Copy link
Member

dgtlntv commented Dec 1, 2025

@jmuzina It looks like thats due to the margin of the <pre> element being 2 pixels too large. Since the height of the element is divisible by the baseline the margin in this case must be divisible by the baseline as well. (If the element height would not be divisible by the baseline then the margin would need to account for it so element + margin is on the baseline again).

@jmuzina jmuzina assigned Nayab-Gauhar and unassigned lyubomir-popov and dgtlntv Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants