#!/usr/bin/env node /** * Wrapper script to process content using gc-parser * Called from Go code via exec */ const { Parser } = require('gc-parser'); // Read content from stdin let content = ''; process.stdin.setEncoding('utf8'); process.stdin.on('data', (chunk) => { content += chunk; }); process.stdin.on('end', async () => { try { // Parse options from environment or command line args const linkBaseURL = process.env.LINK_BASE_URL || process.argv[2] || ''; // Create parser with options const parser = new Parser({ linkBaseURL: linkBaseURL, enableAsciiDoc: true, enableMarkdown: true, enableCodeHighlighting: true, enableLaTeX: true, enableMusicalNotation: true, enableNostrAddresses: true, }); // Process content const result = await parser.process(content); // Output as JSON console.log(JSON.stringify(result)); } catch (error) { console.error(JSON.stringify({ error: error.message, stack: error.stack, })); process.exit(1); } });