vimd 0.3.12 → 0.3.13
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/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +2 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +2 -1
- package/dist/core/parser/parser-factory.d.ts +5 -3
- package/dist/core/parser/parser-factory.d.ts.map +1 -1
- package/dist/core/parser/parser-factory.js +7 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AASA,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AASA,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAoEf"}
|
|
@@ -39,12 +39,13 @@ export async function buildCommand(filePath, options) {
|
|
|
39
39
|
...config.pandoc,
|
|
40
40
|
standalone: true, // build always uses standalone
|
|
41
41
|
};
|
|
42
|
-
const parser = ParserFactory.create(parserType, pandocOptions);
|
|
42
|
+
const parser = ParserFactory.create(parserType, pandocOptions, config.math);
|
|
43
43
|
const converter = new MarkdownConverter({
|
|
44
44
|
theme: config.theme,
|
|
45
45
|
pandocOptions: pandocOptions,
|
|
46
46
|
customCSS: config.css,
|
|
47
47
|
template: config.template || undefined,
|
|
48
|
+
mathEnabled: config.math?.enabled ?? true,
|
|
48
49
|
});
|
|
49
50
|
converter.setParser(parser);
|
|
50
51
|
// 7. Execute conversion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAcA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAcA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CAyKf"}
|
package/dist/cli/commands/dev.js
CHANGED
|
@@ -68,12 +68,13 @@ export async function devCommand(filePath, options) {
|
|
|
68
68
|
const htmlFileName = `vimd-preview-${basename}.html`;
|
|
69
69
|
const htmlPath = path.join(sourceDir, htmlFileName);
|
|
70
70
|
// 9. Prepare converter with selected parser
|
|
71
|
-
const parser = ParserFactory.create(parserType, config.pandoc);
|
|
71
|
+
const parser = ParserFactory.create(parserType, config.pandoc, config.math);
|
|
72
72
|
const converter = new MarkdownConverter({
|
|
73
73
|
theme: config.theme,
|
|
74
74
|
pandocOptions: config.pandoc,
|
|
75
75
|
customCSS: config.css,
|
|
76
76
|
template: config.template,
|
|
77
|
+
mathEnabled: config.math?.enabled ?? true,
|
|
77
78
|
});
|
|
78
79
|
converter.setParser(parser);
|
|
79
80
|
// 10. Initial conversion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Parser, ParserType } from './types.js';
|
|
2
|
-
import { PandocConfig } from '../../config/types.js';
|
|
2
|
+
import { PandocConfig, MathConfig } from '../../config/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Factory for creating parser instances.
|
|
5
5
|
* Provides methods to create parsers by type and with fallback support.
|
|
@@ -9,19 +9,21 @@ export declare class ParserFactory {
|
|
|
9
9
|
* Create a parser instance by type.
|
|
10
10
|
* @param type - The type of parser to create
|
|
11
11
|
* @param pandocConfig - Optional configuration for pandoc parser
|
|
12
|
+
* @param mathConfig - Optional configuration for math support
|
|
12
13
|
* @returns A parser instance
|
|
13
14
|
* @throws Error if the parser type is unknown
|
|
14
15
|
*/
|
|
15
|
-
static create(type: ParserType, pandocConfig?: Partial<PandocConfig
|
|
16
|
+
static create(type: ParserType, pandocConfig?: Partial<PandocConfig>, mathConfig?: MathConfig): Parser;
|
|
16
17
|
/**
|
|
17
18
|
* Create a parser with fallback support.
|
|
18
19
|
* If the preferred parser is not available, falls back to markdown-it.
|
|
19
20
|
* @param preferred - The preferred parser type
|
|
20
21
|
* @param pandocConfig - Optional configuration for pandoc parser
|
|
22
|
+
* @param mathConfig - Optional configuration for math support
|
|
21
23
|
* @returns A parser instance that is guaranteed to be available
|
|
22
24
|
* @throws Error if pandoc is preferred but not installed (no silent fallback)
|
|
23
25
|
*/
|
|
24
|
-
static createWithFallback(preferred: ParserType, pandocConfig?: Partial<PandocConfig
|
|
26
|
+
static createWithFallback(preferred: ParserType, pandocConfig?: Partial<PandocConfig>, mathConfig?: MathConfig): Promise<Parser>;
|
|
25
27
|
/**
|
|
26
28
|
* Get the default parser type for dev mode.
|
|
27
29
|
* @returns 'markdown-it' as the default for fast preview
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-factory.d.ts","sourceRoot":"","sources":["../../../src/core/parser/parser-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"parser-factory.d.ts","sourceRoot":"","sources":["../../../src/core/parser/parser-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;;GAGG;AACH,qBAAa,aAAa;IACxB;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,UAAU,EAChB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EACpC,UAAU,CAAC,EAAE,UAAU,GACtB,MAAM;IAaT;;;;;;;;OAQG;WACU,kBAAkB,CAC7B,SAAS,EAAE,UAAU,EACrB,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EACpC,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,MAAM,CAAC;IAmBlB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,IAAI,UAAU;IAIxC;;;OAGG;IACH,MAAM,CAAC,qBAAqB,IAAI,UAAU;CAG3C"}
|
|
@@ -10,15 +10,16 @@ export class ParserFactory {
|
|
|
10
10
|
* Create a parser instance by type.
|
|
11
11
|
* @param type - The type of parser to create
|
|
12
12
|
* @param pandocConfig - Optional configuration for pandoc parser
|
|
13
|
+
* @param mathConfig - Optional configuration for math support
|
|
13
14
|
* @returns A parser instance
|
|
14
15
|
* @throws Error if the parser type is unknown
|
|
15
16
|
*/
|
|
16
|
-
static create(type, pandocConfig) {
|
|
17
|
+
static create(type, pandocConfig, mathConfig) {
|
|
17
18
|
switch (type) {
|
|
18
19
|
case 'markdown-it':
|
|
19
|
-
return new MarkdownItParser();
|
|
20
|
+
return new MarkdownItParser(mathConfig);
|
|
20
21
|
case 'pandoc':
|
|
21
|
-
return new PandocParser(pandocConfig);
|
|
22
|
+
return new PandocParser(pandocConfig, mathConfig);
|
|
22
23
|
default:
|
|
23
24
|
// TypeScript exhaustive check
|
|
24
25
|
const _exhaustive = type;
|
|
@@ -30,11 +31,12 @@ export class ParserFactory {
|
|
|
30
31
|
* If the preferred parser is not available, falls back to markdown-it.
|
|
31
32
|
* @param preferred - The preferred parser type
|
|
32
33
|
* @param pandocConfig - Optional configuration for pandoc parser
|
|
34
|
+
* @param mathConfig - Optional configuration for math support
|
|
33
35
|
* @returns A parser instance that is guaranteed to be available
|
|
34
36
|
* @throws Error if pandoc is preferred but not installed (no silent fallback)
|
|
35
37
|
*/
|
|
36
|
-
static async createWithFallback(preferred, pandocConfig) {
|
|
37
|
-
const parser = this.create(preferred, pandocConfig);
|
|
38
|
+
static async createWithFallback(preferred, pandocConfig, mathConfig) {
|
|
39
|
+
const parser = this.create(preferred, pandocConfig, mathConfig);
|
|
38
40
|
if (await parser.isAvailable()) {
|
|
39
41
|
return parser;
|
|
40
42
|
}
|