@vmprint/mkd-literature 1.0.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 cosmiciron
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # @vmprint/mkd-literature
2
+
3
+ Markdown to VMPrint `DocumentInput` transmuter with built-in literature defaults.
4
+
5
+ Input is standard Markdown. Output is a pure object in VMPrint's AST format (`DocumentInput`), ready for JSON serialization or direct layout/rendering.
6
+
7
+ ## Features
8
+
9
+ - Zero file access. No `fs`, no Node-specific loading.
10
+ - No engine dependency. Types remain structurally compatible with `@vmprint/engine`.
11
+ - Built-in literature config and theme defaults.
12
+ - Caller overrides for `theme` and `config`.
13
+ - Images via data URIs or a caller-supplied resolver callback.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @vmprint/mkd-literature
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { transmute } from '@vmprint/mkd-literature';
25
+
26
+ const doc = transmute('# Chapter One\n\nBody text.');
27
+
28
+ const customized = transmute('# Chapter One', {
29
+ config: `references:\n heading: Endnotes\n`,
30
+ theme: `styles:\n paragraph:\n lineHeight: 1.6\n`
31
+ });
32
+ ```
33
+
34
+ ## API
35
+
36
+ ```typescript
37
+ type LiteratureTransmuteOptions = {
38
+ theme?: string;
39
+ config?: string;
40
+ resolveImage?: (src: string) => { data: string; mimeType: 'image/png' | 'image/jpeg' } | null;
41
+ };
42
+
43
+ function transmute(markdown: string, options?: LiteratureTransmuteOptions): DocumentInput;
44
+ ```
45
+
46
+ ---
47
+
48
+ Licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,134 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export { Transmuter, TransmuterOptions } from './transmuter';
4
+ import { Transmuter, TransmuterOptions } from '@vmprint/contracts';
5
+
6
+ // Generated by dts-bundle-generator v9.5.1
7
+ /**
8
+ * Types compatible with @vmprint/engine's DocumentInput.
9
+ * Declared here so the transmuter has zero dependency on the engine package.
10
+ */
11
+ export type TextAlign = "left" | "right" | "center" | "justify";
12
+ export type HyphenationMode = "off" | "auto" | "soft";
13
+ export type JustifyEngineMode = "legacy" | "advanced";
14
+ export type JustifyStrategy = "auto" | "space" | "inter-character";
15
+ export interface ElementStyle {
16
+ fontFamily?: string;
17
+ fontSize?: number;
18
+ fontWeight?: number | string;
19
+ fontStyle?: string;
20
+ textAlign?: TextAlign;
21
+ lang?: string;
22
+ direction?: string;
23
+ hyphenation?: HyphenationMode;
24
+ hyphenateCaps?: boolean;
25
+ justifyEngine?: JustifyEngineMode;
26
+ justifyStrategy?: JustifyStrategy;
27
+ marginTop?: number;
28
+ marginBottom?: number;
29
+ marginLeft?: number;
30
+ marginRight?: number;
31
+ textIndent?: number;
32
+ lineHeight?: number;
33
+ letterSpacing?: number;
34
+ verticalAlign?: "baseline" | "text-top" | "middle" | "text-bottom" | "bottom";
35
+ baselineShift?: number;
36
+ inlineMarginLeft?: number;
37
+ inlineMarginRight?: number;
38
+ padding?: number;
39
+ paddingTop?: number;
40
+ paddingBottom?: number;
41
+ paddingLeft?: number;
42
+ paddingRight?: number;
43
+ width?: number;
44
+ height?: number;
45
+ zIndex?: number;
46
+ color?: string;
47
+ backgroundColor?: string;
48
+ opacity?: number;
49
+ pageBreakBefore?: boolean;
50
+ keepWithNext?: boolean;
51
+ allowLineSplit?: boolean;
52
+ orphans?: number;
53
+ widows?: number;
54
+ overflowPolicy?: string;
55
+ borderWidth?: number;
56
+ borderColor?: string;
57
+ borderRadius?: number;
58
+ borderTopWidth?: number;
59
+ borderBottomWidth?: number;
60
+ borderLeftWidth?: number;
61
+ borderRightWidth?: number;
62
+ borderTopColor?: string;
63
+ borderBottomColor?: string;
64
+ borderLeftColor?: string;
65
+ borderRightColor?: string;
66
+ [key: string]: unknown;
67
+ }
68
+ interface Element$1 {
69
+ type: string;
70
+ content: string;
71
+ children?: Element$1[];
72
+ columns?: number;
73
+ gutter?: number;
74
+ balance?: boolean;
75
+ table?: Record<string, unknown>;
76
+ image?: Record<string, unknown>;
77
+ dropCap?: Record<string, unknown>;
78
+ properties?: Record<string, unknown>;
79
+ }
80
+ export interface DocumentLayout {
81
+ pageSize: "A4" | "LETTER" | {
82
+ width: number;
83
+ height: number;
84
+ };
85
+ margins: {
86
+ top: number;
87
+ right: number;
88
+ bottom: number;
89
+ left: number;
90
+ };
91
+ fontFamily: string;
92
+ fontSize: number;
93
+ lineHeight: number;
94
+ [key: string]: unknown;
95
+ }
96
+ export interface PageRegionContent {
97
+ elements: Element$1[];
98
+ style?: ElementStyle;
99
+ }
100
+ export interface PageRegionDefinition {
101
+ default?: PageRegionContent | null;
102
+ firstPage?: PageRegionContent | null;
103
+ odd?: PageRegionContent | null;
104
+ even?: PageRegionContent | null;
105
+ }
106
+ export interface DocumentInput {
107
+ documentVersion: "1.1";
108
+ layout: DocumentLayout;
109
+ fonts?: Record<string, string | undefined>;
110
+ styles: Partial<Record<string, ElementStyle>>;
111
+ elements: Element$1[];
112
+ header?: PageRegionDefinition;
113
+ footer?: PageRegionDefinition;
114
+ }
115
+ export type ResolvedImage = {
116
+ data: string;
117
+ mimeType: "image/png" | "image/jpeg";
118
+ };
119
+ export declare const DEFAULT_LITERATURE_CONFIG_YAML = "\nlist:\n textIndentPerLevel: 15\n markerGap: 5\n itemSpacingAfter: 3.6\n tightItemSpacingAfter: 1.2\n continuationIndentLevels: 0\n unorderedMarkers:\n - \"\u2014\"\n - \"\u2014\"\n - \"\u2014\"\n orderedMarkers:\n - upper-roman\n - decimal\n - lower-alpha\n taskMarkers:\n checked: \"[done]\"\n unchecked: \"[ ]\"\n\nlinks:\n mode: citation\n dedupe: true\n citationStyle: bracket\n\nreferences:\n enabled: true\n heading: Notes\n numberingStyle: lower-roman\n includeLinkTitle: true\n\nblockquote:\n attribution:\n enabled: true\n markerPattern: '^[-\u2014\u2013]{1,2}s+'\n\ntitle:\n subheading:\n enabled: false\n markerPattern: '^::s+'\n requireMarker: true\n stripMarker: true\n applyToFirstH1Only: true\n keepWithNext: true\n\nimages:\n blockStyle:\n width: 286\n marginTop: 5.4\n marginBottom: 5\n borderWidth: 0\n borderRadius: 0\n paddingTop: 0\n paddingBottom: 0\n paddingLeft: 0\n paddingRight: 0\n frame:\n mode: \"off\"\n markerPattern: '\b(frame|framed)\b'\n style: {}\n\ncaptions:\n pattern: '^(Plate|Figure|Fig.|Source)s+([0-9]+|[IVXLC]+)\b'\n blockquoteUnderImageAsFigureCaption: false\n style:\n textAlign: left\n hyphenation: \"off\"\n fontStyle: italic\n fontSize: 9.8\n lineHeight: 1.3\n color: \"#47443f\"\n marginTop: 0\n marginBottom: 9\n\ntables:\n zebra: false\n headerColor: \"#f3f4f6\"\n\ncodeBlocks:\n defaultMode: extract\n languageModes:\n verse: verse\n poetry: verse\n poem: verse\n extract: extract\n archive: extract\n epigraph: epigraph\n letter: letter\n marginalia: marginalia\n modes:\n verse:\n style:\n fontFamily: Caladea\n fontStyle: italic\n fontSize: 11.6\n lineHeight: 1.58\n textAlign: left\n color: \"#252422\"\n backgroundColor: \"#ffffff\"\n borderWidth: 0\n borderLeftWidth: 0\n borderLeftColor: \"#96928a\"\n paddingTop: 6\n paddingBottom: 6\n paddingLeft: 18\n paddingRight: 8\n marginTop: 0.4\n marginBottom: 10\n extract:\n style:\n fontFamily: Caladea\n fontStyle: italic\n fontSize: 11.2\n lineHeight: 1.5\n textAlign: left\n color: \"#2a2a2a\"\n backgroundColor: \"#ffffff\"\n borderWidth: 0\n borderLeftWidth: 0\n borderLeftColor: \"#8d8a84\"\n paddingTop: 6\n paddingBottom: 6\n paddingLeft: 14\n paddingRight: 8\n marginTop: 0\n marginBottom: 10\n epigraph:\n style:\n fontFamily: Caladea\n fontStyle: italic\n fontSize: 11\n lineHeight: 1.5\n textAlign: center\n color: \"#2f2c28\"\n backgroundColor: \"#ffffff\"\n borderWidth: 0\n paddingTop: 5\n paddingBottom: 5\n paddingLeft: 20\n paddingRight: 20\n marginTop: 1.4\n marginBottom: 10\n letter:\n style:\n fontFamily: Caladea\n fontStyle: normal\n fontSize: 11.2\n lineHeight: 1.5\n textAlign: left\n color: \"#252525\"\n backgroundColor: \"#ffffff\"\n borderWidth: 0\n borderColor: \"#cfcbc2\"\n paddingTop: 7\n paddingBottom: 7\n paddingLeft: 10\n paddingRight: 10\n marginTop: 0\n marginBottom: 10\n marginalia:\n style:\n fontFamily: Caladea\n fontStyle: italic\n fontSize: 10.6\n lineHeight: 1.45\n textAlign: left\n color: \"#3a3732\"\n backgroundColor: \"#ffffff\"\n borderWidth: 0\n borderLeftWidth: 0\n borderLeftColor: \"#b1a795\"\n paddingTop: 5\n paddingBottom: 5\n paddingLeft: 10\n paddingRight: 6\n marginTop: 0\n marginBottom: 8\n";
120
+ export declare const DEFAULT_LITERATURE_THEME_YAML = "\nlayout:\n fontFamily: Caladea\n fontSize: 10.6\n lineHeight: 1.52\n pageSize:\n width: 396\n height: 612\n margins:\n top: 64\n right: 54\n bottom: 62\n left: 54\n hyphenation: soft\n justifyEngine: advanced\n justifyStrategy: auto\n\nfooter:\n default:\n elements:\n - type: paragraph\n content: \"{pageNumber}\"\n properties:\n style:\n textAlign: center\n fontSize: 9\n color: \"#666666\"\n fontFamily: Caladea\n marginTop: 31\n\nstyles:\n paragraph:\n textAlign: left\n marginBottom: 8.6\n hyphenation: \"off\"\n justifyEngine: legacy\n heading-1:\n fontSize: 20.8\n marginTop: 9.4\n marginBottom: 9\n hyphenation: \"off\"\n textAlign: left\n heading-2:\n fontSize: 16.2\n marginTop: 5.4\n marginBottom: 7\n hyphenation: \"off\"\n textAlign: left\n heading-3:\n fontSize: 13.9\n marginTop: 5.4\n marginBottom: 6\n hyphenation: \"off\"\n textAlign: left\n inline-code:\n fontFamily: Caladea\n fontStyle: italic\n fontSize: 11\n backgroundColor: \"#ffffff\"\n blockquote:\n textAlign: left\n fontStyle: italic\n fontSize: 10.4\n lineHeight: 1.45\n color: \"#2b2a28\"\n paddingLeft: 18\n paddingRight: 8\n borderLeftWidth: 0\n marginTop: 0\n marginBottom: 9\n blockquote-attribution:\n textAlign: right\n fontStyle: normal\n fontSize: 9.8\n color: \"#47443f\"\n marginTop: 2\n marginBottom: 7\n references-heading:\n hyphenation: \"off\"\n textAlign: left\n fontSize: 12.4\n marginTop: 3.4\n marginBottom: 5\n references-item:\n textAlign: left\n hyphenation: \"off\"\n lineHeight: 1.3\n fontSize: 9.8\n marginBottom: 3\n paddingLeft: 12\n textIndent: -12\n list-item-ordered-0:\n textAlign: left\n hyphenation: \"off\"\n justifyEngine: legacy\n marginBottom: 3.6\n list-item-ordered-1:\n textAlign: left\n hyphenation: \"off\"\n justifyEngine: legacy\n marginBottom: 3.2\n list-item-unordered-0:\n textAlign: left\n hyphenation: \"off\"\n justifyEngine: legacy\n marginBottom: 3.6\n list-item-unordered-1:\n textAlign: left\n hyphenation: \"off\"\n justifyEngine: legacy\n marginBottom: 3.2\n definition-term:\n fontStyle: italic\n fontWeight: 700\n keepWithNext: true\n marginTop: 0\n marginBottom: 1.2\n definition-desc:\n paddingLeft: 14\n marginTop: 0\n marginBottom: 5.4\n table-cell:\n paddingTop: 4\n paddingBottom: 4\n paddingLeft: 5\n paddingRight: 5\n borderWidth: 0.6\n borderColor: \"#111111\"\n";
121
+ export type LiteratureTransmuteOptions = TransmuterOptions & {
122
+ resolveImage?: (src: string) => ResolvedImage | null;
123
+ };
124
+ export declare function transmute(markdown: string, options?: LiteratureTransmuteOptions): DocumentInput;
125
+ export type LiteratureTransmuter = Transmuter<string, DocumentInput, LiteratureTransmuteOptions>;
126
+ export declare const transmuter: LiteratureTransmuter;
127
+
128
+ export {
129
+ Element$1 as Element,
130
+ Transmuter,
131
+ TransmuterOptions,
132
+ };
133
+
134
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ DEFAULT_LITERATURE_CONFIG_YAML: () => DEFAULT_LITERATURE_CONFIG_YAML,
24
+ DEFAULT_LITERATURE_THEME_YAML: () => DEFAULT_LITERATURE_THEME_YAML,
25
+ transmute: () => transmute,
26
+ transmuter: () => transmuter
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+ var import_markdown_core = require("@vmprint/markdown-core");
30
+ var DEFAULT_LITERATURE_CONFIG_YAML = `
31
+ list:
32
+ textIndentPerLevel: 15
33
+ markerGap: 5
34
+ itemSpacingAfter: 3.6
35
+ tightItemSpacingAfter: 1.2
36
+ continuationIndentLevels: 0
37
+ unorderedMarkers:
38
+ - "\u2014"
39
+ - "\u2014"
40
+ - "\u2014"
41
+ orderedMarkers:
42
+ - upper-roman
43
+ - decimal
44
+ - lower-alpha
45
+ taskMarkers:
46
+ checked: "[done]"
47
+ unchecked: "[ ]"
48
+
49
+ links:
50
+ mode: citation
51
+ dedupe: true
52
+ citationStyle: bracket
53
+
54
+ references:
55
+ enabled: true
56
+ heading: Notes
57
+ numberingStyle: lower-roman
58
+ includeLinkTitle: true
59
+
60
+ blockquote:
61
+ attribution:
62
+ enabled: true
63
+ markerPattern: '^[-\u2014\u2013]{1,2}s+'
64
+
65
+ title:
66
+ subheading:
67
+ enabled: false
68
+ markerPattern: '^::s+'
69
+ requireMarker: true
70
+ stripMarker: true
71
+ applyToFirstH1Only: true
72
+ keepWithNext: true
73
+
74
+ images:
75
+ blockStyle:
76
+ width: 286
77
+ marginTop: 5.4
78
+ marginBottom: 5
79
+ borderWidth: 0
80
+ borderRadius: 0
81
+ paddingTop: 0
82
+ paddingBottom: 0
83
+ paddingLeft: 0
84
+ paddingRight: 0
85
+ frame:
86
+ mode: "off"
87
+ markerPattern: '\b(frame|framed)\b'
88
+ style: {}
89
+
90
+ captions:
91
+ pattern: '^(Plate|Figure|Fig.|Source)s+([0-9]+|[IVXLC]+)\b'
92
+ blockquoteUnderImageAsFigureCaption: false
93
+ style:
94
+ textAlign: left
95
+ hyphenation: "off"
96
+ fontStyle: italic
97
+ fontSize: 9.8
98
+ lineHeight: 1.3
99
+ color: "#47443f"
100
+ marginTop: 0
101
+ marginBottom: 9
102
+
103
+ tables:
104
+ zebra: false
105
+ headerColor: "#f3f4f6"
106
+
107
+ codeBlocks:
108
+ defaultMode: extract
109
+ languageModes:
110
+ verse: verse
111
+ poetry: verse
112
+ poem: verse
113
+ extract: extract
114
+ archive: extract
115
+ epigraph: epigraph
116
+ letter: letter
117
+ marginalia: marginalia
118
+ modes:
119
+ verse:
120
+ style:
121
+ fontFamily: Caladea
122
+ fontStyle: italic
123
+ fontSize: 11.6
124
+ lineHeight: 1.58
125
+ textAlign: left
126
+ color: "#252422"
127
+ backgroundColor: "#ffffff"
128
+ borderWidth: 0
129
+ borderLeftWidth: 0
130
+ borderLeftColor: "#96928a"
131
+ paddingTop: 6
132
+ paddingBottom: 6
133
+ paddingLeft: 18
134
+ paddingRight: 8
135
+ marginTop: 0.4
136
+ marginBottom: 10
137
+ extract:
138
+ style:
139
+ fontFamily: Caladea
140
+ fontStyle: italic
141
+ fontSize: 11.2
142
+ lineHeight: 1.5
143
+ textAlign: left
144
+ color: "#2a2a2a"
145
+ backgroundColor: "#ffffff"
146
+ borderWidth: 0
147
+ borderLeftWidth: 0
148
+ borderLeftColor: "#8d8a84"
149
+ paddingTop: 6
150
+ paddingBottom: 6
151
+ paddingLeft: 14
152
+ paddingRight: 8
153
+ marginTop: 0
154
+ marginBottom: 10
155
+ epigraph:
156
+ style:
157
+ fontFamily: Caladea
158
+ fontStyle: italic
159
+ fontSize: 11
160
+ lineHeight: 1.5
161
+ textAlign: center
162
+ color: "#2f2c28"
163
+ backgroundColor: "#ffffff"
164
+ borderWidth: 0
165
+ paddingTop: 5
166
+ paddingBottom: 5
167
+ paddingLeft: 20
168
+ paddingRight: 20
169
+ marginTop: 1.4
170
+ marginBottom: 10
171
+ letter:
172
+ style:
173
+ fontFamily: Caladea
174
+ fontStyle: normal
175
+ fontSize: 11.2
176
+ lineHeight: 1.5
177
+ textAlign: left
178
+ color: "#252525"
179
+ backgroundColor: "#ffffff"
180
+ borderWidth: 0
181
+ borderColor: "#cfcbc2"
182
+ paddingTop: 7
183
+ paddingBottom: 7
184
+ paddingLeft: 10
185
+ paddingRight: 10
186
+ marginTop: 0
187
+ marginBottom: 10
188
+ marginalia:
189
+ style:
190
+ fontFamily: Caladea
191
+ fontStyle: italic
192
+ fontSize: 10.6
193
+ lineHeight: 1.45
194
+ textAlign: left
195
+ color: "#3a3732"
196
+ backgroundColor: "#ffffff"
197
+ borderWidth: 0
198
+ borderLeftWidth: 0
199
+ borderLeftColor: "#b1a795"
200
+ paddingTop: 5
201
+ paddingBottom: 5
202
+ paddingLeft: 10
203
+ paddingRight: 6
204
+ marginTop: 0
205
+ marginBottom: 8
206
+ `;
207
+ var DEFAULT_LITERATURE_THEME_YAML = `
208
+ layout:
209
+ fontFamily: Caladea
210
+ fontSize: 10.6
211
+ lineHeight: 1.52
212
+ pageSize:
213
+ width: 396
214
+ height: 612
215
+ margins:
216
+ top: 64
217
+ right: 54
218
+ bottom: 62
219
+ left: 54
220
+ hyphenation: soft
221
+ justifyEngine: advanced
222
+ justifyStrategy: auto
223
+
224
+ footer:
225
+ default:
226
+ elements:
227
+ - type: paragraph
228
+ content: "{pageNumber}"
229
+ properties:
230
+ style:
231
+ textAlign: center
232
+ fontSize: 9
233
+ color: "#666666"
234
+ fontFamily: Caladea
235
+ marginTop: 31
236
+
237
+ styles:
238
+ paragraph:
239
+ textAlign: left
240
+ marginBottom: 8.6
241
+ hyphenation: "off"
242
+ justifyEngine: legacy
243
+ heading-1:
244
+ fontSize: 20.8
245
+ marginTop: 9.4
246
+ marginBottom: 9
247
+ hyphenation: "off"
248
+ textAlign: left
249
+ heading-2:
250
+ fontSize: 16.2
251
+ marginTop: 5.4
252
+ marginBottom: 7
253
+ hyphenation: "off"
254
+ textAlign: left
255
+ heading-3:
256
+ fontSize: 13.9
257
+ marginTop: 5.4
258
+ marginBottom: 6
259
+ hyphenation: "off"
260
+ textAlign: left
261
+ inline-code:
262
+ fontFamily: Caladea
263
+ fontStyle: italic
264
+ fontSize: 11
265
+ backgroundColor: "#ffffff"
266
+ blockquote:
267
+ textAlign: left
268
+ fontStyle: italic
269
+ fontSize: 10.4
270
+ lineHeight: 1.45
271
+ color: "#2b2a28"
272
+ paddingLeft: 18
273
+ paddingRight: 8
274
+ borderLeftWidth: 0
275
+ marginTop: 0
276
+ marginBottom: 9
277
+ blockquote-attribution:
278
+ textAlign: right
279
+ fontStyle: normal
280
+ fontSize: 9.8
281
+ color: "#47443f"
282
+ marginTop: 2
283
+ marginBottom: 7
284
+ references-heading:
285
+ hyphenation: "off"
286
+ textAlign: left
287
+ fontSize: 12.4
288
+ marginTop: 3.4
289
+ marginBottom: 5
290
+ references-item:
291
+ textAlign: left
292
+ hyphenation: "off"
293
+ lineHeight: 1.3
294
+ fontSize: 9.8
295
+ marginBottom: 3
296
+ paddingLeft: 12
297
+ textIndent: -12
298
+ list-item-ordered-0:
299
+ textAlign: left
300
+ hyphenation: "off"
301
+ justifyEngine: legacy
302
+ marginBottom: 3.6
303
+ list-item-ordered-1:
304
+ textAlign: left
305
+ hyphenation: "off"
306
+ justifyEngine: legacy
307
+ marginBottom: 3.2
308
+ list-item-unordered-0:
309
+ textAlign: left
310
+ hyphenation: "off"
311
+ justifyEngine: legacy
312
+ marginBottom: 3.6
313
+ list-item-unordered-1:
314
+ textAlign: left
315
+ hyphenation: "off"
316
+ justifyEngine: legacy
317
+ marginBottom: 3.2
318
+ definition-term:
319
+ fontStyle: italic
320
+ fontWeight: 700
321
+ keepWithNext: true
322
+ marginTop: 0
323
+ marginBottom: 1.2
324
+ definition-desc:
325
+ paddingLeft: 14
326
+ marginTop: 0
327
+ marginBottom: 5.4
328
+ table-cell:
329
+ paddingTop: 4
330
+ paddingBottom: 4
331
+ paddingLeft: 5
332
+ paddingRight: 5
333
+ borderWidth: 0.6
334
+ borderColor: "#111111"
335
+ `;
336
+ function transmute(markdown, options) {
337
+ return (0, import_markdown_core.transmuteMarkdown)(markdown, {
338
+ theme: options?.theme ?? DEFAULT_LITERATURE_THEME_YAML,
339
+ config: options?.config,
340
+ baseConfig: DEFAULT_LITERATURE_CONFIG_YAML,
341
+ resolveImage: options?.resolveImage
342
+ });
343
+ }
344
+ var transmuter = {
345
+ transmute,
346
+ getBoilerplate() {
347
+ return [
348
+ "# Literature Settings",
349
+ "# literature:",
350
+ "# dropCap:",
351
+ "# enabled: true",
352
+ "# lines: 3",
353
+ "#",
354
+ "# typography:",
355
+ "# smartQuotes: true"
356
+ ].join("\n");
357
+ }
358
+ };
359
+ // Annotate the CommonJS export names for ESM import in node:
360
+ 0 && (module.exports = {
361
+ DEFAULT_LITERATURE_CONFIG_YAML,
362
+ DEFAULT_LITERATURE_THEME_YAML,
363
+ transmute,
364
+ transmuter
365
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,339 @@
1
+ // src/index.ts
2
+ import {
3
+ transmuteMarkdown
4
+ } from "@vmprint/markdown-core";
5
+ var DEFAULT_LITERATURE_CONFIG_YAML = `
6
+ list:
7
+ textIndentPerLevel: 15
8
+ markerGap: 5
9
+ itemSpacingAfter: 3.6
10
+ tightItemSpacingAfter: 1.2
11
+ continuationIndentLevels: 0
12
+ unorderedMarkers:
13
+ - "\u2014"
14
+ - "\u2014"
15
+ - "\u2014"
16
+ orderedMarkers:
17
+ - upper-roman
18
+ - decimal
19
+ - lower-alpha
20
+ taskMarkers:
21
+ checked: "[done]"
22
+ unchecked: "[ ]"
23
+
24
+ links:
25
+ mode: citation
26
+ dedupe: true
27
+ citationStyle: bracket
28
+
29
+ references:
30
+ enabled: true
31
+ heading: Notes
32
+ numberingStyle: lower-roman
33
+ includeLinkTitle: true
34
+
35
+ blockquote:
36
+ attribution:
37
+ enabled: true
38
+ markerPattern: '^[-\u2014\u2013]{1,2}s+'
39
+
40
+ title:
41
+ subheading:
42
+ enabled: false
43
+ markerPattern: '^::s+'
44
+ requireMarker: true
45
+ stripMarker: true
46
+ applyToFirstH1Only: true
47
+ keepWithNext: true
48
+
49
+ images:
50
+ blockStyle:
51
+ width: 286
52
+ marginTop: 5.4
53
+ marginBottom: 5
54
+ borderWidth: 0
55
+ borderRadius: 0
56
+ paddingTop: 0
57
+ paddingBottom: 0
58
+ paddingLeft: 0
59
+ paddingRight: 0
60
+ frame:
61
+ mode: "off"
62
+ markerPattern: '\b(frame|framed)\b'
63
+ style: {}
64
+
65
+ captions:
66
+ pattern: '^(Plate|Figure|Fig.|Source)s+([0-9]+|[IVXLC]+)\b'
67
+ blockquoteUnderImageAsFigureCaption: false
68
+ style:
69
+ textAlign: left
70
+ hyphenation: "off"
71
+ fontStyle: italic
72
+ fontSize: 9.8
73
+ lineHeight: 1.3
74
+ color: "#47443f"
75
+ marginTop: 0
76
+ marginBottom: 9
77
+
78
+ tables:
79
+ zebra: false
80
+ headerColor: "#f3f4f6"
81
+
82
+ codeBlocks:
83
+ defaultMode: extract
84
+ languageModes:
85
+ verse: verse
86
+ poetry: verse
87
+ poem: verse
88
+ extract: extract
89
+ archive: extract
90
+ epigraph: epigraph
91
+ letter: letter
92
+ marginalia: marginalia
93
+ modes:
94
+ verse:
95
+ style:
96
+ fontFamily: Caladea
97
+ fontStyle: italic
98
+ fontSize: 11.6
99
+ lineHeight: 1.58
100
+ textAlign: left
101
+ color: "#252422"
102
+ backgroundColor: "#ffffff"
103
+ borderWidth: 0
104
+ borderLeftWidth: 0
105
+ borderLeftColor: "#96928a"
106
+ paddingTop: 6
107
+ paddingBottom: 6
108
+ paddingLeft: 18
109
+ paddingRight: 8
110
+ marginTop: 0.4
111
+ marginBottom: 10
112
+ extract:
113
+ style:
114
+ fontFamily: Caladea
115
+ fontStyle: italic
116
+ fontSize: 11.2
117
+ lineHeight: 1.5
118
+ textAlign: left
119
+ color: "#2a2a2a"
120
+ backgroundColor: "#ffffff"
121
+ borderWidth: 0
122
+ borderLeftWidth: 0
123
+ borderLeftColor: "#8d8a84"
124
+ paddingTop: 6
125
+ paddingBottom: 6
126
+ paddingLeft: 14
127
+ paddingRight: 8
128
+ marginTop: 0
129
+ marginBottom: 10
130
+ epigraph:
131
+ style:
132
+ fontFamily: Caladea
133
+ fontStyle: italic
134
+ fontSize: 11
135
+ lineHeight: 1.5
136
+ textAlign: center
137
+ color: "#2f2c28"
138
+ backgroundColor: "#ffffff"
139
+ borderWidth: 0
140
+ paddingTop: 5
141
+ paddingBottom: 5
142
+ paddingLeft: 20
143
+ paddingRight: 20
144
+ marginTop: 1.4
145
+ marginBottom: 10
146
+ letter:
147
+ style:
148
+ fontFamily: Caladea
149
+ fontStyle: normal
150
+ fontSize: 11.2
151
+ lineHeight: 1.5
152
+ textAlign: left
153
+ color: "#252525"
154
+ backgroundColor: "#ffffff"
155
+ borderWidth: 0
156
+ borderColor: "#cfcbc2"
157
+ paddingTop: 7
158
+ paddingBottom: 7
159
+ paddingLeft: 10
160
+ paddingRight: 10
161
+ marginTop: 0
162
+ marginBottom: 10
163
+ marginalia:
164
+ style:
165
+ fontFamily: Caladea
166
+ fontStyle: italic
167
+ fontSize: 10.6
168
+ lineHeight: 1.45
169
+ textAlign: left
170
+ color: "#3a3732"
171
+ backgroundColor: "#ffffff"
172
+ borderWidth: 0
173
+ borderLeftWidth: 0
174
+ borderLeftColor: "#b1a795"
175
+ paddingTop: 5
176
+ paddingBottom: 5
177
+ paddingLeft: 10
178
+ paddingRight: 6
179
+ marginTop: 0
180
+ marginBottom: 8
181
+ `;
182
+ var DEFAULT_LITERATURE_THEME_YAML = `
183
+ layout:
184
+ fontFamily: Caladea
185
+ fontSize: 10.6
186
+ lineHeight: 1.52
187
+ pageSize:
188
+ width: 396
189
+ height: 612
190
+ margins:
191
+ top: 64
192
+ right: 54
193
+ bottom: 62
194
+ left: 54
195
+ hyphenation: soft
196
+ justifyEngine: advanced
197
+ justifyStrategy: auto
198
+
199
+ footer:
200
+ default:
201
+ elements:
202
+ - type: paragraph
203
+ content: "{pageNumber}"
204
+ properties:
205
+ style:
206
+ textAlign: center
207
+ fontSize: 9
208
+ color: "#666666"
209
+ fontFamily: Caladea
210
+ marginTop: 31
211
+
212
+ styles:
213
+ paragraph:
214
+ textAlign: left
215
+ marginBottom: 8.6
216
+ hyphenation: "off"
217
+ justifyEngine: legacy
218
+ heading-1:
219
+ fontSize: 20.8
220
+ marginTop: 9.4
221
+ marginBottom: 9
222
+ hyphenation: "off"
223
+ textAlign: left
224
+ heading-2:
225
+ fontSize: 16.2
226
+ marginTop: 5.4
227
+ marginBottom: 7
228
+ hyphenation: "off"
229
+ textAlign: left
230
+ heading-3:
231
+ fontSize: 13.9
232
+ marginTop: 5.4
233
+ marginBottom: 6
234
+ hyphenation: "off"
235
+ textAlign: left
236
+ inline-code:
237
+ fontFamily: Caladea
238
+ fontStyle: italic
239
+ fontSize: 11
240
+ backgroundColor: "#ffffff"
241
+ blockquote:
242
+ textAlign: left
243
+ fontStyle: italic
244
+ fontSize: 10.4
245
+ lineHeight: 1.45
246
+ color: "#2b2a28"
247
+ paddingLeft: 18
248
+ paddingRight: 8
249
+ borderLeftWidth: 0
250
+ marginTop: 0
251
+ marginBottom: 9
252
+ blockquote-attribution:
253
+ textAlign: right
254
+ fontStyle: normal
255
+ fontSize: 9.8
256
+ color: "#47443f"
257
+ marginTop: 2
258
+ marginBottom: 7
259
+ references-heading:
260
+ hyphenation: "off"
261
+ textAlign: left
262
+ fontSize: 12.4
263
+ marginTop: 3.4
264
+ marginBottom: 5
265
+ references-item:
266
+ textAlign: left
267
+ hyphenation: "off"
268
+ lineHeight: 1.3
269
+ fontSize: 9.8
270
+ marginBottom: 3
271
+ paddingLeft: 12
272
+ textIndent: -12
273
+ list-item-ordered-0:
274
+ textAlign: left
275
+ hyphenation: "off"
276
+ justifyEngine: legacy
277
+ marginBottom: 3.6
278
+ list-item-ordered-1:
279
+ textAlign: left
280
+ hyphenation: "off"
281
+ justifyEngine: legacy
282
+ marginBottom: 3.2
283
+ list-item-unordered-0:
284
+ textAlign: left
285
+ hyphenation: "off"
286
+ justifyEngine: legacy
287
+ marginBottom: 3.6
288
+ list-item-unordered-1:
289
+ textAlign: left
290
+ hyphenation: "off"
291
+ justifyEngine: legacy
292
+ marginBottom: 3.2
293
+ definition-term:
294
+ fontStyle: italic
295
+ fontWeight: 700
296
+ keepWithNext: true
297
+ marginTop: 0
298
+ marginBottom: 1.2
299
+ definition-desc:
300
+ paddingLeft: 14
301
+ marginTop: 0
302
+ marginBottom: 5.4
303
+ table-cell:
304
+ paddingTop: 4
305
+ paddingBottom: 4
306
+ paddingLeft: 5
307
+ paddingRight: 5
308
+ borderWidth: 0.6
309
+ borderColor: "#111111"
310
+ `;
311
+ function transmute(markdown, options) {
312
+ return transmuteMarkdown(markdown, {
313
+ theme: options?.theme ?? DEFAULT_LITERATURE_THEME_YAML,
314
+ config: options?.config,
315
+ baseConfig: DEFAULT_LITERATURE_CONFIG_YAML,
316
+ resolveImage: options?.resolveImage
317
+ });
318
+ }
319
+ var transmuter = {
320
+ transmute,
321
+ getBoilerplate() {
322
+ return [
323
+ "# Literature Settings",
324
+ "# literature:",
325
+ "# dropCap:",
326
+ "# enabled: true",
327
+ "# lines: 3",
328
+ "#",
329
+ "# typography:",
330
+ "# smartQuotes: true"
331
+ ].join("\n");
332
+ }
333
+ };
334
+ export {
335
+ DEFAULT_LITERATURE_CONFIG_YAML,
336
+ DEFAULT_LITERATURE_THEME_YAML,
337
+ transmute,
338
+ transmuter
339
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@vmprint/mkd-literature",
3
+ "version": "1.0.0",
4
+ "description": "Markdown → VMPrint DocumentInput transmuter with literature defaults.",
5
+ "author": "cosmiciron",
6
+ "license": "Apache-2.0",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "source": "src/index.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "scripts": {
23
+ "build:js": "esbuild src/index.ts --bundle --platform=node --target=node18 --external:@vmprint/contracts --external:@vmprint/markdown-core --outfile=dist/index.js",
24
+ "build:mjs": "esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --external:@vmprint/contracts --external:@vmprint/markdown-core --outfile=dist/index.mjs",
25
+ "build:dts": "dts-bundle-generator --no-check src/index.ts -o dist/index.d.ts",
26
+ "build": "rimraf dist && npm run build:js && npm run build:mjs && npm run build:dts",
27
+ "dev": "tsx src/index.ts",
28
+ "clean": "rimraf dist"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@vmprint/markdown-core": "^1.0.0",
35
+ "@vmprint/contracts": "^1.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.0.0",
39
+ "esbuild": "^0.25.0",
40
+ "rimraf": "^6.0.0",
41
+ "tsx": "^4.21.0",
42
+ "typescript": "^5.7.3"
43
+ }
44
+ }