markdown-codec 11.1.16 → 11.2.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/README.md +2 -1
- package/dist/codec.d.cts +32 -32
- package/dist/codec.d.ts +32 -32
- package/dist/emit/inline.cjs +7 -1
- package/dist/emit/inline.js +7 -1
- package/dist/lower/inline.cjs +36 -1
- package/dist/lower/inline.js +37 -2
- package/dist/shared/style-constants.cjs +5 -0
- package/dist/shared/style-constants.d.cts +2 -1
- package/dist/shared/style-constants.d.ts +2 -1
- package/dist/shared/style-constants.js +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -195,7 +195,8 @@ Every construct `src/lower`/`src/emit` cannot represent losslessly is a document
|
|
|
195
195
|
- **`md/list-marker-type-conflict`** — a nested list whose marker type disagrees with its enclosing list's minted numId keeps the enclosing type (first-wins).
|
|
196
196
|
- **`md/math-inline-preserved-as-text`** — inline `\( \)` math stays a Cambria-Math-marked raw-LaTeX run; display `$$` math is a real embedded formula carrying the presentation layer.
|
|
197
197
|
- **`md/image-unresolved`** — no resolver, `undefined` return, or non-PNG/JPEG bytes degrades to alt-text run.
|
|
198
|
-
- **`md/raw-html-preserved-as-text` / `md/raw-html-dropped`** — raw HTML kept as literal text (default) or dropped; never interpreted. The preserved text's verbatim original quarantines as markdown residue on its node, and this package's own writer re-emits that residue as-is.
|
|
198
|
+
- **`md/raw-html-preserved-as-text` / `md/raw-html-dropped`** — raw HTML kept as literal text (default) or dropped; never interpreted, except for the superscript and subscript elements in the next item. The preserved text's verbatim original quarantines as markdown residue on its node, and this package's own writer re-emits that residue as-is.
|
|
199
|
+
- **Superscripts and subscripts are written as `<sup>` and `<sub>`.** Markdown has no syntax for a raised or lowered run, so a `ContentRun` carrying `verticalAlign` is written wrapped in the inline HTML element every renderer draws that way (`m<sup>2</sup>`, `I<sub>a</sub>`), inside any emphasis or link around it. Reading recognises exactly that spelling back into the field: a bare `<sup>` or `<sub>` (any case, no attributes) closed by its own closing tag among the same inline siblings. Any other inline HTML, an unclosed `<sup>` or one carrying attributes included, is still preserved as text like the rest.
|
|
199
200
|
- **`md/front-matter-key-unmapped`** — no YAML/TOML engine; only `LayoutMetadata`'s own string/array/enum fields are recognised (every one of them except `producer`, which is PDF-writer-only), each as a flat `key: value` (or `keywords: [a, b]`) line. The verbatim original block rides the package-level residue table (`readMarkdown`'s `documentPackage.source.frontmatter`), which `writeMarkdown` re-emits as-is.
|
|
200
201
|
- **`md/heading-level-clamped`** — styleId beyond `Heading6` (from another format) clamps to level 6 via document-schema.js's shared `clampHeadingLevel()`.
|
|
201
202
|
- **`md/heading-line-break-collapsed`** — a hard or soft break embedded in a heading's own runs (most commonly a setext heading read with more than one physical line) is promoted to setext output whenever the level admits one (1 or 2) and the break's own placement is safe to promote, the only markdown grammar that can hold a genuine line break inside heading text; a level 3-6 heading with the same shape has no such fallback and always collapses the break to a single space instead, as does a level 1/2 heading whose break placement is unsafe to promote (see `md/heading-line-break-unsafe-for-setext` below).
|
package/dist/codec.d.cts
CHANGED
|
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
17
17
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
18
18
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
19
19
|
left: "left";
|
|
20
|
-
center: "center";
|
|
21
20
|
right: "right";
|
|
21
|
+
center: "center";
|
|
22
22
|
justify: "justify";
|
|
23
23
|
}>>;
|
|
24
24
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -103,9 +103,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
103
103
|
symbol: z.ZodString;
|
|
104
104
|
name: z.ZodOptional<z.ZodString>;
|
|
105
105
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
106
|
-
time: "time";
|
|
107
106
|
length: "length";
|
|
108
107
|
mass: "mass";
|
|
108
|
+
time: "time";
|
|
109
109
|
electricCurrent: "electricCurrent";
|
|
110
110
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
111
111
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
172
172
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
173
173
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
174
174
|
left: "left";
|
|
175
|
-
center: "center";
|
|
176
175
|
right: "right";
|
|
176
|
+
center: "center";
|
|
177
177
|
justify: "justify";
|
|
178
178
|
}>>;
|
|
179
179
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -258,9 +258,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
258
258
|
symbol: z.ZodString;
|
|
259
259
|
name: z.ZodOptional<z.ZodString>;
|
|
260
260
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
261
|
-
time: "time";
|
|
262
261
|
length: "length";
|
|
263
262
|
mass: "mass";
|
|
263
|
+
time: "time";
|
|
264
264
|
electricCurrent: "electricCurrent";
|
|
265
265
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
266
266
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
332
332
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
333
333
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
334
334
|
left: "left";
|
|
335
|
-
center: "center";
|
|
336
335
|
right: "right";
|
|
336
|
+
center: "center";
|
|
337
337
|
justify: "justify";
|
|
338
338
|
}>>;
|
|
339
339
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -418,9 +418,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
418
418
|
symbol: z.ZodString;
|
|
419
419
|
name: z.ZodOptional<z.ZodString>;
|
|
420
420
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
421
|
-
time: "time";
|
|
422
421
|
length: "length";
|
|
423
422
|
mass: "mass";
|
|
423
|
+
time: "time";
|
|
424
424
|
electricCurrent: "electricCurrent";
|
|
425
425
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
426
426
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
487
487
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
488
488
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
489
489
|
left: "left";
|
|
490
|
-
center: "center";
|
|
491
490
|
right: "right";
|
|
491
|
+
center: "center";
|
|
492
492
|
justify: "justify";
|
|
493
493
|
}>>;
|
|
494
494
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -573,9 +573,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
573
573
|
symbol: z.ZodString;
|
|
574
574
|
name: z.ZodOptional<z.ZodString>;
|
|
575
575
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
576
|
-
time: "time";
|
|
577
576
|
length: "length";
|
|
578
577
|
mass: "mass";
|
|
578
|
+
time: "time";
|
|
579
579
|
electricCurrent: "electricCurrent";
|
|
580
580
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
581
581
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
701
701
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
702
702
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
703
703
|
left: "left";
|
|
704
|
-
center: "center";
|
|
705
704
|
right: "right";
|
|
705
|
+
center: "center";
|
|
706
706
|
justify: "justify";
|
|
707
707
|
}>>;
|
|
708
708
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -787,9 +787,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
787
787
|
symbol: z.ZodString;
|
|
788
788
|
name: z.ZodOptional<z.ZodString>;
|
|
789
789
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
790
|
-
time: "time";
|
|
791
790
|
length: "length";
|
|
792
791
|
mass: "mass";
|
|
792
|
+
time: "time";
|
|
793
793
|
electricCurrent: "electricCurrent";
|
|
794
794
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
795
795
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -937,9 +937,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
937
937
|
symbol: z.ZodString;
|
|
938
938
|
name: z.ZodOptional<z.ZodString>;
|
|
939
939
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
940
|
-
time: "time";
|
|
941
940
|
length: "length";
|
|
942
941
|
mass: "mass";
|
|
942
|
+
time: "time";
|
|
943
943
|
electricCurrent: "electricCurrent";
|
|
944
944
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
945
945
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1133,9 +1133,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1133
1133
|
symbol: z.ZodString;
|
|
1134
1134
|
name: z.ZodOptional<z.ZodString>;
|
|
1135
1135
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1136
|
-
time: "time";
|
|
1137
1136
|
length: "length";
|
|
1138
1137
|
mass: "mass";
|
|
1138
|
+
time: "time";
|
|
1139
1139
|
electricCurrent: "electricCurrent";
|
|
1140
1140
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1141
1141
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1538
1538
|
}, z.core.$strip>>;
|
|
1539
1539
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1540
1540
|
left: "left";
|
|
1541
|
-
center: "center";
|
|
1542
1541
|
right: "right";
|
|
1542
|
+
center: "center";
|
|
1543
1543
|
justify: "justify";
|
|
1544
1544
|
}>>;
|
|
1545
1545
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1648,8 +1648,6 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1648
1648
|
floatPosition: z.ZodOptional<z.ZodObject<{
|
|
1649
1649
|
horizontal: z.ZodUnion<readonly [z.ZodObject<{
|
|
1650
1650
|
relativeTo: z.ZodEnum<{
|
|
1651
|
-
paragraph: "paragraph";
|
|
1652
|
-
frame: "frame";
|
|
1653
1651
|
page: "page";
|
|
1654
1652
|
margin: "margin";
|
|
1655
1653
|
leftMargin: "leftMargin";
|
|
@@ -1660,13 +1658,13 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1660
1658
|
outsideMargin: "outsideMargin";
|
|
1661
1659
|
column: "column";
|
|
1662
1660
|
character: "character";
|
|
1661
|
+
paragraph: "paragraph";
|
|
1663
1662
|
line: "line";
|
|
1663
|
+
frame: "frame";
|
|
1664
1664
|
}>;
|
|
1665
1665
|
offsetPt: z.ZodNumber;
|
|
1666
1666
|
}, z.core.$strict>, z.ZodObject<{
|
|
1667
1667
|
relativeTo: z.ZodEnum<{
|
|
1668
|
-
paragraph: "paragraph";
|
|
1669
|
-
frame: "frame";
|
|
1670
1668
|
page: "page";
|
|
1671
1669
|
margin: "margin";
|
|
1672
1670
|
leftMargin: "leftMargin";
|
|
@@ -1677,22 +1675,22 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1677
1675
|
outsideMargin: "outsideMargin";
|
|
1678
1676
|
column: "column";
|
|
1679
1677
|
character: "character";
|
|
1678
|
+
paragraph: "paragraph";
|
|
1680
1679
|
line: "line";
|
|
1680
|
+
frame: "frame";
|
|
1681
1681
|
}>;
|
|
1682
1682
|
align: z.ZodEnum<{
|
|
1683
1683
|
left: "left";
|
|
1684
|
-
center: "center";
|
|
1685
1684
|
right: "right";
|
|
1686
1685
|
top: "top";
|
|
1687
1686
|
bottom: "bottom";
|
|
1687
|
+
center: "center";
|
|
1688
1688
|
inside: "inside";
|
|
1689
1689
|
outside: "outside";
|
|
1690
1690
|
}>;
|
|
1691
1691
|
}, z.core.$strict>]>;
|
|
1692
1692
|
vertical: z.ZodUnion<readonly [z.ZodObject<{
|
|
1693
1693
|
relativeTo: z.ZodEnum<{
|
|
1694
|
-
paragraph: "paragraph";
|
|
1695
|
-
frame: "frame";
|
|
1696
1694
|
page: "page";
|
|
1697
1695
|
margin: "margin";
|
|
1698
1696
|
leftMargin: "leftMargin";
|
|
@@ -1703,13 +1701,13 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1703
1701
|
outsideMargin: "outsideMargin";
|
|
1704
1702
|
column: "column";
|
|
1705
1703
|
character: "character";
|
|
1704
|
+
paragraph: "paragraph";
|
|
1706
1705
|
line: "line";
|
|
1706
|
+
frame: "frame";
|
|
1707
1707
|
}>;
|
|
1708
1708
|
offsetPt: z.ZodNumber;
|
|
1709
1709
|
}, z.core.$strict>, z.ZodObject<{
|
|
1710
1710
|
relativeTo: z.ZodEnum<{
|
|
1711
|
-
paragraph: "paragraph";
|
|
1712
|
-
frame: "frame";
|
|
1713
1711
|
page: "page";
|
|
1714
1712
|
margin: "margin";
|
|
1715
1713
|
leftMargin: "leftMargin";
|
|
@@ -1720,14 +1718,16 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1720
1718
|
outsideMargin: "outsideMargin";
|
|
1721
1719
|
column: "column";
|
|
1722
1720
|
character: "character";
|
|
1721
|
+
paragraph: "paragraph";
|
|
1723
1722
|
line: "line";
|
|
1723
|
+
frame: "frame";
|
|
1724
1724
|
}>;
|
|
1725
1725
|
align: z.ZodEnum<{
|
|
1726
1726
|
left: "left";
|
|
1727
|
-
center: "center";
|
|
1728
1727
|
right: "right";
|
|
1729
1728
|
top: "top";
|
|
1730
1729
|
bottom: "bottom";
|
|
1730
|
+
center: "center";
|
|
1731
1731
|
inside: "inside";
|
|
1732
1732
|
outside: "outside";
|
|
1733
1733
|
}>;
|
|
@@ -1816,11 +1816,11 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1816
1816
|
endColumn: z.ZodNumber;
|
|
1817
1817
|
}, z.core.$strip>>;
|
|
1818
1818
|
type: z.ZodEnum<{
|
|
1819
|
-
decimal: "decimal";
|
|
1820
|
-
list: "list";
|
|
1821
1819
|
date: "date";
|
|
1822
1820
|
custom: "custom";
|
|
1823
1821
|
time: "time";
|
|
1822
|
+
decimal: "decimal";
|
|
1823
|
+
list: "list";
|
|
1824
1824
|
whole: "whole";
|
|
1825
1825
|
textLength: "textLength";
|
|
1826
1826
|
}>;
|
|
@@ -2292,8 +2292,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2292
2292
|
value: z.ZodObject<{
|
|
2293
2293
|
type: z.ZodEnum<{
|
|
2294
2294
|
formula: "formula";
|
|
2295
|
-
num: "num";
|
|
2296
2295
|
percent: "percent";
|
|
2296
|
+
num: "num";
|
|
2297
2297
|
max: "max";
|
|
2298
2298
|
min: "min";
|
|
2299
2299
|
percentile: "percentile";
|
|
@@ -2339,8 +2339,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2339
2339
|
min: z.ZodObject<{
|
|
2340
2340
|
type: z.ZodEnum<{
|
|
2341
2341
|
formula: "formula";
|
|
2342
|
-
num: "num";
|
|
2343
2342
|
percent: "percent";
|
|
2343
|
+
num: "num";
|
|
2344
2344
|
max: "max";
|
|
2345
2345
|
min: "min";
|
|
2346
2346
|
percentile: "percentile";
|
|
@@ -2350,8 +2350,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2350
2350
|
max: z.ZodObject<{
|
|
2351
2351
|
type: z.ZodEnum<{
|
|
2352
2352
|
formula: "formula";
|
|
2353
|
-
num: "num";
|
|
2354
2353
|
percent: "percent";
|
|
2354
|
+
num: "num";
|
|
2355
2355
|
max: "max";
|
|
2356
2356
|
min: "min";
|
|
2357
2357
|
percentile: "percentile";
|
|
@@ -2398,8 +2398,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2398
2398
|
thresholds: z.ZodArray<z.ZodObject<{
|
|
2399
2399
|
type: z.ZodEnum<{
|
|
2400
2400
|
formula: "formula";
|
|
2401
|
-
num: "num";
|
|
2402
2401
|
percent: "percent";
|
|
2402
|
+
num: "num";
|
|
2403
2403
|
max: "max";
|
|
2404
2404
|
min: "min";
|
|
2405
2405
|
percentile: "percentile";
|
|
@@ -2478,9 +2478,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2478
2478
|
symbol: z.ZodString;
|
|
2479
2479
|
name: z.ZodOptional<z.ZodString>;
|
|
2480
2480
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
2481
|
-
time: "time";
|
|
2482
2481
|
length: "length";
|
|
2483
2482
|
mass: "mass";
|
|
2483
|
+
time: "time";
|
|
2484
2484
|
electricCurrent: "electricCurrent";
|
|
2485
2485
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
2486
2486
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -3208,9 +3208,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
3208
3208
|
symbol: z.ZodString;
|
|
3209
3209
|
name: z.ZodOptional<z.ZodString>;
|
|
3210
3210
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
3211
|
-
time: "time";
|
|
3212
3211
|
length: "length";
|
|
3213
3212
|
mass: "mass";
|
|
3213
|
+
time: "time";
|
|
3214
3214
|
electricCurrent: "electricCurrent";
|
|
3215
3215
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
3216
3216
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -3336,9 +3336,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
3336
3336
|
symbol: z.ZodString;
|
|
3337
3337
|
name: z.ZodOptional<z.ZodString>;
|
|
3338
3338
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
3339
|
-
time: "time";
|
|
3340
3339
|
length: "length";
|
|
3341
3340
|
mass: "mass";
|
|
3341
|
+
time: "time";
|
|
3342
3342
|
electricCurrent: "electricCurrent";
|
|
3343
3343
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
3344
3344
|
amountOfSubstance: "amountOfSubstance";
|
package/dist/codec.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
17
17
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
18
18
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
19
19
|
left: "left";
|
|
20
|
-
center: "center";
|
|
21
20
|
right: "right";
|
|
21
|
+
center: "center";
|
|
22
22
|
justify: "justify";
|
|
23
23
|
}>>;
|
|
24
24
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -103,9 +103,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
103
103
|
symbol: z.ZodString;
|
|
104
104
|
name: z.ZodOptional<z.ZodString>;
|
|
105
105
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
106
|
-
time: "time";
|
|
107
106
|
length: "length";
|
|
108
107
|
mass: "mass";
|
|
108
|
+
time: "time";
|
|
109
109
|
electricCurrent: "electricCurrent";
|
|
110
110
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
111
111
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -172,8 +172,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
172
172
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
173
173
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
174
174
|
left: "left";
|
|
175
|
-
center: "center";
|
|
176
175
|
right: "right";
|
|
176
|
+
center: "center";
|
|
177
177
|
justify: "justify";
|
|
178
178
|
}>>;
|
|
179
179
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -258,9 +258,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
258
258
|
symbol: z.ZodString;
|
|
259
259
|
name: z.ZodOptional<z.ZodString>;
|
|
260
260
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
261
|
-
time: "time";
|
|
262
261
|
length: "length";
|
|
263
262
|
mass: "mass";
|
|
263
|
+
time: "time";
|
|
264
264
|
electricCurrent: "electricCurrent";
|
|
265
265
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
266
266
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -332,8 +332,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
332
332
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
333
333
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
334
334
|
left: "left";
|
|
335
|
-
center: "center";
|
|
336
335
|
right: "right";
|
|
336
|
+
center: "center";
|
|
337
337
|
justify: "justify";
|
|
338
338
|
}>>;
|
|
339
339
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -418,9 +418,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
418
418
|
symbol: z.ZodString;
|
|
419
419
|
name: z.ZodOptional<z.ZodString>;
|
|
420
420
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
421
|
-
time: "time";
|
|
422
421
|
length: "length";
|
|
423
422
|
mass: "mass";
|
|
423
|
+
time: "time";
|
|
424
424
|
electricCurrent: "electricCurrent";
|
|
425
425
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
426
426
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -487,8 +487,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
487
487
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
488
488
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
489
489
|
left: "left";
|
|
490
|
-
center: "center";
|
|
491
490
|
right: "right";
|
|
491
|
+
center: "center";
|
|
492
492
|
justify: "justify";
|
|
493
493
|
}>>;
|
|
494
494
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -573,9 +573,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
573
573
|
symbol: z.ZodString;
|
|
574
574
|
name: z.ZodOptional<z.ZodString>;
|
|
575
575
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
576
|
-
time: "time";
|
|
577
576
|
length: "length";
|
|
578
577
|
mass: "mass";
|
|
578
|
+
time: "time";
|
|
579
579
|
electricCurrent: "electricCurrent";
|
|
580
580
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
581
581
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -701,8 +701,8 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
701
701
|
paragraph: z.ZodOptional<z.ZodObject<{
|
|
702
702
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
703
703
|
left: "left";
|
|
704
|
-
center: "center";
|
|
705
704
|
right: "right";
|
|
705
|
+
center: "center";
|
|
706
706
|
justify: "justify";
|
|
707
707
|
}>>;
|
|
708
708
|
list: z.ZodOptional<z.ZodObject<{
|
|
@@ -787,9 +787,9 @@ declare const markdownCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uin
|
|
|
787
787
|
symbol: z.ZodString;
|
|
788
788
|
name: z.ZodOptional<z.ZodString>;
|
|
789
789
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
790
|
-
time: "time";
|
|
791
790
|
length: "length";
|
|
792
791
|
mass: "mass";
|
|
792
|
+
time: "time";
|
|
793
793
|
electricCurrent: "electricCurrent";
|
|
794
794
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
795
795
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -937,9 +937,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
937
937
|
symbol: z.ZodString;
|
|
938
938
|
name: z.ZodOptional<z.ZodString>;
|
|
939
939
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
940
|
-
time: "time";
|
|
941
940
|
length: "length";
|
|
942
941
|
mass: "mass";
|
|
942
|
+
time: "time";
|
|
943
943
|
electricCurrent: "electricCurrent";
|
|
944
944
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
945
945
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1133,9 +1133,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1133
1133
|
symbol: z.ZodString;
|
|
1134
1134
|
name: z.ZodOptional<z.ZodString>;
|
|
1135
1135
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
1136
|
-
time: "time";
|
|
1137
1136
|
length: "length";
|
|
1138
1137
|
mass: "mass";
|
|
1138
|
+
time: "time";
|
|
1139
1139
|
electricCurrent: "electricCurrent";
|
|
1140
1140
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
1141
1141
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -1538,8 +1538,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1538
1538
|
}, z.core.$strip>>;
|
|
1539
1539
|
alignment: z.ZodOptional<z.ZodEnum<{
|
|
1540
1540
|
left: "left";
|
|
1541
|
-
center: "center";
|
|
1542
1541
|
right: "right";
|
|
1542
|
+
center: "center";
|
|
1543
1543
|
justify: "justify";
|
|
1544
1544
|
}>>;
|
|
1545
1545
|
verticalAlignment: z.ZodOptional<z.ZodEnum<{
|
|
@@ -1648,8 +1648,6 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1648
1648
|
floatPosition: z.ZodOptional<z.ZodObject<{
|
|
1649
1649
|
horizontal: z.ZodUnion<readonly [z.ZodObject<{
|
|
1650
1650
|
relativeTo: z.ZodEnum<{
|
|
1651
|
-
paragraph: "paragraph";
|
|
1652
|
-
frame: "frame";
|
|
1653
1651
|
page: "page";
|
|
1654
1652
|
margin: "margin";
|
|
1655
1653
|
leftMargin: "leftMargin";
|
|
@@ -1660,13 +1658,13 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1660
1658
|
outsideMargin: "outsideMargin";
|
|
1661
1659
|
column: "column";
|
|
1662
1660
|
character: "character";
|
|
1661
|
+
paragraph: "paragraph";
|
|
1663
1662
|
line: "line";
|
|
1663
|
+
frame: "frame";
|
|
1664
1664
|
}>;
|
|
1665
1665
|
offsetPt: z.ZodNumber;
|
|
1666
1666
|
}, z.core.$strict>, z.ZodObject<{
|
|
1667
1667
|
relativeTo: z.ZodEnum<{
|
|
1668
|
-
paragraph: "paragraph";
|
|
1669
|
-
frame: "frame";
|
|
1670
1668
|
page: "page";
|
|
1671
1669
|
margin: "margin";
|
|
1672
1670
|
leftMargin: "leftMargin";
|
|
@@ -1677,22 +1675,22 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1677
1675
|
outsideMargin: "outsideMargin";
|
|
1678
1676
|
column: "column";
|
|
1679
1677
|
character: "character";
|
|
1678
|
+
paragraph: "paragraph";
|
|
1680
1679
|
line: "line";
|
|
1680
|
+
frame: "frame";
|
|
1681
1681
|
}>;
|
|
1682
1682
|
align: z.ZodEnum<{
|
|
1683
1683
|
left: "left";
|
|
1684
|
-
center: "center";
|
|
1685
1684
|
right: "right";
|
|
1686
1685
|
top: "top";
|
|
1687
1686
|
bottom: "bottom";
|
|
1687
|
+
center: "center";
|
|
1688
1688
|
inside: "inside";
|
|
1689
1689
|
outside: "outside";
|
|
1690
1690
|
}>;
|
|
1691
1691
|
}, z.core.$strict>]>;
|
|
1692
1692
|
vertical: z.ZodUnion<readonly [z.ZodObject<{
|
|
1693
1693
|
relativeTo: z.ZodEnum<{
|
|
1694
|
-
paragraph: "paragraph";
|
|
1695
|
-
frame: "frame";
|
|
1696
1694
|
page: "page";
|
|
1697
1695
|
margin: "margin";
|
|
1698
1696
|
leftMargin: "leftMargin";
|
|
@@ -1703,13 +1701,13 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1703
1701
|
outsideMargin: "outsideMargin";
|
|
1704
1702
|
column: "column";
|
|
1705
1703
|
character: "character";
|
|
1704
|
+
paragraph: "paragraph";
|
|
1706
1705
|
line: "line";
|
|
1706
|
+
frame: "frame";
|
|
1707
1707
|
}>;
|
|
1708
1708
|
offsetPt: z.ZodNumber;
|
|
1709
1709
|
}, z.core.$strict>, z.ZodObject<{
|
|
1710
1710
|
relativeTo: z.ZodEnum<{
|
|
1711
|
-
paragraph: "paragraph";
|
|
1712
|
-
frame: "frame";
|
|
1713
1711
|
page: "page";
|
|
1714
1712
|
margin: "margin";
|
|
1715
1713
|
leftMargin: "leftMargin";
|
|
@@ -1720,14 +1718,16 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1720
1718
|
outsideMargin: "outsideMargin";
|
|
1721
1719
|
column: "column";
|
|
1722
1720
|
character: "character";
|
|
1721
|
+
paragraph: "paragraph";
|
|
1723
1722
|
line: "line";
|
|
1723
|
+
frame: "frame";
|
|
1724
1724
|
}>;
|
|
1725
1725
|
align: z.ZodEnum<{
|
|
1726
1726
|
left: "left";
|
|
1727
|
-
center: "center";
|
|
1728
1727
|
right: "right";
|
|
1729
1728
|
top: "top";
|
|
1730
1729
|
bottom: "bottom";
|
|
1730
|
+
center: "center";
|
|
1731
1731
|
inside: "inside";
|
|
1732
1732
|
outside: "outside";
|
|
1733
1733
|
}>;
|
|
@@ -1816,11 +1816,11 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
1816
1816
|
endColumn: z.ZodNumber;
|
|
1817
1817
|
}, z.core.$strip>>;
|
|
1818
1818
|
type: z.ZodEnum<{
|
|
1819
|
-
decimal: "decimal";
|
|
1820
|
-
list: "list";
|
|
1821
1819
|
date: "date";
|
|
1822
1820
|
custom: "custom";
|
|
1823
1821
|
time: "time";
|
|
1822
|
+
decimal: "decimal";
|
|
1823
|
+
list: "list";
|
|
1824
1824
|
whole: "whole";
|
|
1825
1825
|
textLength: "textLength";
|
|
1826
1826
|
}>;
|
|
@@ -2292,8 +2292,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2292
2292
|
value: z.ZodObject<{
|
|
2293
2293
|
type: z.ZodEnum<{
|
|
2294
2294
|
formula: "formula";
|
|
2295
|
-
num: "num";
|
|
2296
2295
|
percent: "percent";
|
|
2296
|
+
num: "num";
|
|
2297
2297
|
max: "max";
|
|
2298
2298
|
min: "min";
|
|
2299
2299
|
percentile: "percentile";
|
|
@@ -2339,8 +2339,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2339
2339
|
min: z.ZodObject<{
|
|
2340
2340
|
type: z.ZodEnum<{
|
|
2341
2341
|
formula: "formula";
|
|
2342
|
-
num: "num";
|
|
2343
2342
|
percent: "percent";
|
|
2343
|
+
num: "num";
|
|
2344
2344
|
max: "max";
|
|
2345
2345
|
min: "min";
|
|
2346
2346
|
percentile: "percentile";
|
|
@@ -2350,8 +2350,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2350
2350
|
max: z.ZodObject<{
|
|
2351
2351
|
type: z.ZodEnum<{
|
|
2352
2352
|
formula: "formula";
|
|
2353
|
-
num: "num";
|
|
2354
2353
|
percent: "percent";
|
|
2354
|
+
num: "num";
|
|
2355
2355
|
max: "max";
|
|
2356
2356
|
min: "min";
|
|
2357
2357
|
percentile: "percentile";
|
|
@@ -2398,8 +2398,8 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2398
2398
|
thresholds: z.ZodArray<z.ZodObject<{
|
|
2399
2399
|
type: z.ZodEnum<{
|
|
2400
2400
|
formula: "formula";
|
|
2401
|
-
num: "num";
|
|
2402
2401
|
percent: "percent";
|
|
2402
|
+
num: "num";
|
|
2403
2403
|
max: "max";
|
|
2404
2404
|
min: "min";
|
|
2405
2405
|
percentile: "percentile";
|
|
@@ -2478,9 +2478,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
2478
2478
|
symbol: z.ZodString;
|
|
2479
2479
|
name: z.ZodOptional<z.ZodString>;
|
|
2480
2480
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
2481
|
-
time: "time";
|
|
2482
2481
|
length: "length";
|
|
2483
2482
|
mass: "mass";
|
|
2483
|
+
time: "time";
|
|
2484
2484
|
electricCurrent: "electricCurrent";
|
|
2485
2485
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
2486
2486
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -3208,9 +3208,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
3208
3208
|
symbol: z.ZodString;
|
|
3209
3209
|
name: z.ZodOptional<z.ZodString>;
|
|
3210
3210
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
3211
|
-
time: "time";
|
|
3212
3211
|
length: "length";
|
|
3213
3212
|
mass: "mass";
|
|
3213
|
+
time: "time";
|
|
3214
3214
|
electricCurrent: "electricCurrent";
|
|
3215
3215
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
3216
3216
|
amountOfSubstance: "amountOfSubstance";
|
|
@@ -3336,9 +3336,9 @@ declare const markdownContentCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffe
|
|
|
3336
3336
|
symbol: z.ZodString;
|
|
3337
3337
|
name: z.ZodOptional<z.ZodString>;
|
|
3338
3338
|
dimension: z.ZodRecord<z.ZodEnum<{
|
|
3339
|
-
time: "time";
|
|
3340
3339
|
length: "length";
|
|
3341
3340
|
mass: "mass";
|
|
3341
|
+
time: "time";
|
|
3342
3342
|
electricCurrent: "electricCurrent";
|
|
3343
3343
|
thermodynamicTemperature: "thermodynamicTemperature";
|
|
3344
3344
|
amountOfSubstance: "amountOfSubstance";
|
package/dist/emit/inline.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_diagnostics_diagnostics = require("../diagnostics/diagnostics.cjs");
|
|
3
3
|
const require_inline_footnote = require("../inline/footnote.cjs");
|
|
4
4
|
const require_shared_line_ending = require("../shared/line-ending.cjs");
|
|
5
|
-
require("../shared/style-constants.cjs");
|
|
5
|
+
const require_shared_style_constants = require("../shared/style-constants.cjs");
|
|
6
6
|
//#region src/emit/inline.ts
|
|
7
7
|
const ESCAPE_CHARS = /* @__PURE__ */ new Set([
|
|
8
8
|
"!",
|
|
@@ -74,6 +74,12 @@ function footnoteReferenceAt(constructs, index) {
|
|
|
74
74
|
}
|
|
75
75
|
function renderLeaf(run, context, index, constructs) {
|
|
76
76
|
if (run.source?.format === "markdown") return run.source.xml;
|
|
77
|
+
const body = renderLeafBody(run, context, index, constructs);
|
|
78
|
+
if (run.verticalAlign === void 0) return body;
|
|
79
|
+
const tag = require_shared_style_constants.VERTICAL_ALIGN_TAG[run.verticalAlign];
|
|
80
|
+
return `<${tag}>${body}</${tag}>`;
|
|
81
|
+
}
|
|
82
|
+
function renderLeafBody(run, context, index, constructs) {
|
|
77
83
|
if (run.fontFamily === "Courier New") {
|
|
78
84
|
context.sink({
|
|
79
85
|
code: require_diagnostics_diagnostics.MarkdownDiagnosticCodes.CODE_SPAN_AS_MONOSPACE_RUN,
|
package/dist/emit/inline.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
|
|
2
2
|
import { isValidFootnoteLabel } from "../inline/footnote.js";
|
|
3
3
|
import { ESCAPED_HARD_BREAK_PATTERN, LINE_ENDING_PATTERN } from "../shared/line-ending.js";
|
|
4
|
-
import "../shared/style-constants.js";
|
|
4
|
+
import { VERTICAL_ALIGN_TAG } from "../shared/style-constants.js";
|
|
5
5
|
//#region src/emit/inline.ts
|
|
6
6
|
const ESCAPE_CHARS = /* @__PURE__ */ new Set([
|
|
7
7
|
"!",
|
|
@@ -73,6 +73,12 @@ function footnoteReferenceAt(constructs, index) {
|
|
|
73
73
|
}
|
|
74
74
|
function renderLeaf(run, context, index, constructs) {
|
|
75
75
|
if (run.source?.format === "markdown") return run.source.xml;
|
|
76
|
+
const body = renderLeafBody(run, context, index, constructs);
|
|
77
|
+
if (run.verticalAlign === void 0) return body;
|
|
78
|
+
const tag = VERTICAL_ALIGN_TAG[run.verticalAlign];
|
|
79
|
+
return `<${tag}>${body}</${tag}>`;
|
|
80
|
+
}
|
|
81
|
+
function renderLeafBody(run, context, index, constructs) {
|
|
76
82
|
if (run.fontFamily === "Courier New") {
|
|
77
83
|
context.sink({
|
|
78
84
|
code: MarkdownDiagnosticCodes.CODE_SPAN_AS_MONOSPACE_RUN,
|
package/dist/lower/inline.cjs
CHANGED
|
@@ -9,6 +9,7 @@ function buildRun(text, style, fontFamily) {
|
|
|
9
9
|
...style.italic === true ? { italic: true } : {},
|
|
10
10
|
...style.strike === true ? { strike: true } : {},
|
|
11
11
|
...style.hyperlink !== void 0 ? { hyperlink: style.hyperlink } : {},
|
|
12
|
+
...style.verticalAlign !== void 0 ? { verticalAlign: style.verticalAlign } : {},
|
|
12
13
|
...fontFamily !== void 0 ? { fontFamily } : {}
|
|
13
14
|
};
|
|
14
15
|
}
|
|
@@ -139,8 +140,42 @@ function lowerInlineNodeInto(node, style, context, acc) {
|
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
143
|
+
function scriptTag(node) {
|
|
144
|
+
if (node.type !== "rawHtml") return;
|
|
145
|
+
const match = /^<(\/?)(sup|sub)>$/i.exec(node.literal);
|
|
146
|
+
if (match === null) return;
|
|
147
|
+
return {
|
|
148
|
+
position: match[2]?.toLowerCase() === require_shared_style_constants.VERTICAL_ALIGN_TAG.superscript ? "superscript" : "subscript",
|
|
149
|
+
closing: match[1] === "/"
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function closingScriptTagIndex(nodes, open, position) {
|
|
153
|
+
let depth = 0;
|
|
154
|
+
for (let index = open + 1; index < nodes.length; index++) {
|
|
155
|
+
const tag = scriptTag(nodes[index]);
|
|
156
|
+
if (tag?.position !== position) continue;
|
|
157
|
+
if (!tag.closing) depth += 1;
|
|
158
|
+
else if (depth === 0) return index;
|
|
159
|
+
else depth -= 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
142
162
|
function lowerNodesInto(nodes, style, context, acc) {
|
|
143
|
-
|
|
163
|
+
let index = 0;
|
|
164
|
+
while (index < nodes.length) {
|
|
165
|
+
const node = nodes[index];
|
|
166
|
+
const tag = scriptTag(node);
|
|
167
|
+
const close = tag === void 0 || tag.closing ? void 0 : closingScriptTagIndex(nodes, index, tag.position);
|
|
168
|
+
if (tag !== void 0 && close !== void 0) {
|
|
169
|
+
lowerNodesInto(nodes.slice(index + 1, close), {
|
|
170
|
+
...style,
|
|
171
|
+
verticalAlign: tag.position
|
|
172
|
+
}, context, acc);
|
|
173
|
+
index = close + 1;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
lowerInlineNodeInto(node, style, context, acc);
|
|
177
|
+
index += 1;
|
|
178
|
+
}
|
|
144
179
|
}
|
|
145
180
|
function lowerInlineNodes(nodes, context) {
|
|
146
181
|
const acc = {
|
package/dist/lower/inline.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MarkdownDiagnosticCodes } from "../diagnostics/diagnostics.js";
|
|
2
|
-
import { MATH_INLINE_FONT_MARKER, MONOSPACE_FONT_FAMILY } from "../shared/style-constants.js";
|
|
2
|
+
import { MATH_INLINE_FONT_MARKER, MONOSPACE_FONT_FAMILY, VERTICAL_ALIGN_TAG } from "../shared/style-constants.js";
|
|
3
3
|
//#region src/lower/inline.ts
|
|
4
4
|
function buildRun(text, style, fontFamily) {
|
|
5
5
|
return {
|
|
@@ -8,6 +8,7 @@ function buildRun(text, style, fontFamily) {
|
|
|
8
8
|
...style.italic === true ? { italic: true } : {},
|
|
9
9
|
...style.strike === true ? { strike: true } : {},
|
|
10
10
|
...style.hyperlink !== void 0 ? { hyperlink: style.hyperlink } : {},
|
|
11
|
+
...style.verticalAlign !== void 0 ? { verticalAlign: style.verticalAlign } : {},
|
|
11
12
|
...fontFamily !== void 0 ? { fontFamily } : {}
|
|
12
13
|
};
|
|
13
14
|
}
|
|
@@ -138,8 +139,42 @@ function lowerInlineNodeInto(node, style, context, acc) {
|
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
}
|
|
142
|
+
function scriptTag(node) {
|
|
143
|
+
if (node.type !== "rawHtml") return;
|
|
144
|
+
const match = /^<(\/?)(sup|sub)>$/i.exec(node.literal);
|
|
145
|
+
if (match === null) return;
|
|
146
|
+
return {
|
|
147
|
+
position: match[2]?.toLowerCase() === VERTICAL_ALIGN_TAG.superscript ? "superscript" : "subscript",
|
|
148
|
+
closing: match[1] === "/"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function closingScriptTagIndex(nodes, open, position) {
|
|
152
|
+
let depth = 0;
|
|
153
|
+
for (let index = open + 1; index < nodes.length; index++) {
|
|
154
|
+
const tag = scriptTag(nodes[index]);
|
|
155
|
+
if (tag?.position !== position) continue;
|
|
156
|
+
if (!tag.closing) depth += 1;
|
|
157
|
+
else if (depth === 0) return index;
|
|
158
|
+
else depth -= 1;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
141
161
|
function lowerNodesInto(nodes, style, context, acc) {
|
|
142
|
-
|
|
162
|
+
let index = 0;
|
|
163
|
+
while (index < nodes.length) {
|
|
164
|
+
const node = nodes[index];
|
|
165
|
+
const tag = scriptTag(node);
|
|
166
|
+
const close = tag === void 0 || tag.closing ? void 0 : closingScriptTagIndex(nodes, index, tag.position);
|
|
167
|
+
if (tag !== void 0 && close !== void 0) {
|
|
168
|
+
lowerNodesInto(nodes.slice(index + 1, close), {
|
|
169
|
+
...style,
|
|
170
|
+
verticalAlign: tag.position
|
|
171
|
+
}, context, acc);
|
|
172
|
+
index = close + 1;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
lowerInlineNodeInto(node, style, context, acc);
|
|
176
|
+
index += 1;
|
|
177
|
+
}
|
|
143
178
|
}
|
|
144
179
|
function lowerInlineNodes(nodes, context) {
|
|
145
180
|
const acc = {
|
|
@@ -22,6 +22,10 @@ const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
|
22
22
|
const QUOTE_INDENT_PT = 36;
|
|
23
23
|
const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
24
24
|
const TASK_CHECKBOX_CHECKED = "☒";
|
|
25
|
+
const VERTICAL_ALIGN_TAG = {
|
|
26
|
+
superscript: "sup",
|
|
27
|
+
subscript: "sub"
|
|
28
|
+
};
|
|
25
29
|
//#endregion
|
|
26
30
|
exports.CODE_BLOCK_STYLE_ID = CODE_BLOCK_STYLE_ID;
|
|
27
31
|
exports.HORIZONTAL_RULE_STYLE_ID = HORIZONTAL_RULE_STYLE_ID;
|
|
@@ -34,5 +38,6 @@ exports.QUOTE_INDENT_PT = QUOTE_INDENT_PT;
|
|
|
34
38
|
exports.QUOTE_STYLE_ID = QUOTE_STYLE_ID;
|
|
35
39
|
exports.TASK_CHECKBOX_CHECKED = TASK_CHECKBOX_CHECKED;
|
|
36
40
|
exports.TASK_CHECKBOX_UNCHECKED = TASK_CHECKBOX_UNCHECKED;
|
|
41
|
+
exports.VERTICAL_ALIGN_TAG = VERTICAL_ALIGN_TAG;
|
|
37
42
|
exports.headingStyleId = headingStyleId;
|
|
38
43
|
exports.parseHeadingStyleId = parseHeadingStyleId;
|
|
@@ -12,5 +12,6 @@ declare const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
|
12
12
|
declare const QUOTE_INDENT_PT = 36;
|
|
13
13
|
declare const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
14
14
|
declare const TASK_CHECKBOX_CHECKED = "☒";
|
|
15
|
+
declare const VERTICAL_ALIGN_TAG: Readonly<Record<"superscript" | "subscript", "sup" | "sub">>;
|
|
15
16
|
//#endregion
|
|
16
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
17
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, VERTICAL_ALIGN_TAG, headingStyleId, parseHeadingStyleId };
|
|
@@ -12,5 +12,6 @@ declare const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
|
12
12
|
declare const QUOTE_INDENT_PT = 36;
|
|
13
13
|
declare const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
14
14
|
declare const TASK_CHECKBOX_CHECKED = "☒";
|
|
15
|
+
declare const VERTICAL_ALIGN_TAG: Readonly<Record<"superscript" | "subscript", "sup" | "sub">>;
|
|
15
16
|
//#endregion
|
|
16
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
17
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, VERTICAL_ALIGN_TAG, headingStyleId, parseHeadingStyleId };
|
|
@@ -21,5 +21,9 @@ const MATH_INLINE_FONT_MARKER = "Cambria Math";
|
|
|
21
21
|
const QUOTE_INDENT_PT = 36;
|
|
22
22
|
const TASK_CHECKBOX_UNCHECKED = "☐";
|
|
23
23
|
const TASK_CHECKBOX_CHECKED = "☒";
|
|
24
|
+
const VERTICAL_ALIGN_TAG = {
|
|
25
|
+
superscript: "sup",
|
|
26
|
+
subscript: "sub"
|
|
27
|
+
};
|
|
24
28
|
//#endregion
|
|
25
|
-
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, headingStyleId, parseHeadingStyleId };
|
|
29
|
+
export { CODE_BLOCK_STYLE_ID, HORIZONTAL_RULE_STYLE_ID, HTML_PREFORMATTED_STYLE_ID, MATH_BLOCK_STYLE_ID, MATH_INLINE_FONT_MARKER, MAX_HEADING_STYLE_LEVEL, MONOSPACE_FONT_FAMILY, QUOTE_INDENT_PT, QUOTE_STYLE_ID, TASK_CHECKBOX_CHECKED, TASK_CHECKBOX_UNCHECKED, VERTICAL_ALIGN_TAG, headingStyleId, parseHeadingStyleId };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markdown-codec",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Hand-written CommonMark+GFM <-> DocumentTree codec, built on document-schema.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"packageManager": "pnpm@12.4.1+sha512.2e81e399d73fe8390dab25e06aa788ab7a5908248d2f5a370f82b481147a6a7a367bf8048f9a6fdb6460f21a66f0542dedb8b94ca2c8723596741920b1656d4c",
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"byte-codec": "2.0.2",
|
|
87
|
-
"document-schema.js": "7.16.
|
|
87
|
+
"document-schema.js": "7.16.2",
|
|
88
88
|
"zod": "4.4.3"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|