legal-markdown-js 0.1.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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +168 -0
  3. package/dist/browser.d.ts +87 -0
  4. package/dist/browser.d.ts.map +1 -0
  5. package/dist/browser.js +157 -0
  6. package/dist/browser.js.map +1 -0
  7. package/dist/cli/index.d.ts +34 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +221 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/cli/service.d.ts +128 -0
  12. package/dist/cli/service.d.ts.map +1 -0
  13. package/dist/cli/service.js +284 -0
  14. package/dist/cli/service.js.map +1 -0
  15. package/dist/constants/index.d.ts +229 -0
  16. package/dist/constants/index.d.ts.map +1 -0
  17. package/dist/constants/index.js +232 -0
  18. package/dist/constants/index.js.map +1 -0
  19. package/dist/core/exporters/metadata-exporter.d.ts +104 -0
  20. package/dist/core/exporters/metadata-exporter.d.ts.map +1 -0
  21. package/dist/core/exporters/metadata-exporter.js +201 -0
  22. package/dist/core/exporters/metadata-exporter.js.map +1 -0
  23. package/dist/core/index.d.ts +40 -0
  24. package/dist/core/index.d.ts.map +1 -0
  25. package/dist/core/index.js +56 -0
  26. package/dist/core/index.js.map +1 -0
  27. package/dist/core/parsers/yaml-parser.d.ts +149 -0
  28. package/dist/core/parsers/yaml-parser.d.ts.map +1 -0
  29. package/dist/core/parsers/yaml-parser.js +321 -0
  30. package/dist/core/parsers/yaml-parser.js.map +1 -0
  31. package/dist/core/processors/clause-processor.d.ts +74 -0
  32. package/dist/core/processors/clause-processor.d.ts.map +1 -0
  33. package/dist/core/processors/clause-processor.js +213 -0
  34. package/dist/core/processors/clause-processor.js.map +1 -0
  35. package/dist/core/processors/date-processor.d.ts +90 -0
  36. package/dist/core/processors/date-processor.d.ts.map +1 -0
  37. package/dist/core/processors/date-processor.js +336 -0
  38. package/dist/core/processors/date-processor.js.map +1 -0
  39. package/dist/core/processors/header-processor.d.ts +104 -0
  40. package/dist/core/processors/header-processor.d.ts.map +1 -0
  41. package/dist/core/processors/header-processor.js +585 -0
  42. package/dist/core/processors/header-processor.js.map +1 -0
  43. package/dist/core/processors/import-processor.d.ts +116 -0
  44. package/dist/core/processors/import-processor.d.ts.map +1 -0
  45. package/dist/core/processors/import-processor.js +236 -0
  46. package/dist/core/processors/import-processor.js.map +1 -0
  47. package/dist/core/processors/mixin-processor.d.ts +93 -0
  48. package/dist/core/processors/mixin-processor.d.ts.map +1 -0
  49. package/dist/core/processors/mixin-processor.js +378 -0
  50. package/dist/core/processors/mixin-processor.js.map +1 -0
  51. package/dist/core/processors/reference-processor.d.ts +115 -0
  52. package/dist/core/processors/reference-processor.d.ts.map +1 -0
  53. package/dist/core/processors/reference-processor.js +273 -0
  54. package/dist/core/processors/reference-processor.js.map +1 -0
  55. package/dist/errors/index.d.ts +234 -0
  56. package/dist/errors/index.d.ts.map +1 -0
  57. package/dist/errors/index.js +267 -0
  58. package/dist/errors/index.js.map +1 -0
  59. package/dist/extensions/batch-processor.d.ts +197 -0
  60. package/dist/extensions/batch-processor.d.ts.map +1 -0
  61. package/dist/extensions/batch-processor.js +392 -0
  62. package/dist/extensions/batch-processor.js.map +1 -0
  63. package/dist/extensions/formatters/index.d.ts +99 -0
  64. package/dist/extensions/formatters/index.d.ts.map +1 -0
  65. package/dist/extensions/formatters/index.js +128 -0
  66. package/dist/extensions/formatters/index.js.map +1 -0
  67. package/dist/extensions/index.d.ts +53 -0
  68. package/dist/extensions/index.d.ts.map +1 -0
  69. package/dist/extensions/index.js +71 -0
  70. package/dist/extensions/index.js.map +1 -0
  71. package/dist/extensions/latex-parser.d.ts +111 -0
  72. package/dist/extensions/latex-parser.d.ts.map +1 -0
  73. package/dist/extensions/latex-parser.js +563 -0
  74. package/dist/extensions/latex-parser.js.map +1 -0
  75. package/dist/extensions/rst-parser.d.ts +112 -0
  76. package/dist/extensions/rst-parser.d.ts.map +1 -0
  77. package/dist/extensions/rst-parser.js +268 -0
  78. package/dist/extensions/rst-parser.js.map +1 -0
  79. package/dist/extensions/template-loops.d.ts +61 -0
  80. package/dist/extensions/template-loops.d.ts.map +1 -0
  81. package/dist/extensions/template-loops.js +418 -0
  82. package/dist/extensions/template-loops.js.map +1 -0
  83. package/dist/extensions/utilities/index.d.ts +114 -0
  84. package/dist/extensions/utilities/index.d.ts.map +1 -0
  85. package/dist/extensions/utilities/index.js +137 -0
  86. package/dist/extensions/utilities/index.js.map +1 -0
  87. package/dist/extensions/validators/index.d.ts +65 -0
  88. package/dist/extensions/validators/index.d.ts.map +1 -0
  89. package/dist/extensions/validators/index.js +88 -0
  90. package/dist/extensions/validators/index.js.map +1 -0
  91. package/dist/generators/html-generator.d.ts +184 -0
  92. package/dist/generators/html-generator.d.ts.map +1 -0
  93. package/dist/generators/html-generator.js +361 -0
  94. package/dist/generators/html-generator.js.map +1 -0
  95. package/dist/generators/pdf-generator.d.ts +165 -0
  96. package/dist/generators/pdf-generator.d.ts.map +1 -0
  97. package/dist/generators/pdf-generator.js +275 -0
  98. package/dist/generators/pdf-generator.js.map +1 -0
  99. package/dist/helpers/date-helpers.d.ts +216 -0
  100. package/dist/helpers/date-helpers.d.ts.map +1 -0
  101. package/dist/helpers/date-helpers.js +402 -0
  102. package/dist/helpers/date-helpers.js.map +1 -0
  103. package/dist/helpers/index.d.ts +87 -0
  104. package/dist/helpers/index.d.ts.map +1 -0
  105. package/dist/helpers/index.js +149 -0
  106. package/dist/helpers/index.js.map +1 -0
  107. package/dist/helpers/number-helpers.d.ts +269 -0
  108. package/dist/helpers/number-helpers.d.ts.map +1 -0
  109. package/dist/helpers/number-helpers.js +406 -0
  110. package/dist/helpers/number-helpers.js.map +1 -0
  111. package/dist/helpers/string-helpers.d.ts +391 -0
  112. package/dist/helpers/string-helpers.d.ts.map +1 -0
  113. package/dist/helpers/string-helpers.js +549 -0
  114. package/dist/helpers/string-helpers.js.map +1 -0
  115. package/dist/index.d.ts +229 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +384 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/legal-markdown.umd.min.js +2 -0
  120. package/dist/legal-markdown.umd.min.js.LICENSE.txt +14 -0
  121. package/dist/legal-markdown.umd.min.js.map +1 -0
  122. package/dist/lib/index.d.ts +150 -0
  123. package/dist/lib/index.d.ts.map +1 -0
  124. package/dist/lib/index.js +265 -0
  125. package/dist/lib/index.js.map +1 -0
  126. package/dist/parsers/content-detector.d.ts +131 -0
  127. package/dist/parsers/content-detector.d.ts.map +1 -0
  128. package/dist/parsers/content-detector.js +220 -0
  129. package/dist/parsers/content-detector.js.map +1 -0
  130. package/dist/parsers/fallback-parsers.d.ts +14 -0
  131. package/dist/parsers/fallback-parsers.d.ts.map +1 -0
  132. package/dist/parsers/fallback-parsers.js +188 -0
  133. package/dist/parsers/fallback-parsers.js.map +1 -0
  134. package/dist/parsers/implementations/pandoc-native.d.ts +13 -0
  135. package/dist/parsers/implementations/pandoc-native.d.ts.map +1 -0
  136. package/dist/parsers/implementations/pandoc-native.js +63 -0
  137. package/dist/parsers/implementations/pandoc-native.js.map +1 -0
  138. package/dist/parsers/implementations/pandoc-wasm.d.ts +14 -0
  139. package/dist/parsers/implementations/pandoc-wasm.d.ts.map +1 -0
  140. package/dist/parsers/implementations/pandoc-wasm.js +64 -0
  141. package/dist/parsers/implementations/pandoc-wasm.js.map +1 -0
  142. package/dist/parsers/pandoc-factory.d.ts +97 -0
  143. package/dist/parsers/pandoc-factory.d.ts.map +1 -0
  144. package/dist/parsers/pandoc-factory.js +146 -0
  145. package/dist/parsers/pandoc-factory.js.map +1 -0
  146. package/dist/parsers/pandoc-loader.d.ts +24 -0
  147. package/dist/parsers/pandoc-loader.d.ts.map +1 -0
  148. package/dist/parsers/pandoc-loader.js +124 -0
  149. package/dist/parsers/pandoc-loader.js.map +1 -0
  150. package/dist/parsers/pandoc-parser.d.ts +27 -0
  151. package/dist/parsers/pandoc-parser.d.ts.map +1 -0
  152. package/dist/parsers/pandoc-parser.js +3 -0
  153. package/dist/parsers/pandoc-parser.js.map +1 -0
  154. package/dist/styles/default.css +125 -0
  155. package/dist/styles/headers.css +146 -0
  156. package/dist/styles/highlight.css +171 -0
  157. package/dist/tracking/field-tracker.d.ts +206 -0
  158. package/dist/tracking/field-tracker.d.ts.map +1 -0
  159. package/dist/tracking/field-tracker.js +247 -0
  160. package/dist/tracking/field-tracker.js.map +1 -0
  161. package/dist/types.d.ts +186 -0
  162. package/dist/types.d.ts.map +1 -0
  163. package/dist/types.js +33 -0
  164. package/dist/types.js.map +1 -0
  165. package/dist/utils/logger.d.ts +107 -0
  166. package/dist/utils/logger.d.ts.map +1 -0
  167. package/dist/utils/logger.js +122 -0
  168. package/dist/utils/logger.js.map +1 -0
  169. package/dist/web/bundle-standalone.js +28 -0
  170. package/dist/web/bundle.js +17 -0
  171. package/dist/web/index.html +1465 -0
  172. package/dist/web/legal-markdown.umd.min.js +2 -0
  173. package/dist/web/standalone.html +390 -0
  174. package/dist/web/styles.css +874 -0
  175. package/package.json +118 -0
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Content Detection Module for Legal Markdown Processing
4
+ *
5
+ * This module provides intelligent content type detection for various document
6
+ * formats including reStructuredText (RST) and LaTeX. It uses pattern matching
7
+ * and heuristics to determine if content requires specific parsers for conversion
8
+ * to Legal Markdown format.
9
+ *
10
+ * Features:
11
+ * - reStructuredText format detection with pattern-based analysis
12
+ * - LaTeX document format detection with command recognition
13
+ * - YAML frontmatter awareness to avoid false positives
14
+ * - Robust pattern matching with configurable thresholds
15
+ * - Support for various RST directives and syntax elements
16
+ * - LaTeX command and environment detection
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * import { ContentDetector } from './content-detector';
21
+ *
22
+ * // Detect RST content
23
+ * const isRst = ContentDetector.needsRstParser(content);
24
+ * if (isRst) {
25
+ * content = await convertRstToLegalMarkdown(content);
26
+ * }
27
+ *
28
+ * // Detect LaTeX content
29
+ * const isLatex = ContentDetector.needsLatexParser(content);
30
+ * if (isLatex) {
31
+ * content = await convertLatexToLegalMarkdown(content);
32
+ * }
33
+ * ```
34
+ */
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ContentDetector = void 0;
37
+ /**
38
+ * Content detection utility class for identifying document formats
39
+ *
40
+ * Provides static methods to detect different document formats using pattern
41
+ * matching and content analysis. Designed to prevent unnecessary processing
42
+ * of content that doesn't require specific parsers.
43
+ *
44
+ * @class ContentDetector
45
+ * @example
46
+ * ```typescript
47
+ * import { ContentDetector } from './content-detector';
48
+ *
49
+ * // Check if content needs RST processing
50
+ * if (ContentDetector.needsRstParser(content)) {
51
+ * content = await processRstContent(content);
52
+ * }
53
+ *
54
+ * // Check if content needs LaTeX processing
55
+ * if (ContentDetector.needsLatexParser(content)) {
56
+ * content = await processLatexContent(content);
57
+ * }
58
+ * ```
59
+ */
60
+ class ContentDetector {
61
+ /**
62
+ * Detects if content requires reStructuredText parsing
63
+ *
64
+ * Uses pattern matching to identify RST-specific syntax elements including
65
+ * directives, header underlines, reference links, code blocks, and other
66
+ * RST constructs. Avoids false positives with YAML frontmatter content.
67
+ *
68
+ * @static
69
+ * @param {string} content - The content to analyze for RST patterns
70
+ * @returns {boolean} True if content appears to be reStructuredText, false otherwise
71
+ * @example
72
+ * ```typescript
73
+ * const rstContent = `
74
+ * Introduction
75
+ * ============
76
+ *
77
+ * This is a sample RST document.
78
+ *
79
+ * .. note::
80
+ * This is an RST directive.
81
+ * `;
82
+ *
83
+ * const isRst = ContentDetector.needsRstParser(rstContent);
84
+ * console.log(isRst); // true
85
+ * ```
86
+ */
87
+ static needsRstParser(content) {
88
+ // No tratar como RST si empieza con YAML frontmatter
89
+ if (content.startsWith('---')) {
90
+ return false;
91
+ }
92
+ // Patrones específicos para RST
93
+ const rstPatterns = [
94
+ /^\.\.[ \t]+\w+::/m, // Directives
95
+ /^[=~^"'`#*+<>-]{4,}[ \t]*$/m, // Header underlines (4+ chars)
96
+ /`[^`]+`__?/, // Reference links
97
+ /`[^<]+[ \t]*<[^>]+>`_/, // External links
98
+ /::[ \t]*$/m, // Code blocks
99
+ /^\.\.[ \t]+(note|warning|important)::/m, // Admonitions
100
+ /^\*[ \t]+\S/m, // Bullet lists with content
101
+ /^\d+\.[ \t]+\S/m, // Numbered lists with content
102
+ ];
103
+ // Patrones fuertemente indicativos de RST (solo uno necesario)
104
+ const strongRstPatterns = [
105
+ /^\.\.[ \t]+\w+::/m, // Directives
106
+ /`[^<]+[ \t]*<[^>]+>`_/, // External links with RST syntax
107
+ /^\.\.[ \t]+(note|warning|important)::/m, // Admonitions
108
+ /::[ \t]*$/m, // Code blocks
109
+ ];
110
+ // Patrones de header con underline (específico de RST)
111
+ const headerPattern = /^.+\n[=~^"'`#*+<>-]{4,}[ \t]*$/m;
112
+ // Si hay patrones fuertes, es RST
113
+ const strongMatches = strongRstPatterns.filter(pattern => pattern.test(content));
114
+ if (strongMatches.length >= 1) {
115
+ return true;
116
+ }
117
+ // Si hay header underline, es muy probable que sea RST
118
+ if (headerPattern.test(content)) {
119
+ return true;
120
+ }
121
+ // Requiere al menos 2 patrones para confirmar RST
122
+ const matches = rstPatterns.filter(pattern => pattern.test(content));
123
+ return matches.length >= 2;
124
+ }
125
+ /**
126
+ * Detects if content requires LaTeX parsing
127
+ *
128
+ * Uses pattern matching to identify LaTeX-specific commands, environments,
129
+ * and syntax elements including document classes, sections, text formatting
130
+ * commands, and environments. Requires multiple pattern matches to avoid
131
+ * false positives.
132
+ *
133
+ * @static
134
+ * @param {string} content - The content to analyze for LaTeX patterns
135
+ * @returns {boolean} True if content appears to be LaTeX, false otherwise
136
+ * @example
137
+ * ```typescript
138
+ * const latexContent = `
139
+ * \\documentclass{article}
140
+ * \\begin{document}
141
+ * \\section{Introduction}
142
+ * This is \\textbf{bold} text in LaTeX.
143
+ * \\end{document}
144
+ * `;
145
+ *
146
+ * const isLatex = ContentDetector.needsLatexParser(latexContent);
147
+ * console.log(isLatex); // true
148
+ * ```
149
+ */
150
+ static needsLatexParser(content) {
151
+ // No tratar como LaTeX si empieza con YAML frontmatter
152
+ if (content.startsWith('---')) {
153
+ return false;
154
+ }
155
+ // Patrones específicos para LaTeX
156
+ const latexPatterns = [
157
+ /\\documentclass\{/, // Document class
158
+ /\\begin\{document\}/, // Begin document
159
+ /\\section\*?\{/, // Sections
160
+ /\\subsection\*?\{/, // Subsections
161
+ /\\begin\{[^}]+\}/, // Environments
162
+ /\\[a-zA-Z]+\{[^}]*\}/, // Commands with arguments
163
+ /\\textbf\{/, // Bold text
164
+ /\\textit\{/, // Italic text
165
+ /\\emph\{/, // Emphasis
166
+ /\\usepackage\{/, // Package imports
167
+ /\\href\{[^}]*\}\{[^}]*\}/, // Links
168
+ /\\item\b/, // List items
169
+ /\\cite\{/, // Citations
170
+ /\\ref\{/, // References
171
+ /\\label\{/, // Labels
172
+ ];
173
+ // Patrones fuertemente indicativos de LaTeX (solo uno necesario)
174
+ const strongLatexPatterns = [
175
+ /\\documentclass\{/, // Document class
176
+ /\\begin\{document\}/, // Begin document
177
+ /\\section\*?\{/, // Sections
178
+ /\\subsection\*?\{/, // Subsections
179
+ /\\usepackage\{/, // Package imports
180
+ /\\textbf\{/, // Bold text
181
+ /\\textit\{/, // Italic text
182
+ /\\emph\{/, // Emphasis
183
+ /\\item\b/, // List items
184
+ /\\cite\{/, // Citations
185
+ /\\ref\{/, // References
186
+ /\\label\{/, // Labels
187
+ ];
188
+ // Si hay patrones fuertes, es LaTeX
189
+ const strongMatches = strongLatexPatterns.filter(pattern => pattern.test(content));
190
+ if (strongMatches.length >= 1) {
191
+ return true;
192
+ }
193
+ // Requiere al menos 2 patrones para confirmar LaTeX
194
+ const matches = latexPatterns.filter(pattern => pattern.test(content));
195
+ return matches.length >= 2;
196
+ }
197
+ /**
198
+ * Detects if content requires Pandoc processing
199
+ *
200
+ * This is a convenience method that combines RST and LaTeX detection to
201
+ * determine if content needs any form of Pandoc processing for conversion
202
+ * to Legal Markdown format.
203
+ *
204
+ * @static
205
+ * @param {string} content - The content to analyze for format patterns
206
+ * @returns {boolean} True if content needs Pandoc processing, false otherwise
207
+ * @example
208
+ * ```typescript
209
+ * const needsProcessing = ContentDetector.needsPandoc(content);
210
+ * if (needsProcessing) {
211
+ * content = await processThroughPandoc(content);
212
+ * }
213
+ * ```
214
+ */
215
+ static needsPandoc(content) {
216
+ return this.needsRstParser(content) || this.needsLatexParser(content);
217
+ }
218
+ }
219
+ exports.ContentDetector = ContentDetector;
220
+ //# sourceMappingURL=content-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-detector.js","sourceRoot":"","sources":["../../src/parsers/content-detector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,eAAe;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,CAAC,cAAc,CAAC,OAAe;QACnC,qDAAqD;QACrD,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,gCAAgC;QAChC,MAAM,WAAW,GAAG;YAClB,mBAAmB,EAAE,aAAa;YAClC,6BAA6B,EAAE,+BAA+B;YAC9D,YAAY,EAAE,kBAAkB;YAChC,uBAAuB,EAAE,iBAAiB;YAC1C,YAAY,EAAE,cAAc;YAC5B,wCAAwC,EAAE,cAAc;YACxD,cAAc,EAAE,4BAA4B;YAC5C,iBAAiB,EAAE,8BAA8B;SAClD,CAAC;QAEF,+DAA+D;QAC/D,MAAM,iBAAiB,GAAG;YACxB,mBAAmB,EAAE,aAAa;YAClC,uBAAuB,EAAE,iCAAiC;YAC1D,wCAAwC,EAAE,cAAc;YACxD,YAAY,EAAE,cAAc;SAC7B,CAAC;QAEF,uDAAuD;QACvD,MAAM,aAAa,GA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AmB,EAAE,iBAAiB;YACtC,qBAAqB,EAAE,iBAAiB;YACxC,gBAAgB,EAAE,WAAW;YAC7B,mBAAmB,EAAE,cAAc;YACnC,gBAAgB,EAAE,kBAAkB;YACpC,YAAY,EAAE,YAAY;YAC1B,YAAY,EAAE,cAAc;YAC5B,UAAU,EAAE,WAAW;YACvB,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,YAAY;YACxB,SAAS,EAAE,aAAa;YACxB,WAAW,EAAE,SAAS;SACvB,CAAC;QAEF,oCAAoC;QACpC,MAAM,aAAa,GAAG,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACnF,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,oDAAoD;QACpD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,WAAW,CAAC,OAAe;QAChC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxE,CAAC;CACF;AA1KD,0CA0KC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Fallback parsers for basic RST and LaTeX conversion when pandoc is not available
3
+ */
4
+ export declare class FallbackParsers {
5
+ /**
6
+ * Basic RST to Markdown conversion
7
+ */
8
+ static convertRstBasic(content: string): string;
9
+ /**
10
+ * Basic LaTeX to Markdown conversion
11
+ */
12
+ static convertLatexBasic(content: string): string;
13
+ }
14
+ //# sourceMappingURL=fallback-parsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fallback-parsers.d.ts","sourceRoot":"","sources":["../../src/parsers/fallback-parsers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IA8E/C;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAwIlD"}
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FallbackParsers = void 0;
4
+ /**
5
+ * Fallback parsers for basic RST and LaTeX conversion when pandoc is not available
6
+ */
7
+ class FallbackParsers {
8
+ /**
9
+ * Basic RST to Markdown conversion
10
+ */
11
+ static convertRstBasic(content) {
12
+ if (process.env.NODE_ENV !== 'test') {
13
+ console.warn('Using basic RST parser - some features may not work correctly');
14
+ }
15
+ let result = content;
16
+ // Convert headers with underlines to markdown headers
17
+ result = result.replace(/^(.+)\n([=]{3,})\s*$/gm, '# $1');
18
+ result = result.replace(/^(.+)\n([-]{3,})\s*$/gm, '## $1');
19
+ result = result.replace(/^(.+)\n([~]{3,})\s*$/gm, '### $1');
20
+ result = result.replace(/^(.+)\n([\^]{3,})\s*$/gm, '#### $1');
21
+ result = result.replace(/^(.+)\n(["]{3,})\s*$/gm, '##### $1');
22
+ result = result.replace(/^(.+)\n([']{3,})\s*$/gm, '###### $1');
23
+ // Convert overlined and underlined headers
24
+ result = result.replace(/^([=]{3,})\n(.+)\n([=]{3,})\s*$/gm, '# $2');
25
+ result = result.replace(/^([-]{3,})\n(.+)\n([-]{3,})\s*$/gm, '## $2');
26
+ // Convert emphasis
27
+ result = result.replace(/\*\*([^*]+)\*\*/g, '**$1**'); // Bold (already markdown)
28
+ result = result.replace(/\*([^*]+)\*/g, '*$1*'); // Italic (already markdown)
29
+ // Convert RST roles
30
+ result = result.replace(/:emphasis:`([^`]+)`/g, '*$1*');
31
+ result = result.replace(/:strong:`([^`]+)`/g, '**$1**');
32
+ result = result.replace(/:literal:`([^`]+)`/g, '`$1`');
33
+ // Convert inline code
34
+ result = result.replace(/``([^`]+)``/g, '`$1`');
35
+ // Convert links
36
+ result = result.replace(/`([^<]+?)\s*<([^>]+?)>`_/g, '[$1]($2)');
37
+ result = result.replace(/`([^`]+)`_/g, '[$1][$1]'); // Reference links
38
+ // Convert bullet lists (RST uses * or -)
39
+ result = result.replace(/^(\s*)\* (.+)/gm, '$1- $2');
40
+ // Convert numbered lists
41
+ result = result.replace(/^(\s*)(\d+)\. (.+)/gm, '$1$2. $3');
42
+ result = result.replace(/^(\s*)(\d+)\) (.+)/gm, '$1$2. $3'); // Parentheses style
43
+ // Convert code blocks FIRST - handle :: at end of line
44
+ result = result.replace(/^(.+)::\s*$/gm, (match, prefix) => {
45
+ return prefix + '\n\n```';
46
+ });
47
+ result = result.replace(/^::\s*$/gm, '```');
48
+ // Check if we have unmatched code blocks and add closing markers
49
+ const codeBlockCount = (result.match(/```/g) || []).length;
50
+ if (codeBlockCount % 2 === 1) {
51
+ result += '\n```';
52
+ }
53
+ // Convert definition lists (but not if they're inside code blocks)
54
+ result = result.replace(/^([^\n]+)\n(\s{4,})(.+)/gm, (match, term, indent, definition) => {
55
+ // Skip if this looks like it's inside a code block
56
+ if (term.includes('```') || definition.includes('```')) {
57
+ return match;
58
+ }
59
+ return `**${term}**\n${indent}${definition}`;
60
+ });
61
+ // Convert directives to blockquotes or comments
62
+ result = result.replace(/^\.\.[ \t]+note::[ \t]*(.*)$/gm, '> **Note:** $1');
63
+ result = result.replace(/^\.\.[ \t]+warning::[ \t]*(.*)$/gm, '> **Warning:** $1');
64
+ result = result.replace(/^\.\.[ \t]+important::[ \t]*(.*)$/gm, '> **Important:** $1');
65
+ result = result.replace(/^\.\.[ \t]+(\w+)::[ \t]*(.*)$/gm, '<!-- $1: $2 -->');
66
+ // Handle simple URLs (but not those already in markdown links)
67
+ result = result.replace(/(?<!\]\()https?:\/\/[^\s<>)]+(?!\))/g, '<$&>');
68
+ // Clean up extra whitespace
69
+ result = result.replace(/\n{3,}/g, '\n\n');
70
+ return result.trim();
71
+ }
72
+ /**
73
+ * Basic LaTeX to Markdown conversion
74
+ */
75
+ static convertLatexBasic(content) {
76
+ if (process.env.NODE_ENV !== 'test') {
77
+ console.warn('Using basic LaTeX parser - some features may not work correctly');
78
+ }
79
+ let result = content;
80
+ // Extract document metadata
81
+ const titleMatch = result.match(/\\title\{([^}]+)\}/);
82
+ const authorMatch = result.match(/\\author\{([^}]+)\}/);
83
+ const dateMatch = result.match(/\\date\{([^}]+)\}/);
84
+ let metadata = '';
85
+ if (titleMatch || authorMatch || dateMatch) {
86
+ metadata = '---\n';
87
+ if (titleMatch)
88
+ metadata += `title: "${titleMatch[1]}"\n`;
89
+ if (authorMatch)
90
+ metadata += `author: "${authorMatch[1]}"\n`;
91
+ if (dateMatch)
92
+ metadata += `date: "${dateMatch[1]}"\n`;
93
+ metadata += '---\n\n';
94
+ }
95
+ // Remove document class and begin/end document
96
+ result = result.replace(/\\documentclass\{[^}]*\}/g, '');
97
+ result = result.replace(/\\usepackage\{[^}]*\}/g, '');
98
+ result = result.replace(/\\title\{[^}]*\}/g, '');
99
+ result = result.replace(/\\author\{[^}]*\}/g, '');
100
+ result = result.replace(/\\date\{[^}]*\}/g, '');
101
+ result = result.replace(/\\maketitle/g, '');
102
+ result = result.replace(/\\begin\{document\}/g, '');
103
+ result = result.replace(/\\end\{document\}/g, '');
104
+ // Convert sections
105
+ result = result.replace(/\\section\*?\{([^}]+)\}/g, '# $1');
106
+ result = result.replace(/\\subsection\*?\{([^}]+)\}/g, '## $1');
107
+ result = result.replace(/\\subsubsection\*?\{([^}]+)\}/g, '### $1');
108
+ result = result.replace(/\\paragraph\*?\{([^}]+)\}/g, '#### $1');
109
+ result = result.replace(/\\subparagraph\*?\{([^}]+)\}/g, '##### $1');
110
+ // Convert emphasis
111
+ result = result.replace(/\\textbf\{([^}]+)\}/g, '**$1**');
112
+ result = result.replace(/\\textit\{([^}]+)\}/g, '*$1*');
113
+ result = result.replace(/\\emph\{([^}]+)\}/g, '*$1*');
114
+ result = result.replace(/\\texttt\{([^}]+)\}/g, '`$1`');
115
+ result = result.replace(/\\underline\{([^}]+)\}/g, '__$1__');
116
+ // Convert inline code
117
+ result = result.replace(/\\verb\|([^|]+)\|/g, '`$1`');
118
+ // Convert links
119
+ result = result.replace(/\\href\{([^}]+)\}\{([^}]+)\}/g, '[$2]($1)');
120
+ result = result.replace(/\\url\{([^}]+)\}/g, '<$1>');
121
+ result = result.replace(/\\cite\{([^}]+)\}/g, '[$1]');
122
+ result = result.replace(/\\ref\{([^}]+)\}/g, '[$1]');
123
+ result = result.replace(/\\label\{([^}]+)\}/g, '<a name="$1"></a>');
124
+ // Convert lists by processing blocks
125
+ result = result.replace(/\\begin\{enumerate\}([\s\S]*?)\\end\{enumerate\}/g, (match, content) => {
126
+ let counter = 1;
127
+ return content.replace(/\\item\s+/g, () => `${counter++}. `);
128
+ });
129
+ result = result.replace(/\\begin\{itemize\}([\s\S]*?)\\end\{itemize\}/g, (match, content) => {
130
+ return content.replace(/\\item\s+/g, '- ');
131
+ });
132
+ result = result.replace(/\\begin\{description\}([\s\S]*?)\\end\{description\}/g, (match, content) => {
133
+ return content.replace(/\\item\[([^\]]+)\]\s*([^\n\r]*)/g, '**$1**\n $2');
134
+ });
135
+ // Clean up any remaining list environments
136
+ result = result.replace(/\\begin\{itemize\}/g, '');
137
+ result = result.replace(/\\end\{itemize\}/g, '');
138
+ result = result.replace(/\\begin\{enumerate\}/g, '');
139
+ result = result.replace(/\\end\{enumerate\}/g, '');
140
+ result = result.replace(/\\begin\{description\}/g, '');
141
+ result = result.replace(/\\end\{description\}/g, '');
142
+ result = result.replace(/\\item\s+/g, '- '); // Fallback for any remaining items
143
+ // Convert footnotes
144
+ let footnoteCounter = 1;
145
+ const footnotes = [];
146
+ result = result.replace(/\\footnote\{([^}]+)\}/g, (match, text) => {
147
+ footnotes.push(`[^${footnoteCounter}]: ${text}`);
148
+ return `[^${footnoteCounter++}]`;
149
+ });
150
+ // Convert quotes
151
+ result = result.replace(/\\begin\{quote\}([\s\S]*?)\\end\{quote\}/g, (match, content) => {
152
+ // Convert content inside quotes to blockquotes
153
+ const lines = content.trim().split('\n');
154
+ return lines.map((line) => (line.trim() ? `> ${line}` : '>')).join('\n');
155
+ });
156
+ // Convert LaTeX quotes
157
+ result = result.replace(/``([^']+)''/g, '"$1"');
158
+ result = result.replace(/\\`([^']+)'/g, "'$1'");
159
+ // Convert code blocks
160
+ result = result.replace(/\\begin\{verbatim\}/g, '```\n');
161
+ result = result.replace(/\\end\{verbatim\}/g, '\n```');
162
+ result = result.replace(/\\begin\{lstlisting\}(\[language=([^\]]+)\])?/g, '```$2\n');
163
+ result = result.replace(/\\end\{lstlisting\}/g, '\n```');
164
+ result = result.replace(/\\begin\{minted\}\{([^}]+)\}/g, '```$1\n');
165
+ result = result.replace(/\\end\{minted\}/g, '\n```');
166
+ // Remove common LaTeX commands
167
+ result = result.replace(/\\tableofcontents/g, '');
168
+ result = result.replace(/\\newpage/g, '');
169
+ result = result.replace(/\\clearpage/g, '');
170
+ result = result.replace(/\\bigskip/g, '');
171
+ result = result.replace(/\\\\/g, ' '); // Line breaks
172
+ // Remove comments
173
+ result = result.replace(/^%.*$/gm, '');
174
+ result = result.replace(/([^\\])%.*$/gm, '$1');
175
+ // Remove remaining backslash commands
176
+ result = result.replace(/\\[a-zA-Z]+(\[[^\]]*\])?(\{[^}]*\})?/g, '');
177
+ // Clean up extra whitespace
178
+ result = result.replace(/\n{3,}/g, '\n\n');
179
+ result = result.replace(/\s{2,}/g, ' ');
180
+ // Add footnotes at the end
181
+ if (footnotes.length > 0) {
182
+ result += '\n\n' + footnotes.join('\n');
183
+ }
184
+ return (metadata + result).trim();
185
+ }
186
+ }
187
+ exports.FallbackParsers = FallbackParsers;
188
+ //# sourceMappingURL=fallback-parsers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAClD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC1C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC1C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,cAAc;QAEtD,kBAAkB;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACvC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAE/C,sCAAsC;QACtC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,uCAAuC,EAAE,EAAE,CAAC,CAAC;QAErE,4BAA4B;QAC5B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC3C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAExC,2BAA2B;QAC3B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CACF;AA7ND,0CA6NC"}
@@ -0,0 +1,13 @@
1
+ import { PandocParser, PandocOptions } from '../pandoc-parser';
2
+ /**
3
+ * Native pandoc implementation for Node.js
4
+ */
5
+ export declare class PandocNative implements PandocParser {
6
+ private options;
7
+ constructor(options?: PandocOptions);
8
+ /**
9
+ * Convert content using native pandoc binary
10
+ */
11
+ convert(content: string, from: 'rst' | 'latex', to: 'markdown'): Promise<string>;
12
+ }
13
+ //# sourceMappingURL=pandoc-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pandoc-native.d.ts","sourceRoot":"","sources":["../../../src/parsers/implementations/pandoc-native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,OAAO,CAAgB;gBAEnB,OAAO,GAAE,aAAkB;IAQvC;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CAoDvF"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PandocNative = void 0;
4
+ const child_process_1 = require("child_process");
5
+ /**
6
+ * Native pandoc implementation for Node.js
7
+ */
8
+ class PandocNative {
9
+ constructor(options = {}) {
10
+ this.options = {
11
+ timeout: 10000, // 10 seconds default timeout
12
+ verbose: false,
13
+ ...options,
14
+ };
15
+ }
16
+ /**
17
+ * Convert content using native pandoc binary
18
+ */
19
+ async convert(content, from, to) {
20
+ return new Promise((resolve, reject) => {
21
+ const args = ['-f', from, '-t', to, '--wrap=none'];
22
+ // Add any additional arguments
23
+ if (this.options.args) {
24
+ args.push(...this.options.args);
25
+ }
26
+ if (this.options.verbose) {
27
+ console.log(`Running pandoc with args: ${args.join(' ')}`);
28
+ }
29
+ const pandoc = (0, child_process_1.spawn)('pandoc', args);
30
+ let output = '';
31
+ let error = '';
32
+ // Set up timeout
33
+ const timeout = setTimeout(() => {
34
+ pandoc.kill();
35
+ reject(new Error(`Pandoc conversion timed out after ${this.options.timeout}ms`));
36
+ }, this.options.timeout);
37
+ pandoc.stdout.on('data', data => {
38
+ output += data.toString();
39
+ });
40
+ pandoc.stderr.on('data', data => {
41
+ error += data.toString();
42
+ });
43
+ pandoc.on('close', code => {
44
+ clearTimeout(timeout);
45
+ if (code === 0) {
46
+ resolve(output);
47
+ }
48
+ else {
49
+ reject(new Error(`Pandoc failed with code ${code}: ${error}`));
50
+ }
51
+ });
52
+ pandoc.on('error', err => {
53
+ clearTimeout(timeout);
54
+ reject(new Error(`Failed to start pandoc: ${err.message}`));
55
+ });
56
+ // Write input and close stdin
57
+ pandoc.stdin.write(content);
58
+ pandoc.stdin.end();
59
+ });
60
+ }
61
+ }
62
+ exports.PandocNative = PandocNative;
63
+ //# sourceMappingURL=pandoc-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pandoc-native.js","sourceRoot":"","sources":["../../../src/parsers/implementations/pandoc-native.ts"],"names":[],"mappings":";;;AAAA,iDAAsC;AAGtC;;GAEG;AACH,MAAa,YAAY;IAGvB,YAAY,UAAyB,EAAE;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,KAAK,EAAE,6BAA6B;YAC7C,OAAO,EAAE,KAAK;YACd,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,IAAqB,EAAE,EAAc;QAClE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;YAEnD,+BAA+B;YAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;YAED,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,CAAC,IAAI,CAAC,GAA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,EAAE,CAAC,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;YAEH,8BAA8B;YAC9B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlED,oCAkEC"}
@@ -0,0 +1,14 @@
1
+ import { PandocParser, PandocOptions } from '../pandoc-parser';
2
+ /**
3
+ * Pandoc WebAssembly implementation for browser
4
+ */
5
+ export declare class PandocWasm implements PandocParser {
6
+ private pandocWasm;
7
+ private options;
8
+ constructor(pandocWasm: any, options?: PandocOptions);
9
+ /**
10
+ * Convert content using pandoc-wasm
11
+ */
12
+ convert(content: string, from: 'rst' | 'latex', to: 'markdown'): Promise<string>;
13
+ }
14
+ //# sourceMappingURL=pandoc-wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pandoc-wasm.d.ts","sourceRoot":"","sources":["../../../src/parsers/implementations/pandoc-wasm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,qBAAa,UAAW,YAAW,YAAY;IAC7C,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,OAAO,CAAgB;gBAEnB,UAAU,EAAE,GAAG,EAAE,OAAO,GAAE,aAAkB;IASxD;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CA6CvF"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PandocWasm = void 0;
4
+ /**
5
+ * Pandoc WebAssembly implementation for browser
6
+ */
7
+ class PandocWasm {
8
+ constructor(pandocWasm, options = {}) {
9
+ this.pandocWasm = pandocWasm;
10
+ this.options = {
11
+ timeout: 10000, // 10 seconds default timeout
12
+ verbose: false,
13
+ ...options,
14
+ };
15
+ }
16
+ /**
17
+ * Convert content using pandoc-wasm
18
+ */
19
+ async convert(content, from, to) {
20
+ if (!this.pandocWasm) {
21
+ throw new Error('Pandoc WASM not initialized');
22
+ }
23
+ try {
24
+ if (this.options.verbose) {
25
+ console.log(`Converting ${from} to ${to} using pandoc-wasm`);
26
+ }
27
+ // Create a timeout promise
28
+ const timeoutPromise = new Promise((_, reject) => {
29
+ setTimeout(() => {
30
+ reject(new Error(`Pandoc WASM conversion timed out after ${this.options.timeout}ms`));
31
+ }, this.options.timeout);
32
+ });
33
+ // Different pandoc-wasm versions have different APIs
34
+ let conversionPromise;
35
+ if (typeof this.pandocWasm.convert === 'function') {
36
+ // Direct convert method
37
+ conversionPromise = Promise.resolve(this.pandocWasm.convert(content, from, to));
38
+ }
39
+ else if (typeof this.pandocWasm.pandoc === 'function') {
40
+ // Pandoc function interface
41
+ conversionPromise = Promise.resolve(this.pandocWasm.pandoc(content, { from, to }));
42
+ }
43
+ else if (typeof this.pandocWasm.run === 'function') {
44
+ // Run interface with arguments
45
+ const args = ['-f', from, '-t', to, '--wrap=none'];
46
+ if (this.options.args) {
47
+ args.push(...this.options.args);
48
+ }
49
+ conversionPromise = Promise.resolve(this.pandocWasm.run(args, content));
50
+ }
51
+ else {
52
+ throw new Error('Unsupported pandoc-wasm API');
53
+ }
54
+ // Race between conversion and timeout
55
+ const result = await Promise.race([conversionPromise, timeoutPromise]);
56
+ return result;
57
+ }
58
+ catch (error) {
59
+ throw new Error(`Pandoc WASM conversion failed: ${error.message}`);
60
+ }
61
+ }
62
+ }
63
+ exports.PandocWasm = PandocWasm;
64
+ //# sourceMappingURL=pandoc-wasm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pandoc-wasm.js","sourceRoot":"","sources":["../../../src/parsers/implementations/pandoc-wasm.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,U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