summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/components/share/content-markdown.module.css
blob: da1aa11281e554c9c5eca6820ebd9a2062dc3ec1 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.root {
  border: 1px solid var(--sl-color-blue-high);
  padding: 0.5rem calc(0.5rem + 3px);
  border-radius: 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  align-self: flex-start;
  max-width: var(--md-tool-width);

  &[data-highlight="true"] {
    background-color: var(--sl-color-blue-low);
  }

  [data-slot="expand-button"] {
    flex: 0 0 auto;
    padding: 2px 0;
    font-size: 0.75rem;
  }

  [data-slot="markdown"] {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;

    [data-expanded] & {
      display: block;
    }

    font-size: 0.875rem;
    line-height: 1.5;

    p,
    blockquote,
    ul,
    ol,
    dl,
    table,
    pre {
      margin-bottom: 1rem;
    }

    strong {
      font-weight: 600;
    }

    ol {
      list-style-position: inside;
      padding-left: 0.75rem;
    }

    ul {
      padding-left: 1.5rem;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      font-size: 0.875rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }

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

    pre {
      --shiki-dark-bg: var(--sl-color-bg-surface) !important;
      background-color: var(--sl-color-bg-surface) !important;
      padding: 0.5rem 0.75rem;
      line-height: 1.6;
      font-size: 0.75rem;
      white-space: pre-wrap;
      word-break: break-word;

      span {
        white-space: break-spaces;
      }
    }

    code {
      font-weight: 500;

      &:not(pre code) {
        &::before {
          content: "`";
          font-weight: 700;
        }

        &::after {
          content: "`";
          font-weight: 700;
        }
      }
    }

    table {
      border-collapse: collapse;
      width: 100%;
    }

    th,
    td {
      border: 1px solid var(--sl-color-border);
      padding: 0.5rem 0.75rem;
      text-align: left;
    }

    th {
      border-bottom: 1px solid var(--sl-color-border);
    }

    /* Remove outer borders */
    table tr:first-child th,
    table tr:first-child td {
      border-top: none;
    }

    table tr:last-child td {
      border-bottom: none;
    }

    table th:first-child,
    table td:first-child {
      border-left: none;
    }

    table th:last-child,
    table td:last-child {
      border-right: none;
    }
  }
}