@readme/markdown 14.4.1 → 14.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Callout/style.scss +1 -0
- package/components/Image/index.tsx +14 -4
- package/components/Image/style.scss +70 -5
- package/dist/components/Image/index.d.ts +1 -0
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +92 -19
- package/dist/main.node.js +92 -19
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/tables/repair-expression-escapes.d.ts +14 -0
- package/package.json +1 -1
- package/styles/gfm.scss +62 -21
- package/types.d.ts +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RepairResult } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* mdxjs hands the contents of every `{…}` to acorn as a JavaScript expression.
|
|
4
|
+
* A bare backslash is only legal inside a string/template literal in JS, so a
|
|
5
|
+
* markdown-style escape such as `{customer\_id}` — common when authors escape an
|
|
6
|
+
* underscore out of habit — makes acorn throw "Could not parse expression with
|
|
7
|
+
* acorn", which drops parsing for the whole surrounding `<Table>`.
|
|
8
|
+
*
|
|
9
|
+
* This pass deletes backslashes that sit in JS *code* position inside a `{…}`
|
|
10
|
+
* expression. Backslashes within a '…', "…" or `…` literal are valid escapes
|
|
11
|
+
* and are left untouched. Scoped to the malformed-retry path; the happy path
|
|
12
|
+
* never runs it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const repairExpressionEscapes: (html: string) => RepairResult;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "14.
|
|
5
|
+
"version": "14.6.0",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
package/styles/gfm.scss
CHANGED
|
@@ -86,10 +86,24 @@
|
|
|
86
86
|
border-width: 0 0 1px;
|
|
87
87
|
box-sizing: content-box;
|
|
88
88
|
height: 0;
|
|
89
|
-
margin: 15px 0;
|
|
89
|
+
margin: var(--markdown-spacing, 15px) 0;
|
|
90
90
|
overflow: hidden;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// Direct-child only, top-level headings/hr act as section breaks that
|
|
94
|
+
// clear preceding floats (e.g. `<Image align="left|right">`). Nested
|
|
95
|
+
// headings (inside Callout, Cards, etc.) keep wrapping behavior so the
|
|
96
|
+
// component's own layout (e.g. callout icon float) isn't disrupted.
|
|
97
|
+
> h1,
|
|
98
|
+
> h2,
|
|
99
|
+
> h3,
|
|
100
|
+
> h4,
|
|
101
|
+
> h5,
|
|
102
|
+
> h6,
|
|
103
|
+
> hr {
|
|
104
|
+
clear: both;
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
input {
|
|
94
108
|
font: inherit;
|
|
95
109
|
margin: 0;
|
|
@@ -133,8 +147,19 @@
|
|
|
133
147
|
font-size: var(--markdown-title-size);
|
|
134
148
|
font-weight: var(--markdown-title-weight, 600);
|
|
135
149
|
line-height: 1.25;
|
|
136
|
-
margin-bottom: var(--markdown-title-marginBottom,
|
|
150
|
+
margin-bottom: var(--markdown-title-marginBottom, var(--markdown-spacing, 15px));
|
|
137
151
|
margin-top: var(--markdown-title-marginTop, 1em);
|
|
152
|
+
|
|
153
|
+
&:has(+ h1, + h2, + h3, + h4, + h5, + h6, + p) {
|
|
154
|
+
margin-bottom: calc(var(--markdown-spacing, 15px) / 2);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Tighten the gap when a heading immediately follows another heading
|
|
159
|
+
// (e.g. h1 + h2 as title/subtitle). Lets the preceding heading's margin-bottom
|
|
160
|
+
// define the gap instead of the following heading's larger margin-top.
|
|
161
|
+
:is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
|
|
162
|
+
margin-top: 0;
|
|
138
163
|
}
|
|
139
164
|
|
|
140
165
|
h1 {
|
|
@@ -245,13 +270,38 @@
|
|
|
245
270
|
|
|
246
271
|
blockquote,
|
|
247
272
|
dl,
|
|
248
|
-
ol,
|
|
249
273
|
p,
|
|
250
274
|
pre,
|
|
251
|
-
table
|
|
275
|
+
table {
|
|
276
|
+
margin-bottom: var(--markdown-spacing, 15px);
|
|
277
|
+
margin-top: 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// no margins where we’ll likely have inline images or they might break layout
|
|
281
|
+
h1,
|
|
282
|
+
h2,
|
|
283
|
+
h3,
|
|
284
|
+
h4,
|
|
285
|
+
h5,
|
|
286
|
+
h6,
|
|
287
|
+
figcaption,
|
|
288
|
+
ol,
|
|
289
|
+
ul,
|
|
290
|
+
p,
|
|
291
|
+
table {
|
|
292
|
+
--markdown-img-margin: 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
ol,
|
|
252
296
|
ul {
|
|
253
|
-
margin-bottom: 15px
|
|
297
|
+
margin-bottom: round(1.3333em, 1px); // 20px at 15px base (condensed)
|
|
254
298
|
margin-top: 0;
|
|
299
|
+
|
|
300
|
+
ol,
|
|
301
|
+
ul {
|
|
302
|
+
margin-bottom: 0;
|
|
303
|
+
margin-top: round(0.5333em, 1px); // 8px at 15px base (condensed)
|
|
304
|
+
}
|
|
255
305
|
}
|
|
256
306
|
|
|
257
307
|
blockquote {
|
|
@@ -278,14 +328,6 @@
|
|
|
278
328
|
padding-left: 2em;
|
|
279
329
|
}
|
|
280
330
|
|
|
281
|
-
ol ol,
|
|
282
|
-
ol ul,
|
|
283
|
-
ul ol,
|
|
284
|
-
ul ul {
|
|
285
|
-
margin-bottom: 0;
|
|
286
|
-
margin-top: 0;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
331
|
li {
|
|
290
332
|
clear: both;
|
|
291
333
|
word-wrap: break-all;
|
|
@@ -296,7 +338,7 @@
|
|
|
296
338
|
}
|
|
297
339
|
|
|
298
340
|
li + li {
|
|
299
|
-
margin-top: 0.
|
|
341
|
+
margin-top: round(0.5333em, 1px); // 8px at 15px base (condensed)
|
|
300
342
|
}
|
|
301
343
|
|
|
302
344
|
dl {
|
|
@@ -316,6 +358,10 @@
|
|
|
316
358
|
padding: 0 1em;
|
|
317
359
|
}
|
|
318
360
|
|
|
361
|
+
.img {
|
|
362
|
+
margin: round(calc(var(--markdown-img-margin, var(--markdown-spacing, 15px)) * 1.33), 1px) 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
319
365
|
:checked + .radio-label {
|
|
320
366
|
border-color: var(--project-color-primary);
|
|
321
367
|
position: relative;
|
|
@@ -341,19 +387,14 @@
|
|
|
341
387
|
}
|
|
342
388
|
|
|
343
389
|
@mixin markdown-overrides {
|
|
344
|
-
h5,
|
|
345
|
-
h6 {
|
|
346
|
-
font-size: 0.9em;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
390
|
blockquote h1:last-child,
|
|
350
391
|
blockquote h2:last-child {
|
|
351
392
|
border-bottom: 0;
|
|
352
393
|
}
|
|
353
394
|
|
|
354
395
|
> * {
|
|
355
|
-
margin-bottom: 15px
|
|
356
|
-
margin-top: 15px;
|
|
396
|
+
margin-bottom: var(--markdown-spacing, 15px);
|
|
397
|
+
margin-top: var(--markdown-spacing, 15px);
|
|
357
398
|
}
|
|
358
399
|
|
|
359
400
|
.task-list-item input {
|