-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug-md.js
More file actions
79 lines (69 loc) · 2.54 KB
/
debug-md.js
File metadata and controls
79 lines (69 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env node
const { CueModeRenderer } = require('./cuemode-renderer');
const path = require('path');
// Get command line arguments
const args = process.argv.slice(2);
if (args.length === 0) {
console.log('🎯 CueMode Debug Tool');
console.log('');
console.log('Usage: node debug-md.js <markdown-file-path> [options]');
console.log('');
console.log('Examples:');
console.log(' node debug-md.js test.md');
console.log(' node debug-md.js /path/to/file.md --fontSize=30 --theme=dark');
console.log('');
console.log('Options:');
console.log(' --fontSize=<number> Font size (default: 25)');
console.log(' --lineHeight=<number> Line height (default: 1)');
console.log(' --padding=<number> Padding (default: 10)');
console.log(' --theme=<theme> Theme (default: rose)');
console.log(' --output=<file> Output filename');
process.exit(1);
}
const markdownFile = args[0];
// Parse options
const options = {};
args.slice(1).forEach(arg => {
if (arg.startsWith('--')) {
const [key, value] = arg.substring(2).split('=');
if (key && value) {
// Try to convert to number
const numValue = parseFloat(value);
options[key] = isNaN(numValue) ? value : numValue;
}
}
});
console.log('🚀 Starting CueMode debug renderer...');
console.log('');
console.log('📂 Input file:', markdownFile);
console.log('⚙️ Configuration options:', options);
try {
const renderer = new CueModeRenderer(options);
const result = renderer.renderFile(markdownFile, options.output);
console.log('');
console.log('✅ Rendering completed!');
console.log('📄 Output file:', result.outputFile);
console.log('📊 Statistics:');
console.log(' - Original HTML length:', result.stats.originalLength);
console.log(' - Logical block count:', result.stats.blockCount);
console.log(' - Filtered block count:', result.stats.filteredCount);
console.log('');
console.log('🌐 Open in browser for debugging:');
console.log(` open ${result.outputFile}`);
console.log('');
console.log('🎛️ Debug features:');
console.log(' - Click any block to view details');
console.log(' - Check browser console for detailed information');
// Auto-open browser (macOS)
if (process.platform === 'darwin') {
const { exec } = require('child_process');
exec(`open ${result.outputFile}`, (error) => {
if (!error) {
console.log('🎉 Debug file opened in browser');
}
});
}
} catch (error) {
console.error('❌ Rendering failed:', error.message);
process.exit(1);
}