Jaspers Hub

jaspers / markdown

pluginOfficialReviewed★ 0↓ 6

Markdown Document: A single-view plugin that renders GitHub-flavored Markdown written into a panel's state as formatted React elements on the grid.

4.8 KB
1/* The document's own CSS, written by hand since the frame has no Tailwind. It reads the way the
2 answer box does: prose in the prose face, tables in the interface face with figures of one width
3 and a rule under each row, square bullets with muted markers, links underlined in the text's own
4 color. Colors are the app's theme variables, so the document follows its light and dark, each
5 with its light value as the fallback for an app from before the theme. The house style: square,
6 one grey line, muted secondary text. */
7
8.md-root {
9 position: relative;
10 height: 100%;
11 width: 100%;
12 background: var(--jaspers-background, #fff);
13 color: var(--jaspers-foreground, #171717);
14 font: 13px/1.45 var(--jaspers-font-sans, system-ui, -apple-system, sans-serif);
15}
16
17.md-scroll {
18 height: 100%;
19 overflow: auto;
20}
21
22.md-empty {
23 height: 100%;
24 display: flex;
25 align-items: center;
26 justify-content: center;
27 margin: 0;
28 color: var(--jaspers-muted-foreground, #737373);
29}
30
31.md-doc {
32 padding: 16px 20px 24px;
33 font-family: var(--jaspers-font-prose, Charter, 'Iowan Old Style', Georgia, ui-serif, serif);
34 font-size: 15px;
35 line-height: 1.55;
36 overflow-wrap: break-word;
37}
38
39/* Space above each block, none above the first in its container. */
40.md-doc :where(p, ul, ol, pre, blockquote, .md-table, .md-footnote) {
41 margin: 12px 0 0;
42}
43
44.md-doc :where(h1, h2, h3, h4, h5, h6) {
45 margin: 20px 0 0;
46 font-weight: 600;
47 line-height: 1.35;
48}
49
50.md-doc :where(*) > :first-child {
51 margin-top: 0;
52}
53
54.md-doc > :first-child {
55 margin-top: 0;
56}
57
58.md-doc h1 {
59 font-size: 22px;
60}
61
62.md-doc h2 {
63 font-size: 18px;
64}
65
66.md-doc h3 {
67 font-size: 16px;
68}
69
70.md-doc :where(h4, h5, h6) {
71 font-size: 15px;
72}
73
74/* Prose lines stay readable in a wide element; tables and code take the whole width. */
75.md-doc :where(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6, .md-footnote) {
76 max-width: 80ch;
77}
78
79/* A line break inside a paragraph stays one, as it does in the answer box. */
80.md-doc :where(p, li, th, td) {
81 white-space: pre-line;
82}
83
84.md-doc .md-html {
85 white-space: pre-wrap;
86}
87
88.md-doc ul {
89 padding-left: 20px;
90 list-style: square;
91}
92
93.md-doc ol {
94 padding-left: 24px;
95 list-style: decimal;
96}
97
98.md-doc li + li,
99.md-doc li > :where(ul, ol) {
100 margin-top: 4px;
101}
102
103.md-doc li::marker {
104 color: var(--jaspers-muted-foreground, #737373);
105}
106
107.md-doc .md-task-item {
108 list-style: none;
109}
110
111/* The box hangs where the bullet would be. */
112.md-task {
113 display: inline-block;
114 width: 1.3em;
115 margin-left: -1.3em;
116 color: var(--jaspers-muted-foreground, #737373);
117}
118
119.md-doc code {
120 padding: 0 4px;
121 background: var(--jaspers-muted, #f5f5f5);
122 font-family: var(--jaspers-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
123 font-size: 0.85em;
124}
125
126.md-doc pre {
127 padding: 8px 12px;
128 background: var(--jaspers-muted, #f5f5f5);
129 overflow-x: auto;
130 font: 13px/1.5 var(--jaspers-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
131}
132
133.md-doc pre code {
134 padding: 0;
135 background: none;
136 font-size: inherit;
137}
138
139.md-doc blockquote {
140 margin-left: 0;
141 margin-right: 0;
142 padding-left: 12px;
143 border-left: 2px solid var(--jaspers-border, #e5e5e5);
144 color: var(--jaspers-muted-foreground, #737373);
145}
146
147.md-doc hr {
148 margin: 16px 0;
149 border: 0;
150 border-top: 1px solid var(--jaspers-border, #e5e5e5);
151}
152
153.md-doc a {
154 color: inherit;
155 text-decoration: underline;
156 text-decoration-color: var(--jaspers-muted-foreground, #737373);
157 text-underline-offset: 2px;
158 cursor: pointer;
159}
160
161.md-doc a:hover {
162 text-decoration-color: var(--jaspers-foreground, #171717);
163}
164
165.md-table {
166 overflow-x: auto;
167}
168
169.md-table table {
170 border-collapse: collapse;
171 font: 14px/1.45 var(--jaspers-font-sans, system-ui, -apple-system, sans-serif);
172 font-variant-numeric: tabular-nums;
173}
174
175.md-table th,
176.md-table td {
177 padding: 6px 12px;
178 border-bottom: 1px solid var(--jaspers-border, #e5e5e5);
179 vertical-align: top;
180}
181
182.md-table th {
183 font-weight: 600;
184 text-align: left;
185}
186
187.md-table :where(th, td):first-child {
188 padding-left: 0;
189}
190
191.md-table :where(th, td):last-child {
192 padding-right: 0;
193}
194
195.md-footnote-ref {
196 color: var(--jaspers-muted-foreground, #737373);
197 font-size: 0.75em;
198}
199
200.md-footnote {
201 display: grid;
202 grid-template-columns: auto 1fr;
203 column-gap: 6px;
204 color: var(--jaspers-muted-foreground, #737373);
205 font-size: 13px;
206}
207
208/* Out of the way until the pointer is on the document. */
209.md-copy {
210 position: absolute;
211 top: 6px;
212 right: 14px;
213 padding: 2px 8px;
214 border: 1px solid var(--jaspers-border, #e5e5e5);
215 border-radius: 0;
216 background: var(--jaspers-background, #fff);
217 color: var(--jaspers-muted-foreground, #737373);
218 font: 11px/16px var(--jaspers-font-sans, system-ui, -apple-system, sans-serif);
219 cursor: pointer;
220 opacity: 0;
221 transition: opacity 120ms;
222}
223
224.md-root:hover .md-copy,
225.md-copy:focus-visible {
226 opacity: 1;
227}
228
229.md-copy:hover {
230 color: var(--jaspers-foreground, #171717);
231}