Skip to content
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

Add margin top to certain single elements surrounded by code blocks for consistency #1128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ichard26
Copy link

@ichard26 ichard26 commented Jan 8, 2023

What does this PR change? What problem does it solve?

Take this structure:

<div .highlight>
<p>

<div .highlight>

The current post-single CSS adds margin to the bottom of the paragraph and that's it. This works great when the previous element also got the same amount of bottom margin, however code blocks do not! The end result looks similar to the figure above.

This commit fixes this adding top margin to elements that come immediately after a code block (they have the .highlight class). The amount of top margin added is the same they already get on the bottom.

Before (notice that elements between the codeblocks appear closer to the previous code block than the next1)

image

After

image

I left definition lists alone because they lack any margin at all so adding some margin top would be inconsistent.

Was the change discussed in an issue or in the Discussions before?

Nope. My apologies if this is bad form on my part!

PR Checklist

  • This change adds/updates translations and I have used the template present here. n/a
  • I have enabled maintainer edits for this PR.
  • I have verified that the code works as described/as intended.
  • This change adds a Social Icon which has a permissive license to use it. n/a
  • This change does not include any CDN resources/links. n/a
  • This change does not include any unrelated scripts such as bash and python scripts. n/a
  • This change updates the overridden internal templates from HUGO's repository. n/a

Footnotes

  1. Except for ordered lists, my user agent spreadsheets apparently already "fixes" this problem adding enough margin top.

…istency

Take this structure:

<div .highlight>
<p>

<div .highlight>

The current post-single CSS adds margin to the bottom of the paragraph
and that's it. This works great when the previous element also got the
same amount of bottom margin, however code blocks do not! The end result
looks similar to the figure above.

This commit fixes this adding top margin to elements (as needed) that come
immediately after a code block (they have the .highlight class). The
amount of top margin added is the same they already get on the bottom.
@ichard26 ichard26 changed the title Add margin top to single <p> tag surrounded by code blocks for consistency Add margin top to certain single elements surrounded by code blocks for consistency Jan 8, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

None yet

1 participant