File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 8
8
@import " @primer/css/alerts/index.scss" ;
9
9
10
10
@import " extended-markdown.scss" ;
11
+ @import " markdown-overrides.scss" ;
11
12
@import " headings.scss" ;
12
13
@import " images.scss" ;
13
14
@import " shadows.scss" ;
Original file line number Diff line number Diff line change
1
+ // What might happens is that we have a DOM of
2
+ //
3
+ // <div class="markdown-body">
4
+ // <div style="display: none">Note</div>
5
+ // <h2>Heading</h2>
6
+ // ...
7
+ //
8
+ // When this is the case, by default, that first <div> that is the first
9
+ // gets the `margin-top: 0 !important` and not the first <h2>.
10
+ // Generally, the reason this even exists is because <h2> (and <h3>) elements
11
+ // are given extra margin-top so as to divide the article into sections
12
+ // with some extra whitespace. That's fine, but we don't to start the
13
+ // top of the page with too much whitespace. That's why @primer/css
14
+ // has a solution for that. Just the problem that it fails then first
15
+ // element isn't actually a heading.
16
+ // Note we're also doing it for a possible <h3> being the first element.
17
+ // See https://github.com/primer/css/issues/2303
18
+ // See internal issue #2368
19
+ .markdown-body {
20
+ > h2 :first-of-type ,
21
+ > h3 :first-of-type {
22
+ margin-top : 0 !important ;
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments