summaryrefslogtreecommitdiffstats
path: root/assets/scss/_primer/markdown/markdown-body.scss
blob: eb46ea89a73ec6421b32fc1bb20a67a9d2311741 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// All of our block level items should have the same margin
// stylelint-disable selector-max-type

// This is styling for generic markdownized text. Anything you put in a
// container with .markdown-body on it should render generally well. It also
// includes some GitHub Flavored Markdown specific styling (like @mentions)
.markdown-body {
  font-family: $body-font;
  font-size: $h4-size;
  line-height: $body-line-height;
  word-wrap: break-word;

  @import "../base/kbd.scss"; // adds support for keyboard shortcuts

  // Clearfix on the markdown body
  &::before {
    display: table;
    content: "";
  }

  &::after {
    display: table;
    clear: both;
    content: "";
  }

  > *:first-child {
    margin-top: 0 !important;
  }

  > *:last-child {
    margin-bottom: 0 !important;
  }

  // Anchors like <a name="examples">. These sometimes end up wrapped around
  // text when users mistakenly forget to close the tag or use self-closing tag
  // syntax. We don't want them to appear like links.
  // FIXME: a:not(:link):not(:visited) would be a little clearer here (and
  // possibly faster to match), but it breaks styling of <a href> elements due
  // to https://bugs.webkit.org/show_bug.cgi?id=142737.
  a:not([href]) {
    color: inherit;
    text-decoration: none;
  }

  // Link Colors
  .absent {
    color: var(--color-text-danger);
  }

  .anchor {
    float: left;
    padding-right: $spacer-1;
    // stylelint-disable-next-line primer/spacing
    margin-left: -20px;
    line-height: $lh-condensed-ultra;

    &:focus {
      outline: none;
    }
  }

  p,
  blockquote,
  ul,
  ol,
  dl,
  table,
  pre,
  details {
    margin-top: 0;
    margin-bottom: $spacer-3;
  }

  hr {
    height: $em-spacer-3;
    padding: 0;
    margin: $spacer-4 0;
    // stylelint-disable-next-line primer/colors
    background-color: var(--color-border-primary);
    border: 0;
  }

  blockquote {
    // stylelint-disable-next-line primer/spacing
    padding: 0 1em;
    color: var(--color-text-tertiary);
    // stylelint-disable-next-line primer/borders
    border-left: 0.25em $border-style var(--color-markdown-blockquote-border);

    > :first-child {
      margin-top: 0;
    }

    > :last-child {
      margin-bottom: 0;
    }
  }
}